From: Robert Roebling Date: Thu, 17 Dec 1998 14:07:46 +0000 (+0000) Subject: Removed minor differences between wxMSW and wxGTK X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/4f22cf8ddb6d4c75eee97d1320ba20f7c82753c8 Removed minor differences between wxMSW and wxGTK git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1216 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/docs/gtk/install.txt b/docs/gtk/install.txt index 728fd2f749..f728dc008d 100644 --- a/docs/gtk/install.txt +++ b/docs/gtk/install.txt @@ -70,6 +70,7 @@ distributions have correct glibc 2 support: - RedHat 5.1 - Debian 2.0 - Stampede + - DLD 6.0 The next major version of SuSE will also support glibc 2, but version 5.X does not. Also Caldera and Slackware diff --git a/docs/gtk/todo.txt b/docs/gtk/todo.txt index fafe591206..05ba0e3afd 100644 --- a/docs/gtk/todo.txt +++ b/docs/gtk/todo.txt @@ -1,9 +1,6 @@ -------------------- High priority --------------------- -wxClipboard - -> On the way, but not functional yet. - -------------------- Low priority --------------------- OwnerDraw for wxListCtrl and others @@ -18,15 +15,9 @@ wxDebugContext <-> wxLogXXX functions Implement wxPalette -> I never understood that. Postponed. -Implement wxDirDialog - -> Not heard of. Postponed. - Show accelerator in menus -> Changed in GTK 1.1.X. Postponed. -Correct tab navigation - -> seems to be broken in GTK. Postponed. - Cooperation with Qt -> Would be nice. \ No newline at end of file diff --git a/include/wx/generic/colrdlgg.h b/include/wx/generic/colrdlgg.h index dac3a81ea2..942d2ed8ee 100644 --- a/include/wx/generic/colrdlgg.h +++ b/include/wx/generic/colrdlgg.h @@ -82,7 +82,7 @@ class WXDLLEXPORT wxGenericColourDialog: public wxDialog bool Create(wxWindow *parent, wxColourData *data = (wxColourData *) NULL); int ShowModal(void); - wxColourData GetColourData(void) { return colourData; } + wxColourData &GetColourData(void) { return colourData; } // Internal functions void OnMouseEvent(wxMouseEvent& event); diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 0fd0373086..81c34064df 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -582,9 +582,10 @@ class wxListCtrl: public wxControl wxImageList *GetImageList(int which) const; void SetImageList(wxImageList *imageList, int which) ; bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC + void ClearAll(); bool DeleteItem( long item ); - bool DeleteAllItems(void) ; - void DeleteAllColumns(void) ; + bool DeleteAllItems(void); + bool DeleteAllColumns(void); bool DeleteColumn( int col ); // wxText& Edit(long item) ; // not supported in wxGLC bool EnsureVisible( long item ); diff --git a/include/wx/generic/treectrl.h b/include/wx/generic/treectrl.h index 818bf59a2a..0158561753 100644 --- a/include/wx/generic/treectrl.h +++ b/include/wx/generic/treectrl.h @@ -23,6 +23,21 @@ #include "wx/scrolwin.h" #include "wx/textctrl.h" +// ----------------------------------------------------------------------------- +// constants +// ----------------------------------------------------------------------------- + +// values for the `flags' parameter of wxTreeCtrl::HitTest() which determine +// where exactly the specified point is situated: +static const int wxTREE_HITTEST_NOWHERE = 0x0004; + // on the bitmap associated with an item. +static const int wxTREE_HITTEST_ONITEMICON = 0x0020; + // on the label (string) associated with an item. +static const int wxTREE_HITTEST_ONITEMLABEL = 0x0080; + // anywhere on the item +static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | + wxTREE_HITTEST_ONITEMLABEL; + // ----------------------------------------------------------------------------- // forward declaration // ----------------------------------------------------------------------------- @@ -186,9 +201,10 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator &validator = wxDefaultValidator, const wxString& name = "wxTreeCtrl") { - Create(parent, id, pos, size, style, name); + Create(parent, id, pos, size, style, validator, name); } virtual ~wxTreeCtrl(); @@ -197,6 +213,7 @@ public: const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, + const wxValidator &validator = wxDefaultValidator, const wxString& name = "wxTreeCtrl"); // accessors @@ -375,6 +392,12 @@ public: // scroll to this item (but don't expand its parent) void ScrollTo(const wxTreeItemId& item); + // The first function is more portable (because easier to implement + // on other platforms), but the second one returns some extra info. + wxTreeItemId HitTest(const wxPoint& point) + { int dummy; return HitTest(point, dummy); } + wxTreeItemId HitTest(const wxPoint& point, int& flags); + // start editing the item label: this (temporarily) replaces the item // with a one line edit control. The item will be selected if it hadn't // been before. textCtrlClass parameter allows you to create an edit diff --git a/include/wx/gtk/brush.h b/include/wx/gtk/brush.h index 43213033b0..c52eb45011 100644 --- a/include/wx/gtk/brush.h +++ b/include/wx/gtk/brush.h @@ -51,7 +51,6 @@ class wxBrush: public wxGDIObject wxColour &GetColour() const; wxBitmap *GetStipple() const; - void SetColour( const wxColour& col ); void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetStyle( int style ); diff --git a/include/wx/gtk/checklst.h b/include/wx/gtk/checklst.h index 48cb62cf76..878adc2956 100644 --- a/include/wx/gtk/checklst.h +++ b/include/wx/gtk/checklst.h @@ -48,6 +48,8 @@ public: bool IsChecked( int index ) const; void Check( int index, bool check = TRUE ); + + int GetItemHeight(); }; diff --git a/include/wx/gtk/dc.h b/include/wx/gtk/dc.h index 09fef31960..7f4503fb6e 100644 --- a/include/wx/gtk/dc.h +++ b/include/wx/gtk/dc.h @@ -189,16 +189,16 @@ public: virtual void Clear() = 0; virtual void SetFont( const wxFont &font ) = 0; - virtual const wxFont& GetFont() const { return m_font; }; + virtual wxFont& GetFont() const { return (wxFont&)m_font; }; virtual void SetPen( const wxPen &pen ) = 0; - virtual const wxPen& GetPen() const { return m_pen; }; + virtual wxPen& GetPen() const { return (wxPen&)m_pen; }; virtual void SetBrush( const wxBrush &brush ) = 0; - virtual const wxBrush& GetBrush() const { return m_brush; }; + virtual wxBrush& GetBrush() const { return (wxBrush&)m_brush; }; virtual void SetBackground( const wxBrush &brush ) = 0; - virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }; + virtual wxBrush& GetBackground() const { return (wxBrush&)m_backgroundBrush; }; virtual void SetLogicalFunction( int function ) = 0; virtual int GetLogicalFunction() { return m_logicalFunction; }; diff --git a/include/wx/gtk/menu.h b/include/wx/gtk/menu.h index 9896ab085e..71a9fde5b3 100644 --- a/include/wx/gtk/menu.h +++ b/include/wx/gtk/menu.h @@ -49,6 +49,8 @@ public: int FindMenuItem( const wxString &menuString, const wxString &itemString ) const; wxMenuItem* FindMenuItemById( int id ) const; + inline wxMenuItem* FindMenuItemForId( int id ) const + { return FindMenuItemById( id ); } void Check( int id, bool check ); bool Checked( int id ) const; diff --git a/include/wx/gtk/window.h b/include/wx/gtk/window.h index 82a4de7e78..fc4a1e35e2 100644 --- a/include/wx/gtk/window.h +++ b/include/wx/gtk/window.h @@ -134,11 +134,23 @@ public: virtual void SetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); virtual void SetSize( int width, int height ); + virtual void Move( int x, int y ); + virtual void GetSize( int *width, int *height ) const; + wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } + virtual void SetClientSize( int const width, int const height ); + virtual void GetClientSize( int *width, int *height ) const; + wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } + virtual void GetPosition( int *x, int *y ) const; + wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); } + + wxRect GetRect() const + { int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); } + virtual void Centre( int direction = wxHORIZONTAL ); inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } virtual void Fit(); @@ -204,6 +216,8 @@ public: void SetCursor( const wxCursor &cursor ); + void WarpPointer(int x, int y); + virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Clear(); @@ -226,13 +240,13 @@ public: const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; virtual void SetFont( const wxFont &font ); - virtual const wxFont& GetFont() { return m_font; } + virtual wxFont& GetFont() { return m_font; } // For backward compatibility inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } - inline virtual const wxFont& GetLabelFont() { return GetFont(); }; - inline virtual const wxFont& GetButtonFont() { return GetFont(); }; + inline virtual wxFont& GetLabelFont() { return GetFont(); }; + inline virtual wxFont& GetButtonFont() { return GetFont(); }; virtual void SetWindowStyleFlag( long flag ); virtual long GetWindowStyleFlag() const; diff --git a/include/wx/gtk1/brush.h b/include/wx/gtk1/brush.h index 43213033b0..c52eb45011 100644 --- a/include/wx/gtk1/brush.h +++ b/include/wx/gtk1/brush.h @@ -51,7 +51,6 @@ class wxBrush: public wxGDIObject wxColour &GetColour() const; wxBitmap *GetStipple() const; - void SetColour( const wxColour& col ); void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetStyle( int style ); diff --git a/include/wx/gtk1/checklst.h b/include/wx/gtk1/checklst.h index 48cb62cf76..878adc2956 100644 --- a/include/wx/gtk1/checklst.h +++ b/include/wx/gtk1/checklst.h @@ -48,6 +48,8 @@ public: bool IsChecked( int index ) const; void Check( int index, bool check = TRUE ); + + int GetItemHeight(); }; diff --git a/include/wx/gtk1/dc.h b/include/wx/gtk1/dc.h index 09fef31960..7f4503fb6e 100644 --- a/include/wx/gtk1/dc.h +++ b/include/wx/gtk1/dc.h @@ -189,16 +189,16 @@ public: virtual void Clear() = 0; virtual void SetFont( const wxFont &font ) = 0; - virtual const wxFont& GetFont() const { return m_font; }; + virtual wxFont& GetFont() const { return (wxFont&)m_font; }; virtual void SetPen( const wxPen &pen ) = 0; - virtual const wxPen& GetPen() const { return m_pen; }; + virtual wxPen& GetPen() const { return (wxPen&)m_pen; }; virtual void SetBrush( const wxBrush &brush ) = 0; - virtual const wxBrush& GetBrush() const { return m_brush; }; + virtual wxBrush& GetBrush() const { return (wxBrush&)m_brush; }; virtual void SetBackground( const wxBrush &brush ) = 0; - virtual const wxBrush& GetBackground() const { return m_backgroundBrush; }; + virtual wxBrush& GetBackground() const { return (wxBrush&)m_backgroundBrush; }; virtual void SetLogicalFunction( int function ) = 0; virtual int GetLogicalFunction() { return m_logicalFunction; }; diff --git a/include/wx/gtk1/menu.h b/include/wx/gtk1/menu.h index 9896ab085e..71a9fde5b3 100644 --- a/include/wx/gtk1/menu.h +++ b/include/wx/gtk1/menu.h @@ -49,6 +49,8 @@ public: int FindMenuItem( const wxString &menuString, const wxString &itemString ) const; wxMenuItem* FindMenuItemById( int id ) const; + inline wxMenuItem* FindMenuItemForId( int id ) const + { return FindMenuItemById( id ); } void Check( int id, bool check ); bool Checked( int id ) const; diff --git a/include/wx/gtk1/window.h b/include/wx/gtk1/window.h index 82a4de7e78..fc4a1e35e2 100644 --- a/include/wx/gtk1/window.h +++ b/include/wx/gtk1/window.h @@ -134,11 +134,23 @@ public: virtual void SetSize( int x, int y, int width, int height, int sizeFlags = wxSIZE_AUTO ); virtual void SetSize( int width, int height ); + virtual void Move( int x, int y ); + virtual void GetSize( int *width, int *height ) const; + wxSize GetSize() const { int w, h; GetSize(& w, & h); return wxSize(w, h); } + virtual void SetClientSize( int const width, int const height ); + virtual void GetClientSize( int *width, int *height ) const; + wxSize GetClientSize() const { int w, h; GetClientSize(& w, & h); return wxSize(w, h); } + virtual void GetPosition( int *x, int *y ) const; + wxPoint GetPosition() const { int w, h; GetPosition(& w, & h); return wxPoint(w, h); } + + wxRect GetRect() const + { int x, y, w, h; GetPosition(& x, & y); GetSize(& w, & h); return wxRect(x, y, w, h); } + virtual void Centre( int direction = wxHORIZONTAL ); inline void Center(int direction = wxHORIZONTAL) { Centre(direction); } virtual void Fit(); @@ -204,6 +216,8 @@ public: void SetCursor( const wxCursor &cursor ); + void WarpPointer(int x, int y); + virtual void Refresh( bool eraseBackground = TRUE, const wxRect *rect = (const wxRect *) NULL ); virtual void Clear(); @@ -226,13 +240,13 @@ public: const wxFont *theFont = (const wxFont *) NULL, bool use16 = FALSE) const; virtual void SetFont( const wxFont &font ); - virtual const wxFont& GetFont() { return m_font; } + virtual wxFont& GetFont() { return m_font; } // For backward compatibility inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); } inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); } - inline virtual const wxFont& GetLabelFont() { return GetFont(); }; - inline virtual const wxFont& GetButtonFont() { return GetFont(); }; + inline virtual wxFont& GetLabelFont() { return GetFont(); }; + inline virtual wxFont& GetButtonFont() { return GetFont(); }; virtual void SetWindowStyleFlag( long flag ); virtual long GetWindowStyleFlag() const; diff --git a/samples/checklst/checklst.cpp b/samples/checklst/checklst.cpp index 8310a8aa91..e9aecd779f 100644 --- a/samples/checklst/checklst.cpp +++ b/samples/checklst/checklst.cpp @@ -154,12 +154,12 @@ CheckListBoxFrame::~CheckListBoxFrame() { } -void CheckListBoxFrame::OnQuit(wxCommandEvent& event) +void CheckListBoxFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) { Close(TRUE); } -void CheckListBoxFrame::OnAbout(wxCommandEvent& event) +void CheckListBoxFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) { wxMessageDialog dialog(this, "Demo of wxCheckListBox control\n" "About wxCheckListBox", wxYES_NO | wxCANCEL); @@ -175,7 +175,7 @@ void CheckListBoxFrame::OnListboxSelect(wxCommandEvent& event) SetStatusText(strSelection); } -void CheckListBoxFrame::OnListboxDblClick(wxCommandEvent& event) +void CheckListBoxFrame::OnListboxDblClick(wxCommandEvent& WXUNUSED(event)) { wxString strSelection; strSelection.sprintf("item %d double clicked", m_pListBox->GetSelection()); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 47febe9e3e..3411f58f1b 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2596,10 +2596,17 @@ bool wxListCtrl::DeleteAllItems(void) return TRUE; } -void wxListCtrl::DeleteAllColumns() +bool wxListCtrl::DeleteAllColumns() { for ( size_t n = 0; n < m_mainWin->m_columns.GetCount(); n++ ) DeleteColumn(n); + + return TRUE; +} + +void wxListCtrl::ClearAll() +{ + m_mainWin->DeleteEverything(); } bool wxListCtrl::DeleteColumn( int col ) diff --git a/src/generic/treectrl.cpp b/src/generic/treectrl.cpp index 04d3717ec3..ba33d471b7 100644 --- a/src/generic/treectrl.cpp +++ b/src/generic/treectrl.cpp @@ -329,11 +329,15 @@ void wxTreeCtrl::Init() bool wxTreeCtrl::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, - long style, const wxString& name ) + long style, + const wxValidator &validator, + const wxString& name ) { Init(); wxScrolledWindow::Create( parent, id, pos, size, style|wxHSCROLL|wxVSCROLL, name ); + + SetValidator( validator ); SetBackgroundColour( *wxWHITE ); m_dottedPen = wxPen( *wxBLACK, 0, 0 ); @@ -1219,6 +1223,12 @@ void wxTreeCtrl::OnChar( wxKeyEvent &event ) } } +wxTreeItemId wxTreeCtrl::HitTest(const wxPoint& point, int& WXUNUSED(flags)) +{ + bool onButton = FALSE; + return m_anchor->HitTest( point, onButton ); +} + void wxTreeCtrl::OnMouse( wxMouseEvent &event ) { if ( !(event.LeftDown() || event.LeftDClick()) ) diff --git a/src/gtk/checklst.cpp b/src/gtk/checklst.cpp index 02df541f16..4d7e6fe775 100644 --- a/src/gtk/checklst.cpp +++ b/src/gtk/checklst.cpp @@ -77,14 +77,13 @@ void wxCheckListBox::Check( int index, bool check ) gtk_label_set( label, str ); - wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() ); - event.SetEventObject( this ); - event.SetInt( index ); - GetEventHandler()->ProcessEvent( event ); - return; } wxFAIL_MSG("wrong checklistbox index"); } +int wxCheckListBox::GetItemHeight() +{ + return 22; +} diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index a9ef5ae287..630925e135 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -47,14 +47,28 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, if (!listbox->HasVMT()) return FALSE; - if (gdk_event->x > 15) return FALSE; - int sel = listbox->GetIndex( widget ); - wxCheckListBox *clb = (wxCheckListBox *)listbox; + if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS)) + { + wxCheckListBox *clb = (wxCheckListBox *)listbox; - clb->Check( sel, !clb->IsChecked(sel) ); + clb->Check( sel, !clb->IsChecked(sel) ); + wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() ); + event.SetEventObject( listbox ); + event.SetInt( sel ); + listbox->GetEventHandler()->ProcessEvent( event ); + } + + if (gdk_event->type == GDK_2BUTTON_PRESS) + { + wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() ); + event.SetEventObject( listbox ); + event.SetInt( sel ); + listbox->GetEventHandler()->ProcessEvent( event ); + } + return FALSE; } @@ -77,6 +91,11 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis clb->Check( sel, !clb->IsChecked(sel) ); + wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() ); + event.SetEventObject( listbox ); + event.SetInt( sel ); + listbox->GetEventHandler()->ProcessEvent( event ); + return FALSE; } @@ -219,13 +238,13 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, "button_press_event", (GtkSignalFunc)gtk_listbox_button_press_callback, (gpointer) this ); - - gtk_signal_connect( GTK_OBJECT(list_item), - "key_press_event", - (GtkSignalFunc)gtk_listbox_key_press_callback, - (gpointer)this ); } + gtk_signal_connect( GTK_OBJECT(list_item), + "key_press_event", + (GtkSignalFunc)gtk_listbox_key_press_callback, + (gpointer)this ); + ConnectWidget( list_item ); gtk_widget_show( list_item ); @@ -286,12 +305,12 @@ void wxListBox::AppendCommon( const wxString &item ) "button_press_event", (GtkSignalFunc)gtk_listbox_button_press_callback, (gpointer) this ); - - gtk_signal_connect( GTK_OBJECT(list_item), - "key_press_event", - (GtkSignalFunc)gtk_listbox_key_press_callback, - (gpointer)this ); } + + gtk_signal_connect( GTK_OBJECT(list_item), + "key_press_event", + (GtkSignalFunc)gtk_listbox_key_press_callback, + (gpointer)this ); gtk_widget_show( list_item ); diff --git a/src/gtk/window.cpp b/src/gtk/window.cpp index 4d375355ff..f9de7711aa 100644 --- a/src/gtk/window.cpp +++ b/src/gtk/window.cpp @@ -2190,6 +2190,11 @@ void wxWindow::SetCursor( const wxCursor &cursor ) gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() ); } +void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) ) +{ + // TODO +} + void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) { wxCHECK_RET( (m_widget != NULL), "invalid window" ); diff --git a/src/gtk1/checklst.cpp b/src/gtk1/checklst.cpp index 02df541f16..4d7e6fe775 100644 --- a/src/gtk1/checklst.cpp +++ b/src/gtk1/checklst.cpp @@ -77,14 +77,13 @@ void wxCheckListBox::Check( int index, bool check ) gtk_label_set( label, str ); - wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, GetId() ); - event.SetEventObject( this ); - event.SetInt( index ); - GetEventHandler()->ProcessEvent( event ); - return; } wxFAIL_MSG("wrong checklistbox index"); } +int wxCheckListBox::GetItemHeight() +{ + return 22; +} diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index a9ef5ae287..630925e135 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -47,14 +47,28 @@ gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, if (!listbox->HasVMT()) return FALSE; - if (gdk_event->x > 15) return FALSE; - int sel = listbox->GetIndex( widget ); - wxCheckListBox *clb = (wxCheckListBox *)listbox; + if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS)) + { + wxCheckListBox *clb = (wxCheckListBox *)listbox; - clb->Check( sel, !clb->IsChecked(sel) ); + clb->Check( sel, !clb->IsChecked(sel) ); + wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() ); + event.SetEventObject( listbox ); + event.SetInt( sel ); + listbox->GetEventHandler()->ProcessEvent( event ); + } + + if (gdk_event->type == GDK_2BUTTON_PRESS) + { + wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() ); + event.SetEventObject( listbox ); + event.SetInt( sel ); + listbox->GetEventHandler()->ProcessEvent( event ); + } + return FALSE; } @@ -77,6 +91,11 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis clb->Check( sel, !clb->IsChecked(sel) ); + wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() ); + event.SetEventObject( listbox ); + event.SetInt( sel ); + listbox->GetEventHandler()->ProcessEvent( event ); + return FALSE; } @@ -219,13 +238,13 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, "button_press_event", (GtkSignalFunc)gtk_listbox_button_press_callback, (gpointer) this ); - - gtk_signal_connect( GTK_OBJECT(list_item), - "key_press_event", - (GtkSignalFunc)gtk_listbox_key_press_callback, - (gpointer)this ); } + gtk_signal_connect( GTK_OBJECT(list_item), + "key_press_event", + (GtkSignalFunc)gtk_listbox_key_press_callback, + (gpointer)this ); + ConnectWidget( list_item ); gtk_widget_show( list_item ); @@ -286,12 +305,12 @@ void wxListBox::AppendCommon( const wxString &item ) "button_press_event", (GtkSignalFunc)gtk_listbox_button_press_callback, (gpointer) this ); - - gtk_signal_connect( GTK_OBJECT(list_item), - "key_press_event", - (GtkSignalFunc)gtk_listbox_key_press_callback, - (gpointer)this ); } + + gtk_signal_connect( GTK_OBJECT(list_item), + "key_press_event", + (GtkSignalFunc)gtk_listbox_key_press_callback, + (gpointer)this ); gtk_widget_show( list_item ); diff --git a/src/gtk1/window.cpp b/src/gtk1/window.cpp index 4d375355ff..f9de7711aa 100644 --- a/src/gtk1/window.cpp +++ b/src/gtk1/window.cpp @@ -2190,6 +2190,11 @@ void wxWindow::SetCursor( const wxCursor &cursor ) gdk_window_set_cursor( m_wxwindow->window, m_cursor->GetCursor() ); } +void wxWindow::WarpPointer( int WXUNUSED(x), int WXUNUSED(y) ) +{ + // TODO +} + void wxWindow::Refresh( bool eraseBackground, const wxRect *rect ) { wxCHECK_RET( (m_widget != NULL), "invalid window" ); diff --git a/utils/wxPython/src/cmndlgs.i b/utils/wxPython/src/cmndlgs.i index f4942a4ffb..4a17cfce36 100644 --- a/utils/wxPython/src/cmndlgs.i +++ b/utils/wxPython/src/cmndlgs.i @@ -55,18 +55,13 @@ public: %pragma(python) addtomethod = "__init__:wx._StdDialogCallbacks(self)" -#ifdef __WXMSW__ wxColourData& GetColourData(); -#else - wxColourData GetColourData(); -#endif int ShowModal(); }; //---------------------------------------------------------------------- -#ifdef __WXMSW__ class wxDirDialog : public wxDialog { public: wxDirDialog(wxWindow* parent, @@ -84,7 +79,6 @@ public: void SetPath(const wxString& path); int ShowModal(); }; -#endif //---------------------------------------------------------------------- @@ -311,6 +305,9 @@ public: ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.8 1998/12/17 14:07:25 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.7 1998/12/15 20:41:14 RD // Changed the import semantics from "from wxPython import *" to "from // wxPython.wx import *" This is for people who are worried about diff --git a/utils/wxPython/src/controls.i b/utils/wxPython/src/controls.i index 7279b5dc3c..7b5098130e 100644 --- a/utils/wxPython/src/controls.i +++ b/utils/wxPython/src/controls.i @@ -83,14 +83,12 @@ public: %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" wxBitmap& GetBitmapLabel(); -#ifdef __WXMSW__ wxBitmap& GetBitmapDisabled(); wxBitmap& GetBitmapFocus(); wxBitmap& GetBitmapSelected(); void SetBitmapDisabled(const wxBitmap& bitmap); void SetBitmapFocus(const wxBitmap& bitmap); void SetBitmapSelected(const wxBitmap& bitmap); -#endif void SetBitmapLabel(const wxBitmap& bitmap); }; @@ -270,7 +268,6 @@ public: //---------------------------------------------------------------------- -#ifdef __WXMSW__ class wxCheckListBox : public wxListBox { public: wxCheckListBox(wxWindow *parent, wxWindowID id, @@ -289,7 +286,6 @@ public: int GetItemHeight(); }; -#endif //---------------------------------------------------------------------- @@ -483,6 +479,9 @@ public: ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.9 1998/12/17 14:07:29 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.8 1998/12/15 20:41:15 RD // Changed the import semantics from "from wxPython import *" to "from // wxPython.wx import *" This is for people who are worried about diff --git a/utils/wxPython/src/controls2.i b/utils/wxPython/src/controls2.i index 211ce72b14..bd3ea2da4e 100644 --- a/utils/wxPython/src/controls2.i +++ b/utils/wxPython/src/controls2.i @@ -90,11 +90,12 @@ public: bool DeleteItem(long item); bool DeleteAllItems(); bool DeleteColumn(int col); -#ifdef __WXMSW__ bool DeleteAllColumns(void); void ClearAll(void); +#ifdef __WXMSW__ wxTextCtrl* EditLabel(long item); bool EndEditLabel(bool cancel); + wxTextCtrl* GetEditControl(); #endif bool EnsureVisible(long item); long FindItem(long start, const wxString& str, bool partial = FALSE); @@ -104,9 +105,6 @@ public: bool GetColumn(int col, wxListItem& item); int GetColumnWidth(int col); int GetCountPerPage(); -#ifdef __WXMSW__ - wxTextCtrl* GetEditControl(); -#endif wxImageList* GetImageList(int which); long GetItemData(long item); @@ -138,6 +136,7 @@ public: int GetSelectedItemCount(); #ifdef __WXMSW__ wxColour GetTextColour(); + void SetTextColour(const wxColour& col); #endif long GetTopItem(); long HitTest(const wxPoint& point, int& OUTPUT); @@ -166,9 +165,6 @@ public: bool SetItemState(long item, long state, long stateMask); void SetItemText(long item, const wxString& text); void SetSingleStyle(long style, bool add = TRUE); -#ifdef __WXMSW__ - void SetTextColour(const wxColour& col); -#endif void SetWindowStyleFlag(long style); // TODO: bool SortItems(wxListCtrlCompare fn, long data); }; @@ -222,7 +218,6 @@ public: class wxTreeCtrl : public wxControl { public: -#ifdef __WXMSW__ wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, const wxPoint& pos = wxPyDefaultPosition, const wxSize& size = wxPyDefaultSize, @@ -230,14 +225,6 @@ public: const wxValidator& validator = wxPyDefaultValidator, char* name = "wxTreeCtrl"); -#else - wxTreeCtrl(wxWindow *parent, wxWindowID id = -1, - const wxPoint& pos = wxPyDefaultPosition, - const wxSize& size = wxPyDefaultSize, - long style = wxTR_HAS_BUTTONS | wxTR_LINES_AT_ROOT, - //const wxValidator& validator = wxPyDefaultValidator, - char* name = "wxTreeCtrl"); -#endif %pragma(python) addtomethod = "__init__:wx._StdWindowCallbacks(self)" size_t GetCount(); @@ -318,9 +305,7 @@ public: void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); bool IsBold(const wxTreeItemId& item) const; -#ifdef __WXMSW__ wxTreeItemId HitTest(const wxPoint& point); -#endif }; @@ -384,7 +369,11 @@ public: ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.13 1998/12/17 14:07:34 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.12 1998/12/16 22:10:52 RD +// // Tweaks needed to be able to build wxPython with wxGTK. // // Revision 1.11 1998/12/15 20:41:16 RD diff --git a/utils/wxPython/src/gdi.i b/utils/wxPython/src/gdi.i index 659f3d9cff..5d5efc3ba6 100644 --- a/utils/wxPython/src/gdi.i +++ b/utils/wxPython/src/gdi.i @@ -247,11 +247,9 @@ public: wxBitmap * GetStipple(); int GetStyle(); bool Ok(); -#ifdef __WXMSW__ void SetColour(wxColour &colour); void SetStipple(wxBitmap& bitmap); void SetStyle(int style); -#endif }; //---------------------------------------------------------------------- @@ -290,30 +288,17 @@ public: void EndDrawing(); void EndPage(); void FloodFill(long x, long y, const wxColour& colour, int style=wxFLOOD_SURFACE); -#ifdef __WXMSW__ wxBrush& GetBackground(); wxBrush& GetBrush(); -#else - wxBrush GetBackground(); - wxBrush GetBrush(); -#endif long GetCharHeight(); long GetCharWidth(); void GetClippingBox(long *OUTPUT, long *OUTPUT, long *OUTPUT, long *OUTPUT); -#ifdef __WXMSW__ wxFont& GetFont(); -#else - wxFont GetFont(); -#endif int GetLogicalFunction(); int GetMapMode(); bool GetOptimization(); -#ifdef __WXMSW__ wxPen& GetPen(); -#else - wxPen GetPen(); -#endif %addmethods { %new wxColour* GetPixel(long x, long y) { wxColour* wc = new wxColour(); @@ -413,21 +398,17 @@ public: //--------------------------------------------------------------------------- -#ifdef __WXMSW__ class wxWindowDC : public wxDC { public: wxWindowDC(wxWindow* win); }; -#endif //--------------------------------------------------------------------------- -#ifndef __WXMSW__ class wxPostScriptDC : public wxDC { public: wxPostScriptDC(const wxString& output, bool interactive = TRUE, wxWindow* win = NULL); }; -#endif //--------------------------------------------------------------------------- @@ -522,7 +503,11 @@ public: ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.9 1998/12/17 14:07:37 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.8 1998/12/16 22:10:54 RD +// // Tweaks needed to be able to build wxPython with wxGTK. // // Revision 1.7 1998/12/15 20:41:18 RD diff --git a/utils/wxPython/src/helpers.cpp b/utils/wxPython/src/helpers.cpp index 3601629369..834319f037 100644 --- a/utils/wxPython/src/helpers.cpp +++ b/utils/wxPython/src/helpers.cpp @@ -21,12 +21,6 @@ #include #include "helpers.h" -#ifdef __WXGTK__ -#ifdef wxUSE_GDK_IMLIB -#include "gdk_imlib/gdk_imlib.h" -#endif -#endif - //--------------------------------------------------------------------------- //wxHashTable* wxPyWindows = NULL; @@ -140,12 +134,6 @@ void __wxPreStart() gtk_init( &argc, &argv ); delete [] argv; -#ifdef wxUSE_GDK_IMLIB - gdk_imlib_init(); - gtk_widget_push_visual(gdk_imlib_get_visual()); - gtk_widget_push_colormap(gdk_imlib_get_colormap()); -#endif - wxApp::CommonInit(); #endif @@ -602,6 +590,9 @@ wxAcceleratorEntry* wxAcceleratorEntry_LIST_helper(PyObject* source) { ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.16 1998/12/17 14:07:39 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.15 1998/12/15 20:41:19 RD // Changed the import semantics from "from wxPython import *" to "from // wxPython.wx import *" This is for people who are worried about diff --git a/utils/wxPython/src/stattool.i b/utils/wxPython/src/stattool.i index e68fccaf47..f28a74f802 100644 --- a/utils/wxPython/src/stattool.i +++ b/utils/wxPython/src/stattool.i @@ -139,17 +139,16 @@ public: wxToolBarTool* FindToolForPosition(const float x, const float y); wxSize GetToolSize(); wxSize GetToolBitmapSize(); + void SetToolBitmapSize(const wxSize& size); // wxSize GetMargins(); wxSize GetMaxSize(); // wxObject* GetToolClientData(int toolIndex); #endif bool GetToolEnabled(int toolIndex); -#ifdef __WXMSW__ wxString GetToolLongHelp(int toolIndex); int GetToolPacking(); int GetToolSeparation(); wxString GetToolShortHelp(int toolIndex); -#endif bool GetToolState(int toolIndex); // TODO: figure out how to handle these @@ -157,17 +156,10 @@ public: //void OnMouseEnter(int toolIndex); //void OnRightClick(int toolIndex, float x, float y); - -#ifdef __WXMSW__ bool Realize(); -#else - void Realize(); -#endif -#ifdef __WXMSW__ - void SetToolBitmapSize(const wxSize& size); + void SetToolLongHelp(int toolIndex, const wxString& helpString); void SetToolShortHelp(int toolIndex, const wxString& helpString); -#endif void SetMargins(const wxSize& size); void SetToolPacking(int packing); void SetToolSeparation(int separation); @@ -209,6 +201,9 @@ public: ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.4 1998/12/17 14:07:43 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.3 1998/12/15 20:41:23 RD // Changed the import semantics from "from wxPython import *" to "from // wxPython.wx import *" This is for people who are worried about diff --git a/utils/wxPython/src/windows.i b/utils/wxPython/src/windows.i index 9b095fb079..6946b45cd7 100644 --- a/utils/wxPython/src/windows.i +++ b/utils/wxPython/src/windows.i @@ -16,13 +16,10 @@ %{ #include "helpers.h" -#ifdef __WXMSW__ - // wxGTK defines wxMenuItem inside menu.h #include -#endif #ifdef __WXMSW__ -#include +#include // needed ? #endif %} @@ -87,28 +84,14 @@ public: int GetCharHeight(); int GetCharWidth(); %name(GetClientSizeTuple) void GetClientSize(int *OUTPUT, int *OUTPUT); -#ifdef __WXMSW__ wxSize GetClientSize(); -#else - %addmethods { - wxSize GetClientSize() { - int w, h; - self->GetClientSize(&w, &h); - return wxSize(w, h); - } - } -#endif wxLayoutConstraints * GetConstraints(); #ifdef __WXMSW__ wxButton* GetDefaultItem(); #endif //wxEvtHandler* GetEventHandler(); -#ifdef __WXMSW__ wxFont& GetFont(); -#else - wxFont GetFont(); -#endif wxColour GetForegroundColour(); wxWindow * GetGrandParent(); int GetId(); @@ -116,18 +99,14 @@ public: wxString GetName(); wxWindow * GetParent(); %name(GetPositionTuple) void GetPosition(int *OUTPUT, int *OUTPUT); -#ifdef __WXMSW__ wxPoint GetPosition(); wxRect GetRect(); -#endif int GetReturnCode(); int GetScrollThumb(int orientation); int GetScrollPos(int orientation); int GetScrollRange(int orientation); %name(GetSizeTuple) void GetSize(int *OUTPUT, int *OUTPUT); -#ifdef __WXMSW__ wxSize GetSize(); -#endif void GetTextExtent(const wxString& string, int *OUTPUT, int *OUTPUT); // int* descent = NULL, int* externalLeading = NULL, const wxFont* font = NULL, bool use16 = FALSE) wxString GetTitle(); long GetWindowStyleFlag(); @@ -188,9 +167,7 @@ public: bool TransferDataFromWindow(); bool TransferDataToWindow(); bool Validate(); -#ifdef __WXMSW__ void WarpPointer(int x, int y); -#endif %name(ConvertDialogPointToPixels) wxPoint ConvertDialogToPixels(const wxPoint& pt); %name(ConvertDialogSizeToPixels) wxSize ConvertDialogToPixels(const wxSize& sz); @@ -303,10 +280,8 @@ public: void Check(int id, bool flag); void Enable(int id, bool enable); int FindItem(const wxString& itemString); -#ifdef __WXMSW__ wxString GetTitle(); void SetTitle(const wxString& title); -#endif wxMenuItem* FindItemForId(int id); wxString GetHelpString(int id); wxString GetLabel(int id); @@ -340,11 +315,8 @@ public: void Enable(int id, bool enable); bool Enabled(int id); int FindMenuItem(const wxString& menuString, const wxString& itemString); -#ifdef __WXGTK__ - %name(FindItemForId) wxMenuItem* FindMenuItemById( int id ); -#endif -#ifdef __WXMSW__ wxMenuItem * FindItemForId(int id); +#ifdef __WXMSW__ void EnableTop(int pos, bool enable); wxString GetHelpString(int id); wxString GetLabel(int id); @@ -368,22 +340,27 @@ public: bool IsCheckable(); int GetId(); wxMenu* GetSubMenu(); -#ifdef __WXMSW__ void SetName(const wxString& strName); - void DeleteSubMenu(); const wxString& GetName(); -#endif const wxString& GetHelp(); void SetHelp(const wxString& strHelp); void Enable(bool bDoEnable = TRUE); void Check(bool bDoCheck = TRUE); + +#ifdef __WXMSW__ + void DeleteSubMenu(); +#endif }; //--------------------------------------------------------------------------- ///////////////////////////////////////////////////////////////////////////// // // $Log$ +// Revision 1.9 1998/12/17 14:07:46 RR +// Removed minor differences between wxMSW and wxGTK +// // Revision 1.8 1998/12/16 22:10:56 RD +// // Tweaks needed to be able to build wxPython with wxGTK. // // Revision 1.7 1998/12/15 20:41:25 RD