X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/a9796db88f321a72abd9720c5dd8d371cea2f40b..6e1609b1e0784f299933742e02c58462df809acc:/src/gtk1/window.cpp diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 12b9216ad7..6836677cc8 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -371,7 +371,7 @@ static void draw_frame( GtkWidget *widget, wxWindowGTK *win ) return; } - if (win->HasFlag(wxSUNKEN_BORDER)) + if (win->HasFlag(wxSUNKEN_BORDER) || win->HasFlag(wxBORDER_THEME)) { gtk_draw_shadow( widget->style, widget->window, @@ -428,7 +428,7 @@ static void gtk_window_own_draw_callback( GtkWidget *widget, GdkRectangle *WXUNU // make it extern because wxStaticText needs to disconnect this one extern "C" { -void wxgtk_window_size_request_callback(GtkWidget *widget, +void wxgtk_window_size_request_callback(GtkWidget *WXUNUSED(widget), GtkRequisition *requisition, wxWindow *win) { @@ -446,7 +446,7 @@ void wxgtk_window_size_request_callback(GtkWidget *widget, extern "C" { static -void wxgtk_combo_size_request_callback(GtkWidget *widget, +void wxgtk_combo_size_request_callback(GtkWidget *WXUNUSED(widget), GtkRequisition *requisition, wxComboBox *win) { @@ -478,7 +478,7 @@ void wxgtk_combo_size_request_callback(GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static int gtk_window_expose_callback( GtkWidget *widget, +static int gtk_window_expose_callback( GtkWidget *WXUNUSED(widget), GdkEventExpose *gdk_event, wxWindow *win ) { @@ -927,7 +927,10 @@ static void wxFillOtherKeyEventFields(wxKeyEvent& event, event.m_rawCode = (wxUint32) gdk_event->keyval; event.m_rawFlags = 0; #if wxUSE_UNICODE - event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval); +#if 0 + // this is not gtk1.x + event.m_uniChar = gdk_keyval_to_unicode(gdk_event->keyval); +#endif #endif wxGetMousePosition( &x, &y ); win->ScreenToClient( &x, &y ); @@ -1060,7 +1063,7 @@ static gint gtk_window_key_press_callback( GtkWidget *widget, bool ret = false; bool return_after_IM = false; - if( wxTranslateGTKKeyEventToWx(event, win, gdk_event) == false ) + if ( wxTranslateGTKKeyEventToWx(event, win, gdk_event) ) { // Emit KEY_DOWN event ret = win->GetEventHandler()->ProcessEvent( event ); @@ -1475,7 +1478,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, g_lastButtonNumber = gdk_event->button; - if (win->m_wxwindow && (g_focusWindow != win) && win->AcceptsFocus()) + if (win->m_wxwindow && (g_focusWindow != win) && win->IsFocusable()) { gtk_widget_grab_focus( win->m_wxwindow ); /* @@ -1583,7 +1586,7 @@ static gint gtk_window_button_press_callback( GtkWidget *widget, } g_lastMouseEvent = (GdkEvent*) gdk_event; - + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1686,7 +1689,7 @@ static gint gtk_window_button_release_callback( GtkWidget *widget, } g_lastMouseEvent = (GdkEvent*) gdk_event; - + wxMouseEvent event( event_type ); InitMouseEvent( win, event, gdk_event ); @@ -1859,7 +1862,9 @@ static gint gtk_window_focus_in_callback( GtkWidget *widget, //----------------------------------------------------------------------------- extern "C" { -static gint gtk_window_focus_out_callback( GtkWidget *widget, GdkEventFocus *gdk_event, wxWindowGTK *win ) +static gint gtk_window_focus_out_callback( GtkWidget *WXUNUSED(widget), + GdkEventFocus *WXUNUSED(gdk_event), + wxWindowGTK *win ) { DEBUG_MAIN_THREAD @@ -2165,7 +2170,7 @@ wxWindow *wxWindowBase::DoFindFocus() extern "C" { static gint -gtk_window_realized_callback( GtkWidget *m_widget, wxWindow *win ) +gtk_window_realized_callback( GtkWidget *WXUNUSED(widget), wxWindow *win ) { DEBUG_MAIN_THREAD @@ -2225,7 +2230,7 @@ void gtk_window_size_callback( GtkWidget *WXUNUSED(widget), extern "C" { static void gtk_wxwindow_size_callback( GtkWidget* WXUNUSED_UNLESS_XIM(widget), - GtkAllocation* WXUNUSED_UNLESS_XIM(alloc), + GtkAllocation* WXUNUSED(alloc), wxWindowGTK* WXUNUSED_UNLESS_XIM(win) ) { if (g_isIdle) @@ -2490,6 +2495,11 @@ bool wxWindowGTK::Create( wxWindow *parent, long style, const wxString &name ) { + // Get default border + wxBorder border = GetBorder(style); + style &= ~wxBORDER_MASK; + style |= border; + if (!PreCreation( parent, pos, size ) || !CreateBase( parent, id, pos, size, style, wxDefaultValidator, name )) { @@ -2521,7 +2531,7 @@ bool wxWindowGTK::Create( wxWindow *parent, { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_OUT ); } - else if (HasFlag(wxSUNKEN_BORDER)) + else if (HasFlag(wxSUNKEN_BORDER) || HasFlag(wxBORDER_THEME)) { gtk_pizza_set_shadow_type( pizza, GTK_MYSHADOW_IN ); } @@ -2958,7 +2968,7 @@ void wxWindowGTK::OnInternalIdle() } } - if (wxUpdateUIEvent::CanUpdate(this)) + if (wxUpdateUIEvent::CanUpdate(this) && IsShown()) UpdateWindowUI(wxUPDATE_UI_FROMIDLE); } @@ -2984,7 +2994,7 @@ void wxWindowGTK::DoSetClientSize( int width, int height ) int dh = 0; #ifndef __WXUNIVERSAL__ - if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER)) + if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER) || HasFlag(wxBORDER_THEME)) { /* when using GTK 1.2 we set the shadow border size to 2 */ dw += 2 * 2; @@ -3048,7 +3058,7 @@ void wxWindowGTK::DoGetClientSize( int *width, int *height ) const int dh = 0; #ifndef __WXUNIVERSAL__ - if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER)) + if (HasFlag(wxRAISED_BORDER) || HasFlag(wxSUNKEN_BORDER) || HasFlag(wxBORDER_THEME)) { /* when using GTK 1.2 we set the shadow border size to 2 */ dw += 2 * 2; @@ -3203,40 +3213,13 @@ bool wxWindowGTK::Show( bool show ) return true; } -static void wxWindowNotifyEnable(wxWindowGTK* win, bool enable) +void wxWindowGTK::DoEnable( bool enable ) { - win->OnParentEnable(enable); - - // Recurse, so that children have the opportunity to Do The Right Thing - // and reset colours that have been messed up by a parent's (really ancestor's) - // Enable call - for ( wxWindowList::compatibility_iterator node = win->GetChildren().GetFirst(); - node; - node = node->GetNext() ) - { - wxWindow *child = node->GetData(); - if (!child->IsKindOf(CLASSINFO(wxDialog)) && !child->IsKindOf(CLASSINFO(wxFrame))) - wxWindowNotifyEnable(child, enable); - } -} - -bool wxWindowGTK::Enable( bool enable ) -{ - wxCHECK_MSG( (m_widget != NULL), false, wxT("invalid window") ); - - if (!wxWindowBase::Enable(enable)) - { - // nothing to do - return false; - } + wxCHECK_RET( (m_widget != NULL), wxT("invalid window") ); gtk_widget_set_sensitive( m_widget, enable ); if ( m_wxwindow ) gtk_widget_set_sensitive( m_wxwindow, enable ); - - wxWindowNotifyEnable(this, enable); - - return true; } int wxWindowGTK::GetCharHeight() const @@ -4246,3 +4229,11 @@ void wxWinModule::OnExit() if (g_eraseGC) gdk_gc_unref( g_eraseGC ); } + +GdkWindow* wxWindowGTK::GTKGetDrawingWindow() const +{ + GdkWindow* window = NULL; + if (m_wxwindow) + window = GTK_PIZZA(m_wxwindow)->bin_window; + return window; +}