fix popup menus (broken by recent change to non-popup interaction)
svn: r11432
This commit is contained in:
parent
553e068ccf
commit
33d2d5de32
|
@ -181,6 +181,7 @@ Bool wxMenu::PopupMenu(Widget in_w, int root_x, int root_y, Bool forChoice, int
|
|||
XtNbackground, wxGREY_PIXEL,
|
||||
XtNhighlightPixel, wxCTL_HIGHLIGHT_PIXEL,
|
||||
XtNforChoice, forChoice,
|
||||
XtNforPopup, TRUE,
|
||||
XtNrequestedWidth, requested_width,
|
||||
XtNextraTop, top_extra,
|
||||
NULL);
|
||||
|
|
|
@ -130,7 +130,8 @@ static XtResource MenuResources[] =
|
|||
offset(menu.horizontal), XtRImmediate, (XtPointer) True},
|
||||
{XtNforChoice, XtCForChoice, XtRBoolean, sizeof(Boolean),
|
||||
offset(menu.forChoice), XtRImmediate, (XtPointer) False},
|
||||
|
||||
{XtNforPopup, XtCForPopup, XtRBoolean, sizeof(Boolean),
|
||||
offset(menu.forPopup), XtRImmediate, (XtPointer) False},
|
||||
|
||||
/* menu structure */
|
||||
{XtNmenu, XtCMenu, XtRPointer, sizeof(XtPointer),
|
||||
|
@ -490,7 +491,9 @@ static void Start(w, ev, params, num_params)
|
|||
mw->menu.grabbed = TRUE;
|
||||
}
|
||||
|
||||
if (!HandleMotionEvent(mw, &ev->xmotion, 1))
|
||||
if (!HandleMotionEvent(mw, &ev->xmotion, 1)
|
||||
/* num_params is position when called to start a popup menu */
|
||||
&& !num_params)
|
||||
DoSelect(w, CurrentTime, 1);
|
||||
}
|
||||
|
||||
|
@ -576,7 +579,8 @@ static void Select(w, event, params, num_params)
|
|||
|
||||
mw->menu.moused_out = 0;
|
||||
|
||||
if (!mw->menu.state || !mw->menu.state->selected)
|
||||
if (!mw->menu.forPopup
|
||||
&& (!mw->menu.state || !mw->menu.state->selected))
|
||||
return;
|
||||
|
||||
force = !HandleMotionEvent(mw, ev, 0);
|
||||
|
@ -1552,7 +1556,8 @@ static int HandleMotionEvent(MenuWidget mw, XMotionEvent *ev, int is_click)
|
|||
if (!foundone)
|
||||
mw->menu.moused_out = !in_extra_region;
|
||||
|
||||
if (is_click && ms && (item == ms->selected)) { /* pointer on the same item and a click */
|
||||
if (!mw->menu.forPopup
|
||||
&& (is_click && ms && (item == ms->selected))) { /* pointer on the same item and a click */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,7 @@ SOFTWARE.
|
|||
hMargin HMargin Dimension 1
|
||||
horizontal Horizontal Boolean True
|
||||
forChoice ForChoice Boolean False
|
||||
forPopup ForPopup Boolean False
|
||||
menu Menu Pointer NULL
|
||||
onNewItem Callback XtCallbackList NULL
|
||||
onSelect Callback XtCallbackList NULL
|
||||
|
@ -75,6 +76,8 @@ SOFTWARE.
|
|||
#define XtCHorizontal "Horizontal"
|
||||
#define XtNforChoice "forChoice"
|
||||
#define XtCForChoice "ForChoice"
|
||||
#define XtNforPopup "forPopup"
|
||||
#define XtCForPopup "ForPopup"
|
||||
#define XtNmenu "menu"
|
||||
#define XtCMenu "Menu"
|
||||
#define XtNrefresh "refresh"
|
||||
|
|
|
@ -65,6 +65,7 @@ typedef struct _MenuPart {
|
|||
#endif
|
||||
Boolean horizontal;
|
||||
Boolean forChoice; /* Means extra left and right space */
|
||||
Boolean forPopup;
|
||||
Dimension hmargin; /* margins around menu items */
|
||||
Dimension indicator_size; /* data for toggle, radio and cascade */
|
||||
Dimension extra_left, extra_top, extra_right, extra_bottom;
|
||||
|
|
Loading…
Reference in New Issue
Block a user