// yet, defer setting the focus to idle time.
wxWindowGTK *g_delayedFocus = (wxWindowGTK*) NULL;
+// global variables because GTK+ DnD want to have the
+// mouse event that caused it
+GdkEvent *g_lastMouseEvent = (GdkEvent*) NULL;
+int g_lastButtonNumber = 0;
+
extern bool g_mainThreadLocked;
//-----------------------------------------------------------------------------
int x = dx;
int y = dy;
-
+
int dw = 0;
int dh = 0;
if (win->m_hasScrolling)
{
GetScrollbarWidth(widget, dw, dh);
-
+
if (win->GetLayoutDirection() == wxLayout_RightToLeft)
{
// This is actually wrong for old GTK+ version
GtkRequisition entry_req;
entry_req.width = 2;
entry_req.height = 2;
+ (* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->entry) )->size_request )
+ (gcombo->entry, &entry_req );
+
+ GtkRequisition button_req;
+ button_req.width = 2;
+ button_req.height = 2;
(* GTK_WIDGET_CLASS( GTK_OBJECT_GET_CLASS(gcombo->button) )->size_request )
- (gcombo->button, &entry_req );
+ (gcombo->button, &button_req );
- requisition->width = w - entry_req.width;
+ requisition->width = w - button_req.width;
requisition->height = entry_req.height;
}
}
wxPoint pt = win->GetClientAreaOrigin();
event.m_x = (wxCoord)gdk_event->x - pt.x;
event.m_y = (wxCoord)gdk_event->y - pt.y;
-
+
if ((win->m_wxwindow) && (win->GetLayoutDirection() == wxLayout_RightToLeft))
{
// origin in the upper right corner
{
wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
+ g_lastButtonNumber = gdk_event->button;
+
if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus())
{
gtk_widget_grab_focus( win->m_wxwindow );
return FALSE;
}
+ g_lastMouseEvent = (GdkEvent*) gdk_event;
+
wxMouseEvent event( event_type );
InitMouseEvent( win, event, gdk_event );
event.SetEventObject( win );
event.SetId( win->GetId() );
- if (win->GTKProcessEvent( event ))
- {
+ bool ret = win->GTKProcessEvent( event );
+ g_lastMouseEvent = NULL;
+ if ( ret )
return TRUE;
- }
if (event_type == wxEVT_RIGHT_DOWN)
{
{
wxCOMMON_CALLBACK_PROLOGUE(gdk_event, win);
+ g_lastButtonNumber = 0;
+
wxEventType event_type = wxEVT_NULL;
switch (gdk_event->button)
return FALSE;
}
+ g_lastMouseEvent = (GdkEvent*) gdk_event;
+
wxMouseEvent event( event_type );
InitMouseEvent( win, event, gdk_event );
event.SetEventObject( win );
event.SetId( win->GetId() );
- return win->GTKProcessEvent(event);
+ bool ret = win->GTKProcessEvent(event);
+
+ g_lastMouseEvent = NULL;
+
+ return ret;
}
//-----------------------------------------------------------------------------
gdk_event->y = y;
}
+ g_lastMouseEvent = (GdkEvent*) gdk_event;
+
wxMouseEvent event( wxEVT_MOTION );
InitMouseEvent(win, event, gdk_event);
}
}
- return win->GTKProcessEvent(event);
+ bool ret = win->GTKProcessEvent(event);
+
+ g_lastMouseEvent = NULL;
+
+ return ret;
}
//-----------------------------------------------------------------------------
alloc->width,
alloc->height );
#endif
-
+
win->m_oldClientWidth = client_width;
win->m_oldClientHeight = client_height;
GtkScrolledWindowClass *scroll_class = GTK_SCROLLED_WINDOW_CLASS( GTK_OBJECT_GET_CLASS(m_widget) );
scroll_class->scrollbar_spacing = 0;
- gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+ if (HasFlag(wxALWAYS_SHOW_SB))
+ {
+ gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_ALWAYS, GTK_POLICY_ALWAYS );
+
+ scrolledWindow->hscrollbar_visible = TRUE;
+ scrolledWindow->vscrollbar_visible = TRUE;
+ }
+ else
+ {
+ gtk_scrolled_window_set_policy( scrolledWindow, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
+ }
m_scrollBar[ScrollDir_Horz] = GTK_RANGE(scrolledWindow->hscrollbar);
m_scrollBar[ScrollDir_Vert] = GTK_RANGE(scrolledWindow->vscrollbar);
{
// inform the parent to perform the move
gtk_pizza_set_size( GTK_PIZZA(m_parent->m_wxwindow), m_widget, x, y, width, height );
-
+
}
void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
if (GetLayoutDirection() == wxLayout_RightToLeft)
*x = (GetClientSize().x - *x) + org_x;
- else
+ else
*x += org_x;
}
-
+
if (y) *y += org_y;
}
{
if (GetLayoutDirection() == wxLayout_RightToLeft)
*x = (GetClientSize().x - *x) - org_x;
- else
+ else
*x -= org_x;
}
if (y) *y -= org_y;
gtk_widget_grab_focus (m_widget);
return;
}
-
+
gtk_widget_child_focus( m_widget, GTK_DIR_TAB_FORWARD );
}
else
return;
GTKSetLayout(m_widget, dir);
-
+
if (m_wxwindow)
GTKSetLayout(m_wxwindow, dir);
}
{
p = NULL;
}
-
+
gdk_window_invalidate_rect( GTK_PIZZA(m_wxwindow)->bin_window, p, TRUE );
}
}
{
// Transform m_updateRegion under RTL
m_updateRegion.Clear();
-
+
gint width;
gdk_window_get_geometry( GTK_PIZZA(m_wxwindow)->bin_window,
NULL, NULL, &width, NULL, NULL );
-
+
wxRegionIterator upd( m_nativeUpdateRegion );
while (upd)
{
rect.y = upd.GetY();
rect.width = upd.GetWidth();
rect.height = upd.GetHeight();
-
+
rect.x = width - rect.x - rect.width;
m_updateRegion.Union( rect );
-
+
++upd;
}
}
-
+
// widget to draw on
GtkPizza *pizza = GTK_PIZZA (m_wxwindow);
void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
{
- wxString tmp( tip );
- gtk_tooltips_set_tip( tips, GetConnectWidget(), wxGTK_CONV(tmp), (gchar*) NULL );
+ if (tip)
+ {
+ wxString tmp( tip );
+ gtk_tooltips_set_tip( tips, GetConnectWidget(), wxGTK_CONV(tmp), (gchar*) NULL );
+ }
+ else
+ {
+ gtk_tooltips_set_tip( tips, GetConnectWidget(), NULL, NULL);
+ }
}
#endif // wxUSE_TOOLTIPS
if (pos < 0)
pos = 0;
m_scrollPos[dir] = adj->value = pos;
-
+
// If a "value_changed" signal emission is not already in progress
if (!m_blockValueChanged[dir])
{
const int barIndex = range == m_scrollBar[1];
GtkAdjustment* adj = range->adjustment;
-
+
const int value = int(adj->value + 0.5);
-
+
// save previous position
const double oldPos = m_scrollPos[barIndex];
// update current position
gtk_pizza_scroll( GTK_PIZZA(m_wxwindow), -dx, -dy );
m_clipPaintRegion = false;
+
+#if wxUSE_CARET
+ bool restoreCaret = (GetCaret() != NULL && GetCaret()->IsVisible());
+ if (restoreCaret)
+ {
+ wxRect caretRect(GetCaret()->GetPosition(), GetCaret()->GetSize());
+ if (dx > 0)
+ caretRect.width += dx;
+ else
+ {
+ caretRect.x += dx; caretRect.width -= dx;
+ }
+ if (dy > 0)
+ caretRect.height += dy;
+ else
+ {
+ caretRect.y += dy; caretRect.height -= dy;
+ }
+
+ RefreshRect(caretRect);
+ }
+#endif // wxUSE_CARET
}
void wxWindowGTK::GtkScrolledWindowSetBorder(GtkWidget* w, int wxstyle)