// data
//-----------------------------------------------------------------------------
-extern bool g_blockEventsOnDrag;
-extern bool g_blockEventsOnScroll;
+// Don't allow event propagation during drag
+bool g_blockEventsOnDrag;
+// Don't allow mouse event propagation during scroll
+bool g_blockEventsOnScroll;
extern wxCursor g_globalCursor;
// mouse capture state: the window which has it and if the mouse is currently
wxFillOtherKeyEventFields(event,
window, window->m_imData->lastKeyEvent);
}
+ else
+ {
+ event.SetEventObject( window );
+ }
- const wxWxCharBuffer data(wxGTK_CONV_BACK_SYS(str));
- if( !data )
+ const wxString data(wxGTK_CONV_BACK_SYS(str));
+ if( data.empty() )
return;
bool ret = false;
while (parent && !parent->IsTopLevel())
parent = parent->GetParent();
- for( const wxChar* pstr = data; *pstr; pstr++ )
+ for( wxString::const_iterator pstr = data.begin(); pstr != data.end(); ++pstr )
{
#if wxUSE_UNICODE
event.m_uniChar = *pstr;
event.m_keyCode = *pstr < 256 ? event.m_uniChar : 0;
wxLogTrace(TRACE_KEYS, _T("IM sent character '%c'"), event.m_uniChar);
#else
- event.m_keyCode = *pstr;
+ event.m_keyCode = (char)*pstr;
#endif // wxUSE_UNICODE
// To conform to the docs we need to translate Ctrl-alpha
if ( ret )
return TRUE;
+ if ((event_type == wxEVT_LEFT_DOWN) && !win->IsOfStandardClass() &&
+ (g_focusWindow != win) && win->CanAcceptFocus())
+ {
+ gtk_widget_grab_focus( win->m_wxwindow );
+ }
+
if (event_type == wxEVT_RIGHT_DOWN)
{
// generate a "context menu" event: this is similar to right mouse
// "realize" from m_widget
//-----------------------------------------------------------------------------
-/* We cannot set colours and fonts before the widget has
- been realized, so we do this directly after realization. */
-
static void
gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win )
{
pizza->bin_window );
}
+ // We cannot set colours and fonts before the widget
+ // been realized, so we do this directly after realization
+ // or otherwise in idle time
+
+ if (win->m_needsStyleChange)
+ {
+ win->SetBackgroundStyle(win->GetBackgroundStyle());
+ win->m_needsStyleChange = false;
+ }
+
wxWindowCreateEvent event( win );
event.SetEventObject( win );
win->GTKProcessEvent( event );
m_width = 0;
m_height = 0;
- m_sizeSet = false;
m_hasVMT = false;
m_isBeingDeleted = false;
m_resizing = false;
- m_insertCallback = (wxInsertChildFunction) NULL;
+ m_insertCallback = wxInsertChildInWindow;
m_hasFocus = false;
return false;
}
- m_insertCallback = wxInsertChildInWindow;
-
-
if (!HasFlag(wxHSCROLL) && !HasFlag(wxVSCROLL))
{
m_wxwindow = gtk_pizza_new_no_scroll();
}
+void wxWindowGTK::ConstrainSize()
+{
+#ifdef __WXGPE__
+ // GPE's window manager doesn't like size hints at all, esp. when the user
+ // has to use the virtual keyboard, so don't constrain size there
+ if (!IsTopLevel())
+#endif
+ {
+ const wxSize minSize = GetMinSize();
+ const wxSize maxSize = GetMaxSize();
+ if (minSize.x > 0 && m_width < minSize.x) m_width = minSize.x;
+ if (minSize.y > 0 && m_height < minSize.y) m_height = minSize.y;
+ if (maxSize.x > 0 && m_width > maxSize.x) m_width = maxSize.x;
+ if (maxSize.y > 0 && m_height > maxSize.y) m_height = maxSize.y;
+ }
+}
+
void wxWindowGTK::DoSetSize( int x, int y, int width, int height, int sizeFlags )
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
if (height != -1)
m_height = height;
- int minWidth = GetMinWidth(),
- minHeight = GetMinHeight(),
- maxWidth = GetMaxWidth(),
- maxHeight = GetMaxHeight();
-
- if ((minWidth != -1) && (m_width < minWidth )) m_width = minWidth;
- if ((minHeight != -1) && (m_height < minHeight)) m_height = minHeight;
- if ((maxWidth != -1) && (m_width > maxWidth )) m_width = maxWidth;
- if ((maxHeight != -1) && (m_height > maxHeight)) m_height = maxHeight;
+ ConstrainSize();
#if wxUSE_TOOLBAR_NATIVE
if (wxDynamicCast(GetParent(), wxToolBar))
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid window") );
- if (m_wxwindow)
- {
- int dw = 0;
- int dh = 0;
-
- if (m_hasScrolling)
- {
- GetScrollbarWidth(m_widget, dw, dh);
- }
-
- const int border = GTK_CONTAINER(m_wxwindow)->border_width;
- dw += 2 * border;
- dh += 2 * border;
-
- width += dw;
- height += dh;
- }
-
- SetSize(width, height);
+ const wxSize size = GetSize();
+ const wxSize clientSize = GetClientSize();
+ SetSize(width + (size.x - clientSize.x), height + (size.y - clientSize.y));
}
void wxWindowGTK::DoGetClientSize( int *width, int *height ) const
void wxWindowGTK::DoAddChild(wxWindowGTK *child)
{
wxASSERT_MSG( (m_widget != NULL), wxT("invalid window") );
-
wxASSERT_MSG( (child != NULL), wxT("invalid child window") );
- wxASSERT_MSG( (m_insertCallback != NULL), wxT("invalid child insertion function") );
-
/* add to list */
AddChild( child );
m_tooltip->Apply( (wxWindow *)this );
}
-void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const wxChar *tip )
+void wxWindowGTK::ApplyToolTip( GtkTooltips *tips, const gchar *tip )
{
- 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);
- }
+ gtk_tooltips_set_tip(tips, GetConnectWidget(), tip, NULL);
}
#endif // wxUSE_TOOLTIPS