• R/O
  • HTTP
  • SSH
  • HTTPS

コミット

タグ
未設定

よく使われているワード(クリックで追加)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

The MinGW.org Installation Manager Tool


コミットメタ情報

リビジョン896f3ec1a4d16096c72faebecaa3c5d501ccf004 (tree)
日時2012-12-13 00:56:26
作者Keith Marshall <keithmarshall@user...>
コミッターKeith Marshall

ログメッセージ

Make a clone of the package menu available as a pop-up.

変更サマリ

差分

--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,15 @@
11 2012-12-12 Keith Marshall <keithmarshall@users.sourceforge.net>
22
3+ Make a clone of the package menu available as a pop-up.
4+
5+ * src/guimain.h (AppWindowMaker::SelectPackageAction): New private
6+ method; declare it.
7+
8+ * src/pkgdata.cpp (AppWindowMaker::SelectPackageAction): Implement it.
9+ (AppWindowMaker::OnNotify) [ID_PACKAGE_LISTVIEW]: Use it.
10+
11+2012-12-12 Keith Marshall <keithmarshall@users.sourceforge.net>
12+
313 Improve conditionally enabled state manipulation for menu items.
414
515 * src/guidata.rc (IDM_REPO_APPLY): Set its initial state as GRAYED.
--- a/src/guimain.h
+++ b/src/guimain.h
@@ -203,6 +203,7 @@ class AppWindowMaker: public WTK::MainWindowMaker
203203 void UpdatePackageMenuBindings( void );
204204 void Schedule( unsigned long, const char * = NULL, const char * = NULL );
205205 inline void MarkSchedule( pkgActionItem * );
206+ void SelectPackageAction( unsigned );
206207 void UnmarkSelectedPackage( void );
207208
208209 DataSheetMaker *DataSheet;
--- a/src/pkgdata.cpp
+++ b/src/pkgdata.cpp
@@ -25,6 +25,8 @@
2525 * arising from the use of this software.
2626 *
2727 */
28+#define _WIN32_IE 0x0300
29+
2830 #include <stdlib.h>
2931 #include <string.h>
3032
@@ -38,6 +40,8 @@
3840 #include "pkglist.h"
3941 #include "pkgtask.h"
4042
43+#include <windowsx.h>
44+
4145 using WTK::StringResource;
4246 using WTK::WindowClassMaker;
4347 using WTK::ChildWindowMaker;
@@ -1128,6 +1132,47 @@ void AppWindowMaker::UnmarkSelectedPackage( void )
11281132 }
11291133 }
11301134
1135+void AppWindowMaker::SelectPackageAction( unsigned mode )
1136+{
1137+ /* Helper method to present the package menu as a floating pop-up.
1138+ */
1139+ HMENU popup;
1140+ LVHITTESTINFO whence;
1141+
1142+ /* Before presenting the menu, ensure that its selection bindings
1143+ * are current, as determined for the selected package; note that
1144+ * we do this unconditionally, to ensure that the bindings remain
1145+ * current, when the user accesses the menu from the menu bar.
1146+ */
1147+ UpdatePackageMenuBindings();
1148+
1149+ /* Locate the cursor position, mapping it into the co-ordinate
1150+ * system of the list view client window.
1151+ */
1152+ whence.pt.y = GetMessagePos();
1153+ whence.pt.x = GET_X_LPARAM( whence.pt.y );
1154+ whence.pt.y = GET_Y_LPARAM( whence.pt.y );
1155+ ScreenToClient( PackageListView, &whence.pt );
1156+
1157+ /* Perform a hit-test, to confirm that either the left mouse
1158+ * button was clicked on the package status icon, or the right
1159+ * button was clicked anywhere on the package list entry; only
1160+ * if one of these is detected, do we then proceed to retrieve
1161+ * a handle for the pop-up menu itself...
1162+ */
1163+ if( (ListView_SubItemHitTest( PackageListView, &whence ) >= 0)
1164+ && ((whence.flags & mode) != 0) && ((popup = GetMenu( AppWindow )) != NULL)
1165+ && ((popup = GetSubMenu( popup, 1 )) != NULL) )
1166+ {
1167+ /* ...and provided it is valid, we remap the cursor position
1168+ * back into the screen co-ordinate system, and present the
1169+ * menu at the resultant position.
1170+ */
1171+ ClientToScreen( PackageListView, &whence.pt );
1172+ TrackPopupMenu( popup, 0, whence.pt.x, whence.pt.y, 0, AppWindow, NULL );
1173+ }
1174+}
1175+
11311176 long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
11321177 {
11331178 /* Handler for notifiable events to be processed in the context
@@ -1143,6 +1188,19 @@ long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
11431188 * package list view and data sheet tab control panes...
11441189 */
11451190 case ID_PACKAGE_LISTVIEW:
1191+ if( ((NMHDR *)(data))->code == NM_RCLICK )
1192+ {
1193+ /* A right button mouse click within the package list view
1194+ * selects the package under the cursor, and offers a pop-up
1195+ * menu of actions which may be performed on it.
1196+ */
1197+ SelectPackageAction( LVHT_ONITEMICON | LVHT_ONITEMLABEL );
1198+ break;
1199+ }
1200+ /* Any other notification from the list view control is handled
1201+ * in common with similar notifications from the tab control, so
1202+ * we do not break here, but simply fall through.
1203+ */
11461204 case ID_PACKAGE_TABCONTROL:
11471205 if( ((NMHDR *)(data))->code == NM_CLICK )
11481206 {
@@ -1151,14 +1209,12 @@ long AppWindowMaker::OnNotify( WPARAM client_id, LPARAM data )
11511209 */
11521210 DataSheet->DisplayData( PackageTabControl, PackageListView );
11531211
1212+ /* Additionally, for a left click on the package status
1213+ * icon within the list view, we present a pop-up menu
1214+ * offering a selection of available actions.
1215+ */
11541216 if( client_id == ID_PACKAGE_LISTVIEW )
1155- {
1156- /* A change of package selection, within the list view,
1157- * may also require an update of the available choices in
1158- * the "Package" drop-down menu.
1159- */
1160- UpdatePackageMenuBindings();
1161- }
1217+ SelectPackageAction( LVHT_ONITEMICON );
11621218 }
11631219 break;
11641220 }