X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d4c99d6fa89db127a4708ce674595d02eeccf2fc..d93f63db9d836a7d303343e60fb034dc9a1360d0:/src/gtk1/window.cpp diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 8f8ccf9446..d65fec1d09 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -27,7 +27,7 @@ #include "wx/mdi.h" #include "wx/notebook.h" #include "wx/statusbr.h" -#include "wx/treectrl.h" +//#include "wx/treectrl.h" #include "gdk/gdkkeysyms.h" #include #include "wx/gtk/win_gtk.h" @@ -256,7 +256,12 @@ gint gtk_window_key_press_callback( GtkWidget *WXUNUSED(widget), GdkEventKey *gd event.m_x = 0; event.m_y = 0; event.SetEventObject( win ); - return win->ProcessEvent( event ); + + bool ret = win->ProcessEvent( event ); +/* + if (ret) printf( "found.\n") ; +*/ + return ret; }; //----------------------------------------------------------------------------- @@ -627,6 +632,8 @@ void gtk_window_hscroll_change_callback( GtkWidget *WXUNUSED(widget), wxWindow * void gtk_window_drop_callback( GtkWidget *widget, GdkEvent *event, wxWindow *win ) { + if (!win->HasVMT()) return; + if (win->GetDropTarget()) { int x = 0; @@ -662,8 +669,8 @@ bool gtk_window_destroy_callback( GtkWidget *WXUNUSED(widget), GdkEvent *WXUNUSE bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { if (widget->window != gdk_event->window) return TRUE; - - if (g_blockEventsOnDrag) return FALSE; + if (g_blockEventsOnDrag) return TRUE; + if (!win->HasVMT()) return TRUE; if (widget->window) gdk_window_set_cursor( widget->window, win->m_cursor->GetCursor() ); @@ -679,8 +686,8 @@ bool gtk_window_enter_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, bool gtk_window_leave_callback( GtkWidget *widget, GdkEventCrossing *gdk_event, wxWindow *win ) { if (widget->window != gdk_event->window) return TRUE; - - if (g_blockEventsOnDrag) return FALSE; + if (!win->HasVMT()) return TRUE; + if (g_blockEventsOnDrag) return TRUE; if (widget->window) gdk_window_set_cursor( widget->window, wxSTANDARD_CURSOR->GetCursor() ); @@ -746,6 +753,7 @@ wxWindow::wxWindow( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, long style, const wxString &name ) { + m_cursor = NULL; Create( parent, id, pos, size, style, name ); }; @@ -804,6 +812,8 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, m_wxwindow = gtk_myfixed_new(); + if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); + if (m_windowStyle & wxTAB_TRAVERSAL == wxTAB_TRAVERSAL) GTK_WIDGET_UNSET_FLAGS( m_wxwindow, GTK_CAN_FOCUS ); else @@ -855,7 +865,7 @@ wxWindow::~wxWindow(void) if (m_widget) gtk_widget_destroy( m_widget ); -// delete m_cursor; + wxDELETE(m_cursor); DeleteRelatedConstraints(); if (m_constraints) @@ -909,7 +919,8 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, m_windowValidator = NULL; m_windowId = id; m_sizeSet = FALSE; - m_cursor = new wxCursor( wxCURSOR_ARROW ); + if (m_cursor == NULL) + m_cursor = new wxCursor( wxCURSOR_ARROW ); m_font = *wxSWISS_FONT; m_backgroundColour = wxWHITE; m_foregroundColour = wxBLACK; @@ -1059,17 +1070,16 @@ void wxWindow::ImplementSetSize(void) void wxWindow::ImplementSetPosition(void) { - if (!m_parent) + if (IS_KIND_OF(this,wxFrame) || IS_KIND_OF(this,wxDialog)) { - if (IsKindOf(CLASSINFO(wxFrame)) || - IsKindOf(CLASSINFO(wxDialog))) - { + if ((m_x != -1) || (m_y != -1)) gtk_widget_set_uposition( m_widget, m_x, m_y ); - } - else - { - printf( "wxWindow::SetSize error.\n" ); - } + return; + } + + if (!m_parent) + { + printf( "wxWindow::SetSize error.\n" ); return; } @@ -1324,7 +1334,7 @@ void wxWindow::ScreenToClient( int *x, int *y ) void wxWindow::Centre( int direction ) { - if (this->IsKindOf(CLASSINFO(wxDialog)) || this->IsKindOf(CLASSINFO(wxFrame))) + if (IS_KIND_OF(this,wxDialog) || IS_KIND_OF(this,wxFrame)) { if (direction & wxHORIZONTAL == wxHORIZONTAL) m_x = (gdk_screen_width () - m_width) / 2; if (direction & wxVERTICAL == wxVERTICAL) m_y = (gdk_screen_height () - m_height) / 2; @@ -1362,7 +1372,7 @@ void wxWindow::Fit(void) node = node->Next(); } - SetClientSize(maxX + 5, maxY + 5); + SetClientSize(maxX + 5, maxY + 10); }; void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) ) @@ -1473,7 +1483,7 @@ void wxWindow::AddChild( wxWindow *child ) // wxFrame has a private AddChild - if (IS_KIND_OF(this,wxFrame)) + if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame)) { wxFrame *frame = (wxFrame*)this; frame->AddChild( child ); @@ -1553,7 +1563,11 @@ wxWindowID wxWindow::GetId(void) void wxWindow::SetCursor( const wxCursor &cursor ) { - if (*m_cursor == cursor) return; + wxASSERT(m_cursor != NULL); + + if (m_cursor != NULL) + if (*m_cursor == cursor) + return; (*m_cursor) = cursor; if (m_widget->window) gdk_window_set_cursor( m_widget->window, m_cursor->GetCursor() ); @@ -1604,12 +1618,6 @@ void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) gdk_rect.width = rect->width; gdk_rect.height = rect->height; - if (IS_KIND_OF(this,wxTreeCtrl)) - { - printf( "x: %d y: %d w: %d h: %d .\n", - gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height ); - } - if (m_wxwindow) gtk_widget_draw( m_wxwindow, &gdk_rect ); else