From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10489 invoked by alias); 5 Aug 2018 22:09:51 -0000 Mailing-List: contact cygwin-apps-help@cygwin.com; run by ezmlm Precedence: bulk Sender: cygwin-apps-owner@cygwin.com List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Mail-Followup-To: cygwin-apps@cygwin.com Received: (qmail 10399 invoked by uid 89); 5 Aug 2018 22:09:50 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-24.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=offer X-HELO: rgout03.bt.lon5.cpcloud.co.uk Received: from rgout0305.bt.lon5.cpcloud.co.uk (HELO rgout03.bt.lon5.cpcloud.co.uk) (65.20.0.211) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 05 Aug 2018 22:09:49 +0000 X-OWM-Source-IP: 86.151.121.200 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-SNCR-VADESECURE: CLEAN Received: from localhost.localdomain (86.151.121.200) by rgout03.bt.lon5.cpcloud.co.uk (9.0.019.26-1) (authenticated as jonturney@btinternet.com) id 5B4CE16C01FB59C9; Sun, 5 Aug 2018 23:09:48 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH setup 02/13] Add OnNotify virtual function to class Window for WM_NOTIFY notifications Date: Sun, 05 Aug 2018 22:09:00 -0000 Message-Id: <20180805220851.270212-3-jon.turney@dronecode.org.uk> In-Reply-To: <20180805220851.270212-1-jon.turney@dronecode.org.uk> References: <20180805220851.270212-1-jon.turney@dronecode.org.uk> X-SW-Source: 2018-08/txt/msg00009.txt.bz2 Add OnNotify virtual function to class Window for WM_NOTIFY notifications Note that the result is returned via DWLP_MSGRESULT --- proppage.cc | 14 +++++++++++++- window.h | 7 +++++++ 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/proppage.cc b/proppage.cc index 6b83640..8da1c52 100644 --- a/proppage.cc +++ b/proppage.cc @@ -140,7 +140,18 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam) return TRUE; } case WM_NOTIFY: - switch (((NMHDR FAR *) lParam)->code) + { + NMHDR *pNmHdr = (NMHDR *) lParam; + + // offer to subclass first + LRESULT result = 0; + if (OnNotify (pNmHdr, &result)) + { + SetWindowLongPtr (GetHWND (), DWLP_MSGRESULT, result); + return TRUE; + } + + switch (pNmHdr->code) { case PSN_APPLY: { @@ -261,6 +272,7 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam) return FALSE; } } + } break; case WM_COMMAND: { diff --git a/window.h b/window.h index ca6baa6..d8b712b 100644 --- a/window.h +++ b/window.h @@ -138,6 +138,13 @@ public: return false; }; + virtual bool OnNotify (NMHDR *pNmHdr, LRESULT *pResult) + { + // Not processed by default. Override in derived classes to + // do something with command messages if you need to. + return false; + }; + RECT GetWindowRect() const; RECT GetClientRect() const; -- 2.17.0