From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-apps@cygwin.com
Cc: Jon Turney <jon.turney@dronecode.org.uk>
Subject: [PATCH setup 6/6] Use a splitbutton to show the view choosing popup menu
Date: Fri, 26 Aug 2016 14:43:00 -0000 [thread overview]
Message-ID: <20160826144252.23840-2-jon.turney@dronecode.org.uk> (raw)
In-Reply-To: <20160826144252.23840-1-jon.turney@dronecode.org.uk>
Pass WM_NOTIFY notifications for child controls of the property page through
to OnMessageCommand as well.
Future-proof RootPage::OnMessageCmd() to check the notification code.
Give IDC_CHOOSE_VIEW button the BS_SPLITBUTTON style, and handle the
BCN_DROPDOWN notification from that to show the view choosing menu.
---
choose.cc | 34 +++++++++++++++++++---------------
proppage.cc | 10 +++++++---
res.rc | 6 +++---
root.cc | 3 +++
4 files changed, 32 insertions(+), 21 deletions(-)
diff --git a/choose.cc b/choose.cc
index 19c1fc9..ecfd5f1 100644
--- a/choose.cc
+++ b/choose.cc
@@ -385,17 +385,18 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
Log (LOG_BABBLE) << "OnMesageCmd " << id << " " << hwndctl << " " << code << endLog;
#endif
- if (code == EN_CHANGE && id == IDC_CHOOSE_SEARCH_EDIT)
+ if (code == EN_CHANGE)
{
- SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL);
- return true;
- }
- else if (code != BN_CLICKED && code != EN_CHANGE)
- {
- // Not a click notification, we don't care.
- return false;
+ if (id == IDC_CHOOSE_SEARCH_EDIT)
+ {
+ SetTimer(GetHWND (), timer_id, SEARCH_TIMER_DELAY, (TIMERPROC) NULL);
+ return true;
+ }
+ else
+ return false;
}
-
+ else if (code == BN_CLICKED)
+ {
switch (id)
{
case IDC_CHOOSE_CLEAR_SEARCH:
@@ -422,10 +423,6 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
changeTrust (TRUST_TEST);
break;
- case IDC_CHOOSE_VIEW:
- selectView();
- break;
-
case IDC_CHOOSE_HIDE:
chooser->setObsolete (!IsButtonChecked (id));
break;
@@ -433,9 +430,16 @@ ChooserPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
// Wasn't recognized or handled.
return false;
}
-
- // Was handled since we never got to default above.
return true;
+ }
+ else if (code == BCN_DROPDOWN)
+ {
+ if (id == IDC_CHOOSE_VIEW)
+ selectView();
+ }
+
+ // we don't care.
+ return false;
}
static void
diff --git a/proppage.cc b/proppage.cc
index c03e5f7..31f439f 100644
--- a/proppage.cc
+++ b/proppage.cc
@@ -139,7 +139,9 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
return TRUE;
}
case WM_NOTIFY:
- switch (((NMHDR FAR *) lParam)->code)
+ {
+ NMHDR *pNmHdr = (NMHDR *) lParam;
+ switch (pNmHdr->code)
{
case PSN_APPLY:
{
@@ -256,10 +258,12 @@ PropertyPage::DialogProc (UINT message, WPARAM wParam, LPARAM lParam)
}
default:
{
- // Unrecognized notification
- return FALSE;
+ // Pass unrecognized notifications to WM_COMMAND handler
+ return OnMessageCmd (pNmHdr->idFrom, pNmHdr->hwndFrom,
+ pNmHdr->code);
}
}
+ }
break;
case WM_COMMAND:
{
diff --git a/res.rc b/res.rc
index 0d124a6..2cdacfb 100644
--- a/res.rc
+++ b/res.rc
@@ -318,8 +318,8 @@ END
// Left-aligned controls.
#define SETUP_VIEW_X (7)
-#define SETUP_VIEW_W (26)
-#define SETUP_SEARCH_X (SETUP_VIEW_X + SETUP_VIEW_W + 125)
+#define SETUP_VIEW_W (33)
+#define SETUP_SEARCH_X (SETUP_VIEW_X + SETUP_VIEW_W + 2)
#define SETUP_SEARCH_W (32)
#define SETUP_SEARCHTEXT_X (SETUP_SEARCH_X + SETUP_SEARCH_W + 2)
#define SETUP_SEARCHTEXT_W (60)
@@ -333,7 +333,7 @@ CAPTION "Cygwin Setup - Select Packages"
FONT 8, "MS Shell Dlg"
BEGIN
PUSHBUTTON "&View", IDC_CHOOSE_VIEW, SETUP_VIEW_X, 30, SETUP_VIEW_W,
- 14, WS_EX_RIGHT
+ 14, BS_SPLITBUTTON
RTEXT "&Search", IDC_STATIC, SETUP_SEARCH_X, 33, SETUP_SEARCH_W,
10, SS_CENTERIMAGE, WS_EX_RIGHT
EDITTEXT IDC_CHOOSE_SEARCH_EDIT, SETUP_SEARCHTEXT_X, 30,
diff --git a/root.cc b/root.cc
index edf7a91..80f3162 100644
--- a/root.cc
+++ b/root.cc
@@ -227,6 +227,9 @@ directory_contains_wrong_version (HWND h)
bool
RootPage::OnMessageCmd (int id, HWND hwndctl, UINT code)
{
+ if ((code != BN_CLICKED) && (code != EN_CHANGE))
+ return false;
+
switch (id)
{
--
2.8.3
next prev parent reply other threads:[~2016-08-26 14:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-24 14:16 [PATCH setup 0/4] Use a pop-up menu to select chooser view filter Jon Turney
2016-08-24 14:16 ` [PATCH setup 1/4] Build C++ code with -std=gnu++11 Jon Turney
2016-08-24 14:16 ` [PATCH setup 3/4] Rename PickView::Package to PickView::PackagePending Jon Turney
2016-08-24 14:16 ` [PATCH setup 4/4] Use a pop-up menu to directly select chooser view filter Jon Turney
2016-08-24 14:16 ` [PATCH setup 2/4] Change PickView::view into an enum Jon Turney
2016-08-24 16:50 ` [PATCH setup 0/4] Use a pop-up menu to select chooser view filter Corinna Vinschen
2016-08-25 19:11 ` Jon Turney
2016-08-25 20:34 ` Yaakov Selkowitz
2016-08-26 8:07 ` Corinna Vinschen
2016-08-26 14:41 ` Jon Turney
2016-08-26 14:43 ` [PATCH setup 5/6] Simplify view mode indication Jon Turney
2016-08-26 14:43 ` Jon Turney [this message]
2016-08-26 15:25 ` [PATCH setup 0/4] Use a pop-up menu to select chooser view filter Corinna Vinschen
2016-08-29 10:03 ` Jon Turney
2016-08-29 10:04 ` [PATCH setup 4/4] Use a drop-down list to directly " Jon Turney
2016-08-30 13:01 ` Corinna Vinschen
2016-08-30 23:29 ` Jon Turney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160826144252.23840-2-jon.turney@dronecode.org.uk \
--to=jon.turney@dronecode.org.uk \
--cc=cygwin-apps@cygwin.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).