From: Robert Roebling Date: Sat, 24 Oct 1998 20:25:36 +0000 (+0000) Subject: Added support for frames without borders (such as for X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/32e9da8bfaafe4f462f7473a7e11e3387847e121 Added support for frames without borders (such as for splash screen) with wxSIMPLE_BORDER Fixed tooltip bug -> recompile everything Added validators to wxListCtrl Fixed Create/Realize bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 4fd5c12df3..63c6808102 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -531,13 +531,18 @@ class wxListCtrl: public wxControl public: wxListCtrl(void); - wxListCtrl( wxWindow *parent, wxWindowID id, + wxListCtrl( wxWindow *parent, wxWindowID id = -1, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = 0, const wxString &name = "listctrl" ); + long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, + const wxString &name = "listctrl" ) + { + Create(parent, id, pos, size, style, validator, name); + } ~wxListCtrl(void); - bool Create( wxWindow *parent, wxWindowID id, + bool Create( wxWindow *parent, wxWindowID id = -1, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, - long style = 0, const wxString &name = "listctrl" ); + long style = wxLC_ICON, const wxValidator& validator = wxDefaultValidator, + const wxString &name = "listctrl" ); void OnSize( wxSizeEvent &event ); bool GetColumn( int col, wxListItem& item ); bool SetColumn( int col, wxListItem& item ); diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 50556991dc..a70b32ae2a 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -280,6 +280,7 @@ public: bool m_hasVMT; bool m_sizeSet; bool m_resizing; + GdkGC *m_scrollGC; public: diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 50556991dc..a70b32ae2a 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -280,6 +280,7 @@ public: bool m_hasVMT; bool m_sizeSet; bool m_resizing; + GdkGC *m_scrollGC; public: diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 957a697493..ed022c17ce 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2111,21 +2111,14 @@ wxListCtrl::wxListCtrl(void) m_imageListState = (wxImageList *) NULL; } -wxListCtrl::wxListCtrl( wxWindow *parent, wxWindowID id, - const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) - -{ - Create( parent, id, pos, size, style, name ); -} - wxListCtrl::~wxListCtrl(void) { } bool wxListCtrl::Create( wxWindow *parent, wxWindowID id, const wxPoint &pos, const wxSize &size, - long style, const wxString &name ) + long style, const wxValidator &validator, + const wxString &name ) { m_imageListNormal = (wxImageList *) NULL; m_imageListSmall = (wxImageList *) NULL; @@ -2140,6 +2133,8 @@ bool wxListCtrl::Create( wxWindow *parent, wxWindowID id, bool ret = wxControl::Create( parent, id, pos, size, s, name ); + SetValidator( validator ); + m_mainWin = new wxListMainWindow( this, -1, wxPoint(0,0), size, s ); if (GetWindowStyleFlag() & wxLC_REPORT) diff --git a/src/gtk/accel.cpp b/src/gtk/accel.cpp index 52949c26ea..e101decc7d 100644 --- a/src/gtk/accel.cpp +++ b/src/gtk/accel.cpp @@ -2,7 +2,7 @@ // Name: accel.cpp // Purpose: // Author: Robert Roebling -// Id: +// Id: $id$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index d65cff17cf..f51c92ff70 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -2,7 +2,7 @@ // Name: app.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gtk/frame.cpp b/src/gtk/frame.cpp index fbb256de87..2f1d747558 100644 --- a/src/gtk/frame.cpp +++ b/src/gtk/frame.cpp @@ -135,7 +135,10 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_title = title; - m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; + if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; + + m_widget = gtk_window_new( win_type ); if ((size.x != -1) && (size.y != -1)) gtk_widget_set_usize( m_widget, m_width, m_height ); if ((pos.x != -1) && (pos.y != -1)) diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index 7bf133ec47..4852879086 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -31,13 +31,9 @@ wxMenuBar::wxMenuBar() m_menus.DeleteContents( TRUE ); - m_widget = gtk_handle_box_new(); - m_menubar = gtk_menu_bar_new(); - - gtk_container_add( GTK_CONTAINER(m_widget), m_menubar ); - - gtk_widget_show( m_menubar ); + + m_widget = GTK_WIDGET(m_menubar); PostCreation(); diff --git a/src/gtk/tbargtk.cpp b/src/gtk/tbargtk.cpp index 491eea3cd2..5af767a335 100644 --- a/src/gtk/tbargtk.cpp +++ b/src/gtk/tbargtk.cpp @@ -2,9 +2,7 @@ // Name: tbargtk.cpp // Purpose: GTK toolbar // Author: Robert Roebling -// Modified by: -// Created: 01/02/97 -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -113,15 +111,12 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_tools.DeleteContents( TRUE ); - m_widget = gtk_handle_box_new(); - m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) ); - gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); - gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) ); - - gtk_widget_show( GTK_WIDGET(m_toolbar) ); + m_widget = GTK_WIDGET(m_toolbar); + + gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); PostCreation(); @@ -209,12 +204,6 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, (gpointer)tool ); - // VZ: we don't want GDK_NO_EXPOSE events because for some reason our - // toolbar buttons get them (it doesn't happen in a standalone GTK+ program - // for unknown reasons) and it prevents tooltips from appearing. - gtk_widget_set_events( GTK_WIDGET(item), - gtk_widget_get_events( GTK_WIDGET(item) ) & - ~GDK_EXPOSURE_MASK); tool->m_item = item; gtk_signal_connect( GTK_OBJECT(tool->m_item), diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index eb9b9dcb84..f220749ead 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -913,6 +913,7 @@ wxWindow::wxWindow() m_pDropTarget = (wxDropTarget *) NULL; m_resizing = FALSE; m_hasOwnStyle = FALSE; + m_scrollGC = (GdkGC*) NULL; } bool wxWindow::Create( wxWindow *parent, wxWindowID id, @@ -982,7 +983,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, m_wxwindow = gtk_myfixed_new(); - if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); + 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 ); @@ -1014,7 +1015,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, gtk_widget_show( m_wxwindow ); PostCreation(); - + Show( TRUE ); return TRUE; @@ -1031,6 +1032,8 @@ wxWindow::~wxWindow() DestroyChildren(); + if (m_scrollGC) gdk_gc_unref( m_scrollGC ); + if (m_wxwindow) gtk_widget_destroy( m_wxwindow ); if (m_widget) gtk_widget_destroy( m_widget ); @@ -1129,11 +1132,7 @@ void wxWindow::PostCreation() if (m_widget && m_parent) gtk_widget_realize( m_widget ); - if (m_wxwindow) - { - gtk_widget_realize( m_wxwindow ); - gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE ); - } + if (m_wxwindow) gtk_widget_realize( m_wxwindow ); SetCursor( *wxSTANDARD_CURSOR ); @@ -2430,7 +2429,14 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) int d_y = 0; if (dx > 0) d_x = dx; if (dy > 0) d_y = dy; - gdk_window_copy_area( m_wxwindow->window, m_wxwindow->style->fg_gc[0], d_x, d_y, + + if (!m_scrollGC) + { + m_scrollGC = gdk_gc_new( m_wxwindow->window ); + gdk_gc_set_exposures( m_scrollGC, TRUE ); + } + + gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y, m_wxwindow->window, s_x, s_y, w, h ); wxRect rect; diff --git a/src/gtk1/accel.cpp b/src/gtk1/accel.cpp index 52949c26ea..e101decc7d 100644 --- a/src/gtk1/accel.cpp +++ b/src/gtk1/accel.cpp @@ -2,7 +2,7 @@ // Name: accel.cpp // Purpose: // Author: Robert Roebling -// Id: +// Id: $id$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index d65cff17cf..f51c92ff70 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -2,7 +2,7 @@ // Name: app.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling, Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// diff --git a/src/gtk1/frame.cpp b/src/gtk1/frame.cpp index fbb256de87..2f1d747558 100644 --- a/src/gtk1/frame.cpp +++ b/src/gtk1/frame.cpp @@ -135,7 +135,10 @@ bool wxFrame::Create( wxWindow *parent, wxWindowID id, const wxString &title, m_title = title; - m_widget = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + GtkWindowType win_type = GTK_WINDOW_TOPLEVEL; + if (style & wxSIMPLE_BORDER) win_type = GTK_WINDOW_POPUP; + + m_widget = gtk_window_new( win_type ); if ((size.x != -1) && (size.y != -1)) gtk_widget_set_usize( m_widget, m_width, m_height ); if ((pos.x != -1) && (pos.y != -1)) diff --git a/src/gtk1/menu.cpp b/src/gtk1/menu.cpp index 7bf133ec47..4852879086 100644 --- a/src/gtk1/menu.cpp +++ b/src/gtk1/menu.cpp @@ -31,13 +31,9 @@ wxMenuBar::wxMenuBar() m_menus.DeleteContents( TRUE ); - m_widget = gtk_handle_box_new(); - m_menubar = gtk_menu_bar_new(); - - gtk_container_add( GTK_CONTAINER(m_widget), m_menubar ); - - gtk_widget_show( m_menubar ); + + m_widget = GTK_WIDGET(m_menubar); PostCreation(); diff --git a/src/gtk1/tbargtk.cpp b/src/gtk1/tbargtk.cpp index 491eea3cd2..5af767a335 100644 --- a/src/gtk1/tbargtk.cpp +++ b/src/gtk1/tbargtk.cpp @@ -2,9 +2,7 @@ // Name: tbargtk.cpp // Purpose: GTK toolbar // Author: Robert Roebling -// Modified by: -// Created: 01/02/97 -// RCS-ID: +// RCS-ID: $Id$ // Copyright: (c) Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -113,15 +111,12 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id, m_tools.DeleteContents( TRUE ); - m_widget = gtk_handle_box_new(); - m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) ); - gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); - gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) ); - - gtk_widget_show( GTK_WIDGET(m_toolbar) ); + m_widget = GTK_WIDGET(m_toolbar); + + gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE ); PostCreation(); @@ -209,12 +204,6 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap, (gpointer)tool ); - // VZ: we don't want GDK_NO_EXPOSE events because for some reason our - // toolbar buttons get them (it doesn't happen in a standalone GTK+ program - // for unknown reasons) and it prevents tooltips from appearing. - gtk_widget_set_events( GTK_WIDGET(item), - gtk_widget_get_events( GTK_WIDGET(item) ) & - ~GDK_EXPOSURE_MASK); tool->m_item = item; gtk_signal_connect( GTK_OBJECT(tool->m_item), diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index eb9b9dcb84..f220749ead 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -913,6 +913,7 @@ wxWindow::wxWindow() m_pDropTarget = (wxDropTarget *) NULL; m_resizing = FALSE; m_hasOwnStyle = FALSE; + m_scrollGC = (GdkGC*) NULL; } bool wxWindow::Create( wxWindow *parent, wxWindowID id, @@ -982,7 +983,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, m_wxwindow = gtk_myfixed_new(); - if (m_wxwindow) GTK_WIDGET_UNSET_FLAGS( m_widget, GTK_CAN_FOCUS ); + 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 ); @@ -1014,7 +1015,7 @@ bool wxWindow::Create( wxWindow *parent, wxWindowID id, gtk_widget_show( m_wxwindow ); PostCreation(); - + Show( TRUE ); return TRUE; @@ -1031,6 +1032,8 @@ wxWindow::~wxWindow() DestroyChildren(); + if (m_scrollGC) gdk_gc_unref( m_scrollGC ); + if (m_wxwindow) gtk_widget_destroy( m_wxwindow ); if (m_widget) gtk_widget_destroy( m_widget ); @@ -1129,11 +1132,7 @@ void wxWindow::PostCreation() if (m_widget && m_parent) gtk_widget_realize( m_widget ); - if (m_wxwindow) - { - gtk_widget_realize( m_wxwindow ); - gdk_gc_set_exposures( m_wxwindow->style->fg_gc[0], TRUE ); - } + if (m_wxwindow) gtk_widget_realize( m_wxwindow ); SetCursor( *wxSTANDARD_CURSOR ); @@ -2430,7 +2429,14 @@ void wxWindow::ScrollWindow( int dx, int dy, const wxRect* WXUNUSED(rect) ) int d_y = 0; if (dx > 0) d_x = dx; if (dy > 0) d_y = dy; - gdk_window_copy_area( m_wxwindow->window, m_wxwindow->style->fg_gc[0], d_x, d_y, + + if (!m_scrollGC) + { + m_scrollGC = gdk_gc_new( m_wxwindow->window ); + gdk_gc_set_exposures( m_scrollGC, TRUE ); + } + + gdk_window_copy_area( m_wxwindow->window, m_scrollGC, d_x, d_y, m_wxwindow->window, s_x, s_y, w, h ); wxRect rect;