[GB.GTK]
* BUG: MouseMove event should be correctly raised in all case now. git-svn-id: svn://localhost/gambas/trunk@3248 867c0c6c-44f3-4631-809d-bfa615b0a4ec
This commit is contained in:
parent
cdb3872751
commit
dd544117b9
4 changed files with 40 additions and 10 deletions
|
@ -136,6 +136,26 @@ void gb_plug_raise_error(gControl *sender)
|
|||
// GB.Unref(POINTER(&_object));
|
||||
// }
|
||||
|
||||
static bool gb_can_raise(gControl *sender, int type)
|
||||
{
|
||||
CWIDGET *ob = GetObject(sender);
|
||||
if (!ob) return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case gEvent_MousePress: type = EVENT_MouseDown; break;
|
||||
case gEvent_MouseRelease: type = EVENT_MouseUp; break;
|
||||
case gEvent_MouseMove: type = EVENT_MouseMove; break;
|
||||
case gEvent_MouseDrag: type = EVENT_MouseDrag; break;
|
||||
case gEvent_MouseWheel: type =EVENT_MouseWheel; break;
|
||||
case gEvent_MouseMenu: type = EVENT_Menu; break;
|
||||
case gEvent_MouseDblClick: type = EVENT_DblClick; break;
|
||||
default: return true;
|
||||
}
|
||||
|
||||
return GB.CanRaise(ob, type);
|
||||
}
|
||||
|
||||
bool gb_raise_MouseEvent(gControl *sender, int type)
|
||||
{
|
||||
CWIDGET *ob = GetObject(sender);
|
||||
|
@ -332,14 +352,15 @@ void InitControl(gControl *control, CWIDGET *widget)
|
|||
|
||||
control->setName(name);
|
||||
|
||||
control->onFinish=DeleteControl;
|
||||
control->onMouseEvent=gb_raise_MouseEvent;
|
||||
control->onKeyEvent=gb_raise_KeyEvent;
|
||||
control->onFocusEvent=gb_raise_FocusEvent;
|
||||
control->onDrag=gb_raise_Drag;
|
||||
control->onDragMove=gb_raise_DragMove;
|
||||
control->onDrop=gb_raise_Drop;
|
||||
control->onEnterLeave=gb_raise_EnterLeave;
|
||||
control->onFinish = DeleteControl;
|
||||
control->onMouseEvent = gb_raise_MouseEvent;
|
||||
control->onKeyEvent = gb_raise_KeyEvent;
|
||||
control->onFocusEvent = gb_raise_FocusEvent;
|
||||
control->onDrag = gb_raise_Drag;
|
||||
control->onDragMove = gb_raise_DragMove;
|
||||
control->onDrop = gb_raise_Drop;
|
||||
control->onEnterLeave = gb_raise_EnterLeave;
|
||||
control->canRaise = gb_can_raise;
|
||||
|
||||
if (control->isContainer())
|
||||
{
|
||||
|
|
|
@ -314,7 +314,11 @@ static void gambas_handle_event(GdkEvent *event)
|
|||
if (grab)
|
||||
{
|
||||
if (widget != grab && !gtk_widget_is_ancestor(widget, grab))
|
||||
{
|
||||
widget = grab;
|
||||
if (event->type == GDK_MOTION_NOTIFY)
|
||||
fprintf(stderr, "GDK_MOTION_NOTIFY: -> %p\n", widget);
|
||||
}
|
||||
}
|
||||
|
||||
real = true;
|
||||
|
@ -416,6 +420,7 @@ static void gambas_handle_event(GdkEvent *event)
|
|||
if (win->isPopup() && (x < 0 || y < 0 || x >= win->width() || y >= win->height()))
|
||||
win->close();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case GDK_2BUTTON_PRESS:
|
||||
|
|
|
@ -1269,13 +1269,13 @@ void gControl::realize(bool make_frame)
|
|||
// g_signal_connect(G_OBJECT(widget), "size-allocate", G_CALLBACK(cb_size_allocate), (gpointer)this);
|
||||
|
||||
gtk_widget_add_events(widget, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK
|
||||
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
|
||||
|
||||
if (widget != border && GTK_IS_EVENT_BOX(border) && !gtk_event_box_get_visible_window(GTK_EVENT_BOX(border)))
|
||||
{
|
||||
gtk_widget_add_events(border, GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK
|
||||
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
|
||||
| GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK
|
||||
| GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK);
|
||||
}
|
||||
|
||||
|
@ -1671,6 +1671,8 @@ int gControl::minimumHeight()
|
|||
|
||||
void gControl::setTracking(bool v)
|
||||
{
|
||||
_tracking = v;
|
||||
/*
|
||||
GtkWidget *wid;
|
||||
|
||||
if (GTK_IS_EVENT_BOX(border))
|
||||
|
@ -1699,6 +1701,7 @@ void gControl::setTracking(bool v)
|
|||
gtk_widget_realize(wid);
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
bool gControl::grab(bool showIt)
|
||||
|
|
|
@ -151,6 +151,7 @@ public:
|
|||
void emit(void *signal, char *arg) { emit(signal, (intptr_t)arg); }
|
||||
|
||||
// "Signals"
|
||||
bool (*canRaise)(gControl *sender, int type);
|
||||
void (*onFinish)(gControl *sender); // Special
|
||||
void (*onFocusEvent)(gControl *sender, int type);
|
||||
bool (*onKeyEvent)(gControl *sender, int type);
|
||||
|
|
Loading…
Reference in a new issue