From ec758a20a2b166b2073e1c902cc745db01290f02 Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Tue, 1 Dec 1998 12:55:09 +0000 Subject: [PATCH] New wxDC hierarchy wxTE_PASWORD git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1092 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/gtk/dcclient.h | 148 ++++++++++++-------- include/wx/gtk/dcmemory.h | 20 +-- include/wx/gtk/dcscreen.h | 2 +- include/wx/gtk1/dcclient.h | 148 ++++++++++++-------- include/wx/gtk1/dcmemory.h | 20 +-- include/wx/gtk1/dcscreen.h | 2 +- src/gtk/accel.cpp | 57 ++++---- src/gtk/app.cpp | 276 ++++++++++++++++++------------------- src/gtk/dcclient.cpp | 124 +++++++++++------ src/gtk/dcmemory.cpp | 7 +- src/gtk/textctrl.cpp | 18 ++- src/gtk1/accel.cpp | 57 ++++---- src/gtk1/app.cpp | 276 ++++++++++++++++++------------------- src/gtk1/dcclient.cpp | 124 +++++++++++------ src/gtk1/dcmemory.cpp | 7 +- src/gtk1/textctrl.cpp | 18 ++- 16 files changed, 724 insertions(+), 580 deletions(-) diff --git a/include/wx/gtk/dcclient.h b/include/wx/gtk/dcclient.h index 2797a151cf..ab0a9187f0 100644 --- a/include/wx/gtk/dcclient.h +++ b/include/wx/gtk/dcclient.h @@ -22,88 +22,114 @@ // classes //----------------------------------------------------------------------------- +class wxWindowDC; class wxPaintDC; -typedef wxPaintDC wxClientDC; -typedef wxPaintDC wxWindowDC; +class wxClientDC; //----------------------------------------------------------------------------- -// wxPaintDC +// wxWindowDC //----------------------------------------------------------------------------- -class wxPaintDC: public wxDC +class wxWindowDC: public wxDC { - DECLARE_DYNAMIC_CLASS(wxPaintDC) - - public: + DECLARE_DYNAMIC_CLASS(wxWindowDC) - wxPaintDC(void); - wxPaintDC( wxWindow *win ); +public: + wxWindowDC(void); + wxWindowDC( wxWindow *win ); - ~wxPaintDC(void); + ~wxWindowDC(void); - virtual void FloodFill( long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE ); - virtual bool GetPixel( long x1, long y1, wxColour *col ) const; - - virtual void DrawLine( long x1, long y1, long x2, long y2 ); - virtual void CrossHair( long x, long y ); - virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); - virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); - virtual void DrawPoint( long x, long y ); + virtual void FloodFill( long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE ); + virtual bool GetPixel( long x1, long y1, wxColour *col ) const; + + virtual void DrawLine( long x1, long y1, long x2, long y2 ); + virtual void CrossHair( long x, long y ); + virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); + virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); + virtual void DrawPoint( long x, long y ); - virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); - virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); - virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, - int fillStyle=wxODDEVEN_RULE ); - virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, - int fillStyle=wxODDEVEN_RULE ); + virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); + virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); + virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, + int fillStyle=wxODDEVEN_RULE ); + virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, + int fillStyle=wxODDEVEN_RULE ); - virtual void DrawRectangle( long x, long y, long width, long height ); - virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); - virtual void DrawEllipse( long x, long y, long width, long height ); + virtual void DrawRectangle( long x, long y, long width, long height ); + virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); + virtual void DrawEllipse( long x, long y, long width, long height ); - virtual bool CanDrawBitmap(void) const; - virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); - virtual bool Blit( long xdest, long ydest, long width, long height, - wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ); - - virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ); - virtual bool CanGetTextExtent(void) const; - virtual void GetTextExtent( const wxString &string, long *width, long *height, + virtual bool CanDrawBitmap(void) const; + virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); + virtual bool Blit( long xdest, long ydest, long width, long height, + wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ); + + virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ); + virtual bool CanGetTextExtent(void) const; + virtual void GetTextExtent( const wxString &string, long *width, long *height, long *descent = (long *) NULL, long *externalLeading = (long *) NULL, wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE ); - virtual long GetCharWidth(void); - virtual long GetCharHeight(void); + virtual long GetCharWidth(void); + virtual long GetCharHeight(void); - virtual void Clear(void); + virtual void Clear(void); - virtual void SetFont( const wxFont &font ); - virtual void SetPen( const wxPen &pen ); - virtual void SetBrush( const wxBrush &brush ); - virtual void SetBackground( const wxBrush &brush ); - virtual void SetLogicalFunction( int function ); - virtual void SetTextForeground( const wxColour &col ); - virtual void SetTextBackground( const wxColour &col ); - virtual void SetBackgroundMode( int mode ); - virtual void SetPalette( const wxPalette& palette ); + virtual void SetFont( const wxFont &font ); + virtual void SetPen( const wxPen &pen ); + virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); + virtual void SetLogicalFunction( int function ); + virtual void SetTextForeground( const wxColour &col ); + virtual void SetTextBackground( const wxColour &col ); + virtual void SetBackgroundMode( int mode ); + virtual void SetPalette( const wxPalette& palette ); - virtual void SetClippingRegion( long x, long y, long width, long height ); - virtual void DestroyClippingRegion(void); + virtual void SetClippingRegion( long x, long y, long width, long height ); + virtual void DestroyClippingRegion(void); - virtual void DrawSpline( wxList *points ); + virtual void DrawSpline( wxList *points ); - public: // shouldn't be public + // implementation - GdkWindow *m_window; - GdkGC *m_penGC; - GdkGC *m_brushGC; - GdkGC *m_textGC; - GdkGC *m_bgGC; - GdkColormap *m_cmap; - bool m_isMemDC; + GdkWindow *m_window; + GdkGC *m_penGC; + GdkGC *m_brushGC; + GdkGC *m_textGC; + GdkGC *m_bgGC; + GdkColormap *m_cmap; + bool m_isMemDC; - void SetUpDC(void); - void Destroy(void); - GdkWindow *GetWindow(void); + void SetUpDC(void); + void Destroy(void); + GdkWindow *GetWindow(void); +}; + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +class wxPaintDC : public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxPaintDC) + +public: + wxPaintDC(void); + wxPaintDC( wxWindow *win ); }; +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +class wxClientDC : public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxClientDC) + +public: + wxClientDC(void); + wxClientDC( wxWindow *win ); +}; + + #endif // __GTKDCCLIENTH__ diff --git a/include/wx/gtk/dcmemory.h b/include/wx/gtk/dcmemory.h index be4a0ffa42..632afa38ec 100644 --- a/include/wx/gtk/dcmemory.h +++ b/include/wx/gtk/dcmemory.h @@ -28,20 +28,20 @@ class wxMemoryDC; // wxMemoryDC //----------------------------------------------------------------------------- -class wxMemoryDC: public wxPaintDC +class wxMemoryDC: public wxWindowDC { DECLARE_DYNAMIC_CLASS(wxMemoryDC) - public: - wxMemoryDC(void); - wxMemoryDC( wxDC *dc ); // Create compatible DC - ~wxMemoryDC(void); - virtual void SelectObject( const wxBitmap& bitmap ); - void GetSize( int *width, int *height ) const; +public: + wxMemoryDC(void); + wxMemoryDC( wxDC *dc ); // Create compatible DC + ~wxMemoryDC(void); + virtual void SelectObject( const wxBitmap& bitmap ); + void GetSize( int *width, int *height ) const; - private: - friend wxPaintDC; - wxBitmap m_selected; + // implementation + + wxBitmap m_selected; }; #endif diff --git a/include/wx/gtk/dcscreen.h b/include/wx/gtk/dcscreen.h index c0136643c0..c2be00de89 100644 --- a/include/wx/gtk/dcscreen.h +++ b/include/wx/gtk/dcscreen.h @@ -26,7 +26,7 @@ class wxScreenDC: public wxPaintDC { DECLARE_DYNAMIC_CLASS(wxScreenDC) - public: +public: wxScreenDC(void); ~wxScreenDC(void); diff --git a/include/wx/gtk1/dcclient.h b/include/wx/gtk1/dcclient.h index 2797a151cf..ab0a9187f0 100644 --- a/include/wx/gtk1/dcclient.h +++ b/include/wx/gtk1/dcclient.h @@ -22,88 +22,114 @@ // classes //----------------------------------------------------------------------------- +class wxWindowDC; class wxPaintDC; -typedef wxPaintDC wxClientDC; -typedef wxPaintDC wxWindowDC; +class wxClientDC; //----------------------------------------------------------------------------- -// wxPaintDC +// wxWindowDC //----------------------------------------------------------------------------- -class wxPaintDC: public wxDC +class wxWindowDC: public wxDC { - DECLARE_DYNAMIC_CLASS(wxPaintDC) - - public: + DECLARE_DYNAMIC_CLASS(wxWindowDC) - wxPaintDC(void); - wxPaintDC( wxWindow *win ); +public: + wxWindowDC(void); + wxWindowDC( wxWindow *win ); - ~wxPaintDC(void); + ~wxWindowDC(void); - virtual void FloodFill( long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE ); - virtual bool GetPixel( long x1, long y1, wxColour *col ) const; - - virtual void DrawLine( long x1, long y1, long x2, long y2 ); - virtual void CrossHair( long x, long y ); - virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); - virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); - virtual void DrawPoint( long x, long y ); + virtual void FloodFill( long x1, long y1, wxColour *col, int style=wxFLOOD_SURFACE ); + virtual bool GetPixel( long x1, long y1, wxColour *col ) const; + + virtual void DrawLine( long x1, long y1, long x2, long y2 ); + virtual void CrossHair( long x, long y ); + virtual void DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ); + virtual void DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ); + virtual void DrawPoint( long x, long y ); - virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); - virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); - virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, - int fillStyle=wxODDEVEN_RULE ); - virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, - int fillStyle=wxODDEVEN_RULE ); + virtual void DrawLines( int n, wxPoint points[], long xoffset = 0, long yoffset = 0 ); + virtual void DrawLines( wxList *points, long xoffset = 0, long yoffset = 0 ); + virtual void DrawPolygon( int n, wxPoint points[], long xoffset = 0, long yoffset = 0, + int fillStyle=wxODDEVEN_RULE ); + virtual void DrawPolygon( wxList *lines, long xoffset = 0, long yoffset = 0, + int fillStyle=wxODDEVEN_RULE ); - virtual void DrawRectangle( long x, long y, long width, long height ); - virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); - virtual void DrawEllipse( long x, long y, long width, long height ); + virtual void DrawRectangle( long x, long y, long width, long height ); + virtual void DrawRoundedRectangle( long x, long y, long width, long height, double radius = 20.0 ); + virtual void DrawEllipse( long x, long y, long width, long height ); - virtual bool CanDrawBitmap(void) const; - virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); - virtual bool Blit( long xdest, long ydest, long width, long height, - wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ); - - virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ); - virtual bool CanGetTextExtent(void) const; - virtual void GetTextExtent( const wxString &string, long *width, long *height, + virtual bool CanDrawBitmap(void) const; + virtual void DrawIcon( const wxIcon &icon, long x, long y, bool useMask=FALSE ); + virtual bool Blit( long xdest, long ydest, long width, long height, + wxDC *source, long xsrc, long ysrc, int logical_func = wxCOPY, bool useMask=FALSE ); + + virtual void DrawText( const wxString &text, long x, long y, bool use16 = FALSE ); + virtual bool CanGetTextExtent(void) const; + virtual void GetTextExtent( const wxString &string, long *width, long *height, long *descent = (long *) NULL, long *externalLeading = (long *) NULL, wxFont *theFont = (wxFont *) NULL, bool use16 = FALSE ); - virtual long GetCharWidth(void); - virtual long GetCharHeight(void); + virtual long GetCharWidth(void); + virtual long GetCharHeight(void); - virtual void Clear(void); + virtual void Clear(void); - virtual void SetFont( const wxFont &font ); - virtual void SetPen( const wxPen &pen ); - virtual void SetBrush( const wxBrush &brush ); - virtual void SetBackground( const wxBrush &brush ); - virtual void SetLogicalFunction( int function ); - virtual void SetTextForeground( const wxColour &col ); - virtual void SetTextBackground( const wxColour &col ); - virtual void SetBackgroundMode( int mode ); - virtual void SetPalette( const wxPalette& palette ); + virtual void SetFont( const wxFont &font ); + virtual void SetPen( const wxPen &pen ); + virtual void SetBrush( const wxBrush &brush ); + virtual void SetBackground( const wxBrush &brush ); + virtual void SetLogicalFunction( int function ); + virtual void SetTextForeground( const wxColour &col ); + virtual void SetTextBackground( const wxColour &col ); + virtual void SetBackgroundMode( int mode ); + virtual void SetPalette( const wxPalette& palette ); - virtual void SetClippingRegion( long x, long y, long width, long height ); - virtual void DestroyClippingRegion(void); + virtual void SetClippingRegion( long x, long y, long width, long height ); + virtual void DestroyClippingRegion(void); - virtual void DrawSpline( wxList *points ); + virtual void DrawSpline( wxList *points ); - public: // shouldn't be public + // implementation - GdkWindow *m_window; - GdkGC *m_penGC; - GdkGC *m_brushGC; - GdkGC *m_textGC; - GdkGC *m_bgGC; - GdkColormap *m_cmap; - bool m_isMemDC; + GdkWindow *m_window; + GdkGC *m_penGC; + GdkGC *m_brushGC; + GdkGC *m_textGC; + GdkGC *m_bgGC; + GdkColormap *m_cmap; + bool m_isMemDC; - void SetUpDC(void); - void Destroy(void); - GdkWindow *GetWindow(void); + void SetUpDC(void); + void Destroy(void); + GdkWindow *GetWindow(void); +}; + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +class wxPaintDC : public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxPaintDC) + +public: + wxPaintDC(void); + wxPaintDC( wxWindow *win ); }; +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +class wxClientDC : public wxWindowDC +{ + DECLARE_DYNAMIC_CLASS(wxClientDC) + +public: + wxClientDC(void); + wxClientDC( wxWindow *win ); +}; + + #endif // __GTKDCCLIENTH__ diff --git a/include/wx/gtk1/dcmemory.h b/include/wx/gtk1/dcmemory.h index be4a0ffa42..632afa38ec 100644 --- a/include/wx/gtk1/dcmemory.h +++ b/include/wx/gtk1/dcmemory.h @@ -28,20 +28,20 @@ class wxMemoryDC; // wxMemoryDC //----------------------------------------------------------------------------- -class wxMemoryDC: public wxPaintDC +class wxMemoryDC: public wxWindowDC { DECLARE_DYNAMIC_CLASS(wxMemoryDC) - public: - wxMemoryDC(void); - wxMemoryDC( wxDC *dc ); // Create compatible DC - ~wxMemoryDC(void); - virtual void SelectObject( const wxBitmap& bitmap ); - void GetSize( int *width, int *height ) const; +public: + wxMemoryDC(void); + wxMemoryDC( wxDC *dc ); // Create compatible DC + ~wxMemoryDC(void); + virtual void SelectObject( const wxBitmap& bitmap ); + void GetSize( int *width, int *height ) const; - private: - friend wxPaintDC; - wxBitmap m_selected; + // implementation + + wxBitmap m_selected; }; #endif diff --git a/include/wx/gtk1/dcscreen.h b/include/wx/gtk1/dcscreen.h index c0136643c0..c2be00de89 100644 --- a/include/wx/gtk1/dcscreen.h +++ b/include/wx/gtk1/dcscreen.h @@ -26,7 +26,7 @@ class wxScreenDC: public wxPaintDC { DECLARE_DYNAMIC_CLASS(wxScreenDC) - public: +public: wxScreenDC(void); ~wxScreenDC(void); diff --git a/src/gtk/accel.cpp b/src/gtk/accel.cpp index e101decc7d..3a3d479635 100644 --- a/src/gtk/accel.cpp +++ b/src/gtk/accel.cpp @@ -21,16 +21,16 @@ class wxAccelRefData: public wxObjectRefData { - public: +public: - wxAccelRefData(void); + wxAccelRefData(void); - wxList m_accels; + wxList m_accels; }; wxAccelRefData::wxAccelRefData(void) { - m_accels.DeleteContents( TRUE ); + m_accels.DeleteContents( TRUE ); } //----------------------------------------------------------------------------- @@ -45,15 +45,16 @@ wxAcceleratorTable::wxAcceleratorTable() wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) { - m_refData = new wxAccelRefData(); - for (int i = 0; i < n; i++) - { - int flag = entries[i].GetFlags(); - int keycode = entries[i].GetKeyCode(); - int command = entries[i].GetCommand(); - if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); - M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); - } + m_refData = new wxAccelRefData(); + + for (int i = 0; i < n; i++) + { + int flag = entries[i].GetFlags(); + int keycode = entries[i].GetKeyCode(); + int command = entries[i].GetCommand(); + if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); + M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); + } } wxAcceleratorTable::~wxAcceleratorTable() @@ -62,25 +63,27 @@ wxAcceleratorTable::~wxAcceleratorTable() bool wxAcceleratorTable::Ok() const { - return (m_refData != NULL); + return (m_refData != NULL); } int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) { - if (!Ok()) return -1; + if (!Ok()) return -1; - wxNode *node = M_ACCELDATA->m_accels.First(); - while (node) - { - wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data(); - if ((event.m_keyCode == entry->GetKeyCode()) && - (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) && - (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) && - (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown())) - return entry->GetCommand(); - node = node->Next(); - } + wxNode *node = M_ACCELDATA->m_accels.First(); + while (node) + { + wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data(); + if ((event.m_keyCode == entry->GetKeyCode()) && + (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) && + (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) && + (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown())) + { + return entry->GetCommand(); + } + node = node->Next(); + } - return -1; + return -1; } diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 05395a5b46..631a12eff8 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -114,13 +114,13 @@ extern void wxFlushResources(void); void wxExit(void) { - gtk_main_quit(); + gtk_main_quit(); } bool wxYield(void) { - while (gtk_events_pending() > 0) gtk_main_iteration(); - return TRUE; + while (gtk_events_pending() > 0) gtk_main_iteration(); + return TRUE; } //----------------------------------------------------------------------------- @@ -135,88 +135,88 @@ END_EVENT_TABLE() gint wxapp_idle_callback( gpointer WXUNUSED(data) ) { - if (wxTheApp) while (wxTheApp->ProcessIdle()) {} - usleep( 10000 ); - return TRUE; + if (wxTheApp) while (wxTheApp->ProcessIdle()) {} + usleep( 10000 ); + return TRUE; } wxApp::wxApp() { - m_idleTag = 0; - m_topWindow = (wxWindow *) NULL; - m_exitOnFrameDelete = TRUE; - wxTheApp = this; + m_idleTag = 0; + m_topWindow = (wxWindow *) NULL; + m_exitOnFrameDelete = TRUE; + wxTheApp = this; } wxApp::~wxApp(void) { - gtk_idle_remove( m_idleTag ); + gtk_idle_remove( m_idleTag ); } bool wxApp::OnInit(void) { - return TRUE; + return TRUE; } bool wxApp::OnInitGui(void) { - m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); - return TRUE; + m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); + return TRUE; } int wxApp::OnRun(void) { - return MainLoop(); + return MainLoop(); } bool wxApp::ProcessIdle(void) { - wxIdleEvent event; - event.SetEventObject( this ); - ProcessEvent( event ); + wxIdleEvent event; + event.SetEventObject( this ); + ProcessEvent( event ); - return event.MoreRequested(); + return event.MoreRequested(); } void wxApp::OnIdle( wxIdleEvent &event ) { - static bool inOnIdle = FALSE; + static bool inOnIdle = FALSE; - // Avoid recursion (via ProcessEvent default case) - if (inOnIdle) - return; + // Avoid recursion (via ProcessEvent default case) + if (inOnIdle) + return; - inOnIdle = TRUE; + inOnIdle = TRUE; - // 'Garbage' collection of windows deleted with Close(). - DeletePendingObjects(); + // 'Garbage' collection of windows deleted with Close(). + DeletePendingObjects(); - // flush the logged messages if any - wxLog *pLog = wxLog::GetActiveTarget(); - if ( pLog != NULL && pLog->HasPendingMessages() ) - pLog->Flush(); + // flush the logged messages if any + wxLog *pLog = wxLog::GetActiveTarget(); + if (pLog != NULL && pLog->HasPendingMessages()) + pLog->Flush(); - // Send OnIdle events to all windows - bool needMore = SendIdleEvents(); + // Send OnIdle events to all windows + bool needMore = SendIdleEvents(); - if (needMore) - event.RequestMore(TRUE); + if (needMore) + event.RequestMore(TRUE); - inOnIdle = FALSE; + inOnIdle = FALSE; } bool wxApp::SendIdleEvents(void) { bool needMore = FALSE; - wxNode* node = wxTopLevelWindows.First(); - while (node) - { - wxWindow* win = (wxWindow*) node->Data(); - if (SendIdleEvents(win)) + + wxNode* node = wxTopLevelWindows.First(); + while (node) + { + wxWindow* win = (wxWindow*) node->Data(); + if (SendIdleEvents(win)) needMore = TRUE; - - node = node->Next(); - } + node = node->Next(); + } return needMore; } @@ -245,28 +245,28 @@ bool wxApp::SendIdleEvents( wxWindow* win ) int wxApp::OnExit(void) { - return 0; + return 0; } int wxApp::MainLoop(void) { - gtk_main(); - return 0; + gtk_main(); + return 0; } void wxApp::ExitMainLoop(void) { - gtk_main_quit(); + gtk_main_quit(); } bool wxApp::Initialized(void) { - return m_initialized; + return m_initialized; } bool wxApp::Pending(void) { - return FALSE; + return FALSE; } void wxApp::Dispatch(void) @@ -275,31 +275,31 @@ void wxApp::Dispatch(void) void wxApp::DeletePendingObjects(void) { - wxNode *node = wxPendingDelete.First(); - while (node) - { - wxObject *obj = (wxObject *)node->Data(); + wxNode *node = wxPendingDelete.First(); + while (node) + { + wxObject *obj = (wxObject *)node->Data(); - delete obj; + delete obj; - if (wxPendingDelete.Member(obj)) - delete node; + if (wxPendingDelete.Member(obj)) + delete node; - node = wxPendingDelete.First(); - } + node = wxPendingDelete.First(); + } } wxWindow *wxApp::GetTopWindow(void) { - if (m_topWindow) return m_topWindow; - wxNode *node = wxTopLevelWindows.First(); - if (!node) return (wxWindow *) NULL; - return (wxWindow*)node->Data(); + if (m_topWindow) return m_topWindow; + wxNode *node = wxTopLevelWindows.First(); + if (!node) return (wxWindow *) NULL; + return (wxWindow*)node->Data(); } void wxApp::SetTopWindow( wxWindow *win ) { - m_topWindow = win; + m_topWindow = win; } void wxApp::CommonInit(void) @@ -331,21 +331,21 @@ void wxApp::CommonInit(void) void wxApp::CommonCleanUp(void) { - wxDELETE(wxTheColourDatabase); - wxDELETE(wxTheFontNameDirectory); - wxDeleteStockObjects(); + wxDELETE(wxTheColourDatabase); + wxDELETE(wxTheFontNameDirectory); + wxDeleteStockObjects(); - wxFlushResources(); + wxFlushResources(); - wxDELETE(wxTheResourceCache); + wxDELETE(wxTheResourceCache); - wxDeleteStockLists(); + wxDeleteStockLists(); - wxCleanUpResourceSystem(); + wxCleanUpResourceSystem(); - wxImage::CleanUpHandlers(); + wxImage::CleanUpHandlers(); - wxSystemSettings::Done(); + wxSystemSettings::Done(); } wxLog *wxApp::CreateLogTarget() @@ -359,9 +359,9 @@ wxLog *wxApp::CreateLogTarget() int wxEntry( int argc, char *argv[] ) { - wxBuffer = new char[BUFSIZ + 512]; + wxBuffer = new char[BUFSIZ + 512]; - wxClassInfo::InitializeClasses(); + wxClassInfo::InitializeClasses(); /* Debug stream no longer used #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT @@ -372,107 +372,107 @@ int wxEntry( int argc, char *argv[] ) #endif */ - if (!wxTheApp) - { - if (!wxApp::GetInitializerFunction()) + if (!wxTheApp) { - printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); - return 0; - } + if (!wxApp::GetInitializerFunction()) + { + printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); + return 0; + } - wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); + wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); - wxObject *test_app = app_ini(); + wxObject *test_app = app_ini(); - wxTheApp = (wxApp*) test_app; - } + wxTheApp = (wxApp*) test_app; + } - if (!wxTheApp) - { - printf( "wxWindows error: wxTheApp == NULL\n" ); - return 0; - } + if (!wxTheApp) + { + printf( "wxWindows error: wxTheApp == NULL\n" ); + return 0; + } - wxTheApp->argc = argc; - wxTheApp->argv = argv; + wxTheApp->argc = argc; + wxTheApp->argv = argv; - char name[200]; - strcpy( name, argv[0] ); - strcpy( name, wxFileNameFromPath(name) ); - wxStripExtension( name ); - wxTheApp->SetAppName( name ); + char name[200]; + strcpy( name, argv[0] ); + strcpy( name, wxFileNameFromPath(name) ); + wxStripExtension( name ); + wxTheApp->SetAppName( name ); - gtk_set_locale(); + gtk_set_locale(); - gtk_init( &argc, &argv ); + gtk_init( &argc, &argv ); - GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); + GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); - for (int i = 0; i < 64; i++) - { - GdkColor col; - col.red = g_palette[i*3 + 0] << 8; - col.green = g_palette[i*3 + 1] << 8; - col.blue = g_palette[i*3 + 2] << 8; - col.pixel = 0; + for (int i = 0; i < 64; i++) + { + GdkColor col; + col.red = g_palette[i*3 + 0] << 8; + col.green = g_palette[i*3 + 1] << 8; + col.blue = g_palette[i*3 + 2] << 8; + col.pixel = 0; - gdk_color_alloc( cmap, &col ); - } + gdk_color_alloc( cmap, &col ); + } - gtk_widget_push_colormap( cmap ); + gtk_widget_push_colormap( cmap ); - gtk_widget_set_default_colormap( cmap ); + gtk_widget_set_default_colormap( cmap ); - wxApp::CommonInit(); + wxApp::CommonInit(); - wxModule::RegisterModules(); - if (!wxModule::InitializeModules()) return FALSE; + wxModule::RegisterModules(); + if (!wxModule::InitializeModules()) return FALSE; - wxTheApp->OnInitGui(); + wxTheApp->OnInitGui(); - // Here frames insert themselves automatically - // into wxTopLevelWindows by getting created - // in OnInit(). + // Here frames insert themselves automatically + // into wxTopLevelWindows by getting created + // in OnInit(). - if (!wxTheApp->OnInit()) return 0; + if (!wxTheApp->OnInit()) return 0; - wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); + wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); - int retValue = 0; + int retValue = 0; - if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun(); + if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun(); - wxTheApp->DeletePendingObjects(); + wxTheApp->DeletePendingObjects(); - wxTheApp->OnExit(); + wxTheApp->OnExit(); - wxModule::CleanUpModules(); + wxModule::CleanUpModules(); - wxApp::CommonCleanUp(); + wxApp::CommonCleanUp(); - wxDELETE(wxTheApp); + delete wxTheApp; + wxTheApp = (wxApp*) NULL; - wxClassInfo::CleanUpClasses(); + wxClassInfo::CleanUpClasses(); - delete[] wxBuffer; + delete[] wxBuffer; #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - if (wxDebugContext::CountObjectsLeft() > 0) - { - wxLogDebug("There were memory leaks.\n"); - wxDebugContext::Dump(); - wxDebugContext::PrintStatistics(); - } + if (wxDebugContext::CountObjectsLeft() > 0) + { + wxLogDebug("There were memory leaks.\n"); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + } // wxDebugContext::SetStream(NULL, NULL); #endif - wxLog *oldLog = wxLog::SetActiveTarget( NULL ); - if (oldLog) delete oldLog; - + wxLog *oldLog = wxLog::SetActiveTarget( NULL ); + if (oldLog) delete oldLog; - return retValue; + return retValue; } //----------------------------------------------------------------------------- diff --git a/src/gtk/dcclient.cpp b/src/gtk/dcclient.cpp index 4b5197c1e3..421da6660e 100644 --- a/src/gtk/dcclient.cpp +++ b/src/gtk/dcclient.cpp @@ -79,12 +79,12 @@ void gdk_draw_bitmap (GdkDrawable *drawable, } //----------------------------------------------------------------------------- -// wxPaintDC +// wxWindowDC //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxWindowDC,wxDC) -wxPaintDC::wxPaintDC(void) +wxWindowDC::wxWindowDC(void) { m_penGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL; @@ -94,7 +94,7 @@ wxPaintDC::wxPaintDC(void) m_isMemDC = FALSE; } -wxPaintDC::wxPaintDC( wxWindow *window ) +wxWindowDC::wxWindowDC( wxWindow *window ) { m_penGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL; @@ -125,24 +125,24 @@ wxPaintDC::wxPaintDC( wxWindow *window ) gdk_gc_set_clip_region( m_bgGC, update.GetRegion() ); } -wxPaintDC::~wxPaintDC(void) +wxWindowDC::~wxWindowDC(void) { Destroy(); } -void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), +void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col), int WXUNUSED(style) ) { - wxFAIL_MSG( "wxPaintDC::FloodFill not implemented" ); + wxFAIL_MSG( "wxWindowDC::FloodFill not implemented" ); } -bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const +bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const { - wxFAIL_MSG( "wxPaintDC::GetPixel not implemented" ); + wxFAIL_MSG( "wxWindowDC::GetPixel not implemented" ); return FALSE; } -void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 ) +void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 ) { if (!Ok()) return; @@ -156,7 +156,7 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 ) CalcBoundingBox(x2, y2); } -void wxPaintDC::CrossHair( long x, long y ) +void wxWindowDC::CrossHair( long x, long y ) { if (!Ok()) return; @@ -172,7 +172,7 @@ void wxPaintDC::CrossHair( long x, long y ) } } -void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ) +void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ) { if (!Ok()) return; @@ -222,7 +222,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y CalcBoundingBox (x2, y2); } -void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) +void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) { if (!Ok()) return; @@ -247,7 +247,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double CalcBoundingBox (x + width, y + height); } -void wxPaintDC::DrawPoint( long x, long y ) +void wxWindowDC::DrawPoint( long x, long y ) { if (!Ok()) return; @@ -257,7 +257,7 @@ void wxPaintDC::DrawPoint( long x, long y ) CalcBoundingBox (x, y); } -void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) +void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) { if (!Ok()) return; @@ -278,7 +278,7 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) } } -void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset ) +void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset ) { if (!Ok()) return; @@ -305,7 +305,7 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset ) } } -void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) ) +void wxWindowDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) ) { if (!Ok()) return; @@ -339,7 +339,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset delete[] gdkpoints; } -void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle)) +void wxWindowDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle)) { if (!Ok()) return; @@ -380,7 +380,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN delete[] gdkpoints; } -void wxPaintDC::DrawRectangle( long x, long y, long width, long height ) +void wxWindowDC::DrawRectangle( long x, long y, long width, long height ) { if (!Ok()) return; @@ -406,7 +406,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height ) CalcBoundingBox( x + width, y + height ); } -void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius ) +void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius ) { if (!Ok()) return; @@ -475,7 +475,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d CalcBoundingBox( x + width, y + height ); } -void wxPaintDC::DrawEllipse( long x, long y, long width, long height ) +void wxWindowDC::DrawEllipse( long x, long y, long width, long height ) { if (!Ok()) return; @@ -498,12 +498,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height ) CalcBoundingBox( x + width, y + height ); } -bool wxPaintDC::CanDrawBitmap(void) const +bool wxWindowDC::CanDrawBitmap(void) const { return TRUE; } -void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) +void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) { if (!Ok()) return; @@ -536,7 +536,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) CalcBoundingBox( x + width, y + height ); } -bool wxPaintDC::Blit( long xdest, long ydest, long width, long height, +bool wxWindowDC::Blit( long xdest, long ydest, long width, long height, wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask ) { if (!Ok()) return FALSE; @@ -633,7 +633,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height, return TRUE; } -void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) ) +void wxWindowDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) ) { if (!Ok()) return; @@ -670,12 +670,12 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us CalcBoundingBox (x, y); } -bool wxPaintDC::CanGetTextExtent(void) const +bool wxWindowDC::CanGetTextExtent(void) const { return TRUE; } -void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height, +void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height, long *descent, long *externalLeading, wxFont *theFont, bool WXUNUSED(use16) ) { @@ -691,7 +691,7 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height if (externalLeading) (*externalLeading) = 0; // ?? } -long wxPaintDC::GetCharWidth(void) +long wxWindowDC::GetCharWidth(void) { if (!Ok()) return 0; @@ -699,7 +699,7 @@ long wxPaintDC::GetCharWidth(void) return long(gdk_string_width( font, "H" ) / m_scaleX); } -long wxPaintDC::GetCharHeight(void) +long wxWindowDC::GetCharHeight(void) { if (!Ok()) return 0; @@ -707,7 +707,7 @@ long wxPaintDC::GetCharHeight(void) return long((font->ascent + font->descent) / m_scaleY); } -void wxPaintDC::Clear(void) +void wxWindowDC::Clear(void) { if (!Ok()) return; @@ -723,14 +723,14 @@ void wxPaintDC::Clear(void) } } -void wxPaintDC::SetFont( const wxFont &font ) +void wxWindowDC::SetFont( const wxFont &font ) { if (!Ok()) return; m_font = font; } -void wxPaintDC::SetPen( const wxPen &pen ) +void wxWindowDC::SetPen( const wxPen &pen ) { if (!Ok()) return; @@ -786,7 +786,7 @@ void wxPaintDC::SetPen( const wxPen &pen ) gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); } -void wxPaintDC::SetBrush( const wxBrush &brush ) +void wxWindowDC::SetBrush( const wxBrush &brush ) { if (!Ok()) return; @@ -825,7 +825,7 @@ void wxPaintDC::SetBrush( const wxBrush &brush ) // CMB 21/7/98: Added SetBackground. Sets background brush // for Clear() and bg colour for shapes filled with cross-hatch brush -void wxPaintDC::SetBackground( const wxBrush &brush ) +void wxWindowDC::SetBackground( const wxBrush &brush ) { if (!Ok()) return; @@ -865,7 +865,7 @@ void wxPaintDC::SetBackground( const wxBrush &brush ) } } -void wxPaintDC::SetLogicalFunction( int function ) +void wxWindowDC::SetLogicalFunction( int function ) { if (m_logicalFunction == function) return; GdkFunction mode = GDK_COPY; @@ -881,7 +881,7 @@ void wxPaintDC::SetLogicalFunction( int function ) gdk_gc_set_function( m_textGC, mode ); } -void wxPaintDC::SetTextForeground( const wxColour &col ) +void wxWindowDC::SetTextForeground( const wxColour &col ) { if (!Ok()) return; @@ -894,7 +894,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col ) gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() ); } -void wxPaintDC::SetTextBackground( const wxColour &col ) +void wxWindowDC::SetTextBackground( const wxColour &col ) { if (!Ok()) return; @@ -907,7 +907,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col ) gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); } -void wxPaintDC::SetBackgroundMode( int mode ) +void wxWindowDC::SetBackgroundMode( int mode ) { m_backgroundMode = mode; @@ -920,11 +920,11 @@ void wxPaintDC::SetBackgroundMode( int mode ) } } -void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) ) +void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) ) { } -void wxPaintDC::SetClippingRegion( long x, long y, long width, long height ) +void wxWindowDC::SetClippingRegion( long x, long y, long width, long height ) { wxDC::SetClippingRegion( x, y, width, height ); @@ -939,7 +939,7 @@ void wxPaintDC::SetClippingRegion( long x, long y, long width, long height ) gdk_gc_set_clip_rectangle( m_bgGC, &rect ); } -void wxPaintDC::DestroyClippingRegion(void) +void wxWindowDC::DestroyClippingRegion(void) { wxDC::DestroyClippingRegion(); @@ -949,7 +949,7 @@ void wxPaintDC::DestroyClippingRegion(void) gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL ); } -void wxPaintDC::SetUpDC(void) +void wxWindowDC::SetUpDC(void) { Destroy(); m_ok = TRUE; @@ -994,7 +994,7 @@ void wxPaintDC::SetUpDC(void) } } -void wxPaintDC::Destroy(void) +void wxWindowDC::Destroy(void) { if (m_penGC) gdk_gc_unref( m_penGC ); m_penGC = (GdkGC*) NULL; @@ -1006,7 +1006,7 @@ void wxPaintDC::Destroy(void) m_bgGC = (GdkGC*) NULL; } -GdkWindow *wxPaintDC::GetWindow(void) +GdkWindow *wxWindowDC::GetWindow(void) { return m_window; } @@ -1126,7 +1126,7 @@ static void wx_spline_draw_point_array(wxDC *dc) } } -void wxPaintDC::DrawSpline( wxList *points ) +void wxWindowDC::DrawSpline( wxList *points ) { wxPoint *p; double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; @@ -1175,3 +1175,37 @@ void wxPaintDC::DrawSpline( wxList *points ) wx_spline_draw_point_array( this ); } + + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxWindowDC) + +wxPaintDC::wxPaintDC(void) + : wxWindowDC() +{ +} + +wxPaintDC::wxPaintDC( wxWindow *win ) + : wxWindowDC( win ) +{ +} + +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxClientDC,wxWindowDC) + +wxClientDC::wxClientDC(void) + : wxWindowDC() +{ +} + +wxClientDC::wxClientDC( wxWindow *win ) + : wxWindowDC( win ) +{ +} + diff --git a/src/gtk/dcmemory.cpp b/src/gtk/dcmemory.cpp index 66f8772b98..c41cb02348 100644 --- a/src/gtk/dcmemory.cpp +++ b/src/gtk/dcmemory.cpp @@ -17,16 +17,17 @@ // wxMemoryDC //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) +IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC) -wxMemoryDC::wxMemoryDC(void) : wxPaintDC() +wxMemoryDC::wxMemoryDC(void) : wxWindowDC() { m_ok = FALSE; m_cmap = gtk_widget_get_default_colormap(); } -wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : wxPaintDC() +wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) + : wxWindowDC() { m_ok = FALSE; diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index e1dd7eafc6..e99ff0e8b7 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -71,8 +71,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, SetValidator( validator ); - bool bMultiLine = (style & wxTE_MULTILINE) != 0; - if ( bMultiLine ) + bool multi_line = (style & wxTE_MULTILINE) != 0; + if ( multi_line ) { // a multi-line edit control: create a vertical scrollbar by default and // horizontal if requested @@ -125,7 +125,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, PostCreation(); - if (bMultiLine) + if (multi_line) { gtk_widget_realize(m_text); gtk_widget_show(m_text); @@ -143,12 +143,20 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, SetInsertionPointEnd(); } - if (style & wxTE_READONLY) + if (style & wxTE_PASSWORD) { + if (!multi_line) + gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE ); + } + + if (style & wxTE_READONLY) + { + if (!multi_line) + gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE ); } else { - if (bMultiLine) + if (multi_line) gtk_text_set_editable( GTK_TEXT(m_text), 1 ); } diff --git a/src/gtk1/accel.cpp b/src/gtk1/accel.cpp index e101decc7d..3a3d479635 100644 --- a/src/gtk1/accel.cpp +++ b/src/gtk1/accel.cpp @@ -21,16 +21,16 @@ class wxAccelRefData: public wxObjectRefData { - public: +public: - wxAccelRefData(void); + wxAccelRefData(void); - wxList m_accels; + wxList m_accels; }; wxAccelRefData::wxAccelRefData(void) { - m_accels.DeleteContents( TRUE ); + m_accels.DeleteContents( TRUE ); } //----------------------------------------------------------------------------- @@ -45,15 +45,16 @@ wxAcceleratorTable::wxAcceleratorTable() wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) { - m_refData = new wxAccelRefData(); - for (int i = 0; i < n; i++) - { - int flag = entries[i].GetFlags(); - int keycode = entries[i].GetKeyCode(); - int command = entries[i].GetCommand(); - if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); - M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); - } + m_refData = new wxAccelRefData(); + + for (int i = 0; i < n; i++) + { + int flag = entries[i].GetFlags(); + int keycode = entries[i].GetKeyCode(); + int command = entries[i].GetCommand(); + if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); + M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); + } } wxAcceleratorTable::~wxAcceleratorTable() @@ -62,25 +63,27 @@ wxAcceleratorTable::~wxAcceleratorTable() bool wxAcceleratorTable::Ok() const { - return (m_refData != NULL); + return (m_refData != NULL); } int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) { - if (!Ok()) return -1; + if (!Ok()) return -1; - wxNode *node = M_ACCELDATA->m_accels.First(); - while (node) - { - wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data(); - if ((event.m_keyCode == entry->GetKeyCode()) && - (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) && - (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) && - (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown())) - return entry->GetCommand(); - node = node->Next(); - } + wxNode *node = M_ACCELDATA->m_accels.First(); + while (node) + { + wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data(); + if ((event.m_keyCode == entry->GetKeyCode()) && + (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) && + (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) && + (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown())) + { + return entry->GetCommand(); + } + node = node->Next(); + } - return -1; + return -1; } diff --git a/src/gtk1/app.cpp b/src/gtk1/app.cpp index 05395a5b46..631a12eff8 100644 --- a/src/gtk1/app.cpp +++ b/src/gtk1/app.cpp @@ -114,13 +114,13 @@ extern void wxFlushResources(void); void wxExit(void) { - gtk_main_quit(); + gtk_main_quit(); } bool wxYield(void) { - while (gtk_events_pending() > 0) gtk_main_iteration(); - return TRUE; + while (gtk_events_pending() > 0) gtk_main_iteration(); + return TRUE; } //----------------------------------------------------------------------------- @@ -135,88 +135,88 @@ END_EVENT_TABLE() gint wxapp_idle_callback( gpointer WXUNUSED(data) ) { - if (wxTheApp) while (wxTheApp->ProcessIdle()) {} - usleep( 10000 ); - return TRUE; + if (wxTheApp) while (wxTheApp->ProcessIdle()) {} + usleep( 10000 ); + return TRUE; } wxApp::wxApp() { - m_idleTag = 0; - m_topWindow = (wxWindow *) NULL; - m_exitOnFrameDelete = TRUE; - wxTheApp = this; + m_idleTag = 0; + m_topWindow = (wxWindow *) NULL; + m_exitOnFrameDelete = TRUE; + wxTheApp = this; } wxApp::~wxApp(void) { - gtk_idle_remove( m_idleTag ); + gtk_idle_remove( m_idleTag ); } bool wxApp::OnInit(void) { - return TRUE; + return TRUE; } bool wxApp::OnInitGui(void) { - m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); - return TRUE; + m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); + return TRUE; } int wxApp::OnRun(void) { - return MainLoop(); + return MainLoop(); } bool wxApp::ProcessIdle(void) { - wxIdleEvent event; - event.SetEventObject( this ); - ProcessEvent( event ); + wxIdleEvent event; + event.SetEventObject( this ); + ProcessEvent( event ); - return event.MoreRequested(); + return event.MoreRequested(); } void wxApp::OnIdle( wxIdleEvent &event ) { - static bool inOnIdle = FALSE; + static bool inOnIdle = FALSE; - // Avoid recursion (via ProcessEvent default case) - if (inOnIdle) - return; + // Avoid recursion (via ProcessEvent default case) + if (inOnIdle) + return; - inOnIdle = TRUE; + inOnIdle = TRUE; - // 'Garbage' collection of windows deleted with Close(). - DeletePendingObjects(); + // 'Garbage' collection of windows deleted with Close(). + DeletePendingObjects(); - // flush the logged messages if any - wxLog *pLog = wxLog::GetActiveTarget(); - if ( pLog != NULL && pLog->HasPendingMessages() ) - pLog->Flush(); + // flush the logged messages if any + wxLog *pLog = wxLog::GetActiveTarget(); + if (pLog != NULL && pLog->HasPendingMessages()) + pLog->Flush(); - // Send OnIdle events to all windows - bool needMore = SendIdleEvents(); + // Send OnIdle events to all windows + bool needMore = SendIdleEvents(); - if (needMore) - event.RequestMore(TRUE); + if (needMore) + event.RequestMore(TRUE); - inOnIdle = FALSE; + inOnIdle = FALSE; } bool wxApp::SendIdleEvents(void) { bool needMore = FALSE; - wxNode* node = wxTopLevelWindows.First(); - while (node) - { - wxWindow* win = (wxWindow*) node->Data(); - if (SendIdleEvents(win)) + + wxNode* node = wxTopLevelWindows.First(); + while (node) + { + wxWindow* win = (wxWindow*) node->Data(); + if (SendIdleEvents(win)) needMore = TRUE; - - node = node->Next(); - } + node = node->Next(); + } return needMore; } @@ -245,28 +245,28 @@ bool wxApp::SendIdleEvents( wxWindow* win ) int wxApp::OnExit(void) { - return 0; + return 0; } int wxApp::MainLoop(void) { - gtk_main(); - return 0; + gtk_main(); + return 0; } void wxApp::ExitMainLoop(void) { - gtk_main_quit(); + gtk_main_quit(); } bool wxApp::Initialized(void) { - return m_initialized; + return m_initialized; } bool wxApp::Pending(void) { - return FALSE; + return FALSE; } void wxApp::Dispatch(void) @@ -275,31 +275,31 @@ void wxApp::Dispatch(void) void wxApp::DeletePendingObjects(void) { - wxNode *node = wxPendingDelete.First(); - while (node) - { - wxObject *obj = (wxObject *)node->Data(); + wxNode *node = wxPendingDelete.First(); + while (node) + { + wxObject *obj = (wxObject *)node->Data(); - delete obj; + delete obj; - if (wxPendingDelete.Member(obj)) - delete node; + if (wxPendingDelete.Member(obj)) + delete node; - node = wxPendingDelete.First(); - } + node = wxPendingDelete.First(); + } } wxWindow *wxApp::GetTopWindow(void) { - if (m_topWindow) return m_topWindow; - wxNode *node = wxTopLevelWindows.First(); - if (!node) return (wxWindow *) NULL; - return (wxWindow*)node->Data(); + if (m_topWindow) return m_topWindow; + wxNode *node = wxTopLevelWindows.First(); + if (!node) return (wxWindow *) NULL; + return (wxWindow*)node->Data(); } void wxApp::SetTopWindow( wxWindow *win ) { - m_topWindow = win; + m_topWindow = win; } void wxApp::CommonInit(void) @@ -331,21 +331,21 @@ void wxApp::CommonInit(void) void wxApp::CommonCleanUp(void) { - wxDELETE(wxTheColourDatabase); - wxDELETE(wxTheFontNameDirectory); - wxDeleteStockObjects(); + wxDELETE(wxTheColourDatabase); + wxDELETE(wxTheFontNameDirectory); + wxDeleteStockObjects(); - wxFlushResources(); + wxFlushResources(); - wxDELETE(wxTheResourceCache); + wxDELETE(wxTheResourceCache); - wxDeleteStockLists(); + wxDeleteStockLists(); - wxCleanUpResourceSystem(); + wxCleanUpResourceSystem(); - wxImage::CleanUpHandlers(); + wxImage::CleanUpHandlers(); - wxSystemSettings::Done(); + wxSystemSettings::Done(); } wxLog *wxApp::CreateLogTarget() @@ -359,9 +359,9 @@ wxLog *wxApp::CreateLogTarget() int wxEntry( int argc, char *argv[] ) { - wxBuffer = new char[BUFSIZ + 512]; + wxBuffer = new char[BUFSIZ + 512]; - wxClassInfo::InitializeClasses(); + wxClassInfo::InitializeClasses(); /* Debug stream no longer used #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT @@ -372,107 +372,107 @@ int wxEntry( int argc, char *argv[] ) #endif */ - if (!wxTheApp) - { - if (!wxApp::GetInitializerFunction()) + if (!wxTheApp) { - printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); - return 0; - } + if (!wxApp::GetInitializerFunction()) + { + printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); + return 0; + } - wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); + wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); - wxObject *test_app = app_ini(); + wxObject *test_app = app_ini(); - wxTheApp = (wxApp*) test_app; - } + wxTheApp = (wxApp*) test_app; + } - if (!wxTheApp) - { - printf( "wxWindows error: wxTheApp == NULL\n" ); - return 0; - } + if (!wxTheApp) + { + printf( "wxWindows error: wxTheApp == NULL\n" ); + return 0; + } - wxTheApp->argc = argc; - wxTheApp->argv = argv; + wxTheApp->argc = argc; + wxTheApp->argv = argv; - char name[200]; - strcpy( name, argv[0] ); - strcpy( name, wxFileNameFromPath(name) ); - wxStripExtension( name ); - wxTheApp->SetAppName( name ); + char name[200]; + strcpy( name, argv[0] ); + strcpy( name, wxFileNameFromPath(name) ); + wxStripExtension( name ); + wxTheApp->SetAppName( name ); - gtk_set_locale(); + gtk_set_locale(); - gtk_init( &argc, &argv ); + gtk_init( &argc, &argv ); - GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); + GdkColormap *cmap = gdk_colormap_new( gdk_visual_get_system(), TRUE ); - for (int i = 0; i < 64; i++) - { - GdkColor col; - col.red = g_palette[i*3 + 0] << 8; - col.green = g_palette[i*3 + 1] << 8; - col.blue = g_palette[i*3 + 2] << 8; - col.pixel = 0; + for (int i = 0; i < 64; i++) + { + GdkColor col; + col.red = g_palette[i*3 + 0] << 8; + col.green = g_palette[i*3 + 1] << 8; + col.blue = g_palette[i*3 + 2] << 8; + col.pixel = 0; - gdk_color_alloc( cmap, &col ); - } + gdk_color_alloc( cmap, &col ); + } - gtk_widget_push_colormap( cmap ); + gtk_widget_push_colormap( cmap ); - gtk_widget_set_default_colormap( cmap ); + gtk_widget_set_default_colormap( cmap ); - wxApp::CommonInit(); + wxApp::CommonInit(); - wxModule::RegisterModules(); - if (!wxModule::InitializeModules()) return FALSE; + wxModule::RegisterModules(); + if (!wxModule::InitializeModules()) return FALSE; - wxTheApp->OnInitGui(); + wxTheApp->OnInitGui(); - // Here frames insert themselves automatically - // into wxTopLevelWindows by getting created - // in OnInit(). + // Here frames insert themselves automatically + // into wxTopLevelWindows by getting created + // in OnInit(). - if (!wxTheApp->OnInit()) return 0; + if (!wxTheApp->OnInit()) return 0; - wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); + wxTheApp->m_initialized = (wxTopLevelWindows.Number() > 0); - int retValue = 0; + int retValue = 0; - if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun(); + if (wxTheApp->Initialized()) retValue = wxTheApp->OnRun(); - wxTheApp->DeletePendingObjects(); + wxTheApp->DeletePendingObjects(); - wxTheApp->OnExit(); + wxTheApp->OnExit(); - wxModule::CleanUpModules(); + wxModule::CleanUpModules(); - wxApp::CommonCleanUp(); + wxApp::CommonCleanUp(); - wxDELETE(wxTheApp); + delete wxTheApp; + wxTheApp = (wxApp*) NULL; - wxClassInfo::CleanUpClasses(); + wxClassInfo::CleanUpClasses(); - delete[] wxBuffer; + delete[] wxBuffer; #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT - if (wxDebugContext::CountObjectsLeft() > 0) - { - wxLogDebug("There were memory leaks.\n"); - wxDebugContext::Dump(); - wxDebugContext::PrintStatistics(); - } + if (wxDebugContext::CountObjectsLeft() > 0) + { + wxLogDebug("There were memory leaks.\n"); + wxDebugContext::Dump(); + wxDebugContext::PrintStatistics(); + } // wxDebugContext::SetStream(NULL, NULL); #endif - wxLog *oldLog = wxLog::SetActiveTarget( NULL ); - if (oldLog) delete oldLog; - + wxLog *oldLog = wxLog::SetActiveTarget( NULL ); + if (oldLog) delete oldLog; - return retValue; + return retValue; } //----------------------------------------------------------------------------- diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index 4b5197c1e3..421da6660e 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -79,12 +79,12 @@ void gdk_draw_bitmap (GdkDrawable *drawable, } //----------------------------------------------------------------------------- -// wxPaintDC +// wxWindowDC //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxDC) +IMPLEMENT_DYNAMIC_CLASS(wxWindowDC,wxDC) -wxPaintDC::wxPaintDC(void) +wxWindowDC::wxWindowDC(void) { m_penGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL; @@ -94,7 +94,7 @@ wxPaintDC::wxPaintDC(void) m_isMemDC = FALSE; } -wxPaintDC::wxPaintDC( wxWindow *window ) +wxWindowDC::wxWindowDC( wxWindow *window ) { m_penGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL; @@ -125,24 +125,24 @@ wxPaintDC::wxPaintDC( wxWindow *window ) gdk_gc_set_clip_region( m_bgGC, update.GetRegion() ); } -wxPaintDC::~wxPaintDC(void) +wxWindowDC::~wxWindowDC(void) { Destroy(); } -void wxPaintDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), +void wxWindowDC::FloodFill( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col), int WXUNUSED(style) ) { - wxFAIL_MSG( "wxPaintDC::FloodFill not implemented" ); + wxFAIL_MSG( "wxWindowDC::FloodFill not implemented" ); } -bool wxPaintDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const +bool wxWindowDC::GetPixel( long WXUNUSED(x1), long WXUNUSED(y1), wxColour *WXUNUSED(col) ) const { - wxFAIL_MSG( "wxPaintDC::GetPixel not implemented" ); + wxFAIL_MSG( "wxWindowDC::GetPixel not implemented" ); return FALSE; } -void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 ) +void wxWindowDC::DrawLine( long x1, long y1, long x2, long y2 ) { if (!Ok()) return; @@ -156,7 +156,7 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 ) CalcBoundingBox(x2, y2); } -void wxPaintDC::CrossHair( long x, long y ) +void wxWindowDC::CrossHair( long x, long y ) { if (!Ok()) return; @@ -172,7 +172,7 @@ void wxPaintDC::CrossHair( long x, long y ) } } -void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ) +void wxWindowDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double yc ) { if (!Ok()) return; @@ -222,7 +222,7 @@ void wxPaintDC::DrawArc( long x1, long y1, long x2, long y2, double xc, double y CalcBoundingBox (x2, y2); } -void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) +void wxWindowDC::DrawEllipticArc( long x, long y, long width, long height, double sa, double ea ) { if (!Ok()) return; @@ -247,7 +247,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double CalcBoundingBox (x + width, y + height); } -void wxPaintDC::DrawPoint( long x, long y ) +void wxWindowDC::DrawPoint( long x, long y ) { if (!Ok()) return; @@ -257,7 +257,7 @@ void wxPaintDC::DrawPoint( long x, long y ) CalcBoundingBox (x, y); } -void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) +void wxWindowDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) { if (!Ok()) return; @@ -278,7 +278,7 @@ void wxPaintDC::DrawLines( int n, wxPoint points[], long xoffset, long yoffset ) } } -void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset ) +void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset ) { if (!Ok()) return; @@ -305,7 +305,7 @@ void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset ) } } -void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) ) +void wxWindowDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset, int WXUNUSED(fillStyle) ) { if (!Ok()) return; @@ -339,7 +339,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset delete[] gdkpoints; } -void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle)) +void wxWindowDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUNUSED(fillStyle)) { if (!Ok()) return; @@ -380,7 +380,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN delete[] gdkpoints; } -void wxPaintDC::DrawRectangle( long x, long y, long width, long height ) +void wxWindowDC::DrawRectangle( long x, long y, long width, long height ) { if (!Ok()) return; @@ -406,7 +406,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height ) CalcBoundingBox( x + width, y + height ); } -void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius ) +void wxWindowDC::DrawRoundedRectangle( long x, long y, long width, long height, double radius ) { if (!Ok()) return; @@ -475,7 +475,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d CalcBoundingBox( x + width, y + height ); } -void wxPaintDC::DrawEllipse( long x, long y, long width, long height ) +void wxWindowDC::DrawEllipse( long x, long y, long width, long height ) { if (!Ok()) return; @@ -498,12 +498,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height ) CalcBoundingBox( x + width, y + height ); } -bool wxPaintDC::CanDrawBitmap(void) const +bool wxWindowDC::CanDrawBitmap(void) const { return TRUE; } -void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) +void wxWindowDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) { if (!Ok()) return; @@ -536,7 +536,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask ) CalcBoundingBox( x + width, y + height ); } -bool wxPaintDC::Blit( long xdest, long ydest, long width, long height, +bool wxWindowDC::Blit( long xdest, long ydest, long width, long height, wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask ) { if (!Ok()) return FALSE; @@ -633,7 +633,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height, return TRUE; } -void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) ) +void wxWindowDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(use16) ) { if (!Ok()) return; @@ -670,12 +670,12 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us CalcBoundingBox (x, y); } -bool wxPaintDC::CanGetTextExtent(void) const +bool wxWindowDC::CanGetTextExtent(void) const { return TRUE; } -void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height, +void wxWindowDC::GetTextExtent( const wxString &string, long *width, long *height, long *descent, long *externalLeading, wxFont *theFont, bool WXUNUSED(use16) ) { @@ -691,7 +691,7 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height if (externalLeading) (*externalLeading) = 0; // ?? } -long wxPaintDC::GetCharWidth(void) +long wxWindowDC::GetCharWidth(void) { if (!Ok()) return 0; @@ -699,7 +699,7 @@ long wxPaintDC::GetCharWidth(void) return long(gdk_string_width( font, "H" ) / m_scaleX); } -long wxPaintDC::GetCharHeight(void) +long wxWindowDC::GetCharHeight(void) { if (!Ok()) return 0; @@ -707,7 +707,7 @@ long wxPaintDC::GetCharHeight(void) return long((font->ascent + font->descent) / m_scaleY); } -void wxPaintDC::Clear(void) +void wxWindowDC::Clear(void) { if (!Ok()) return; @@ -723,14 +723,14 @@ void wxPaintDC::Clear(void) } } -void wxPaintDC::SetFont( const wxFont &font ) +void wxWindowDC::SetFont( const wxFont &font ) { if (!Ok()) return; m_font = font; } -void wxPaintDC::SetPen( const wxPen &pen ) +void wxWindowDC::SetPen( const wxPen &pen ) { if (!Ok()) return; @@ -786,7 +786,7 @@ void wxPaintDC::SetPen( const wxPen &pen ) gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); } -void wxPaintDC::SetBrush( const wxBrush &brush ) +void wxWindowDC::SetBrush( const wxBrush &brush ) { if (!Ok()) return; @@ -825,7 +825,7 @@ void wxPaintDC::SetBrush( const wxBrush &brush ) // CMB 21/7/98: Added SetBackground. Sets background brush // for Clear() and bg colour for shapes filled with cross-hatch brush -void wxPaintDC::SetBackground( const wxBrush &brush ) +void wxWindowDC::SetBackground( const wxBrush &brush ) { if (!Ok()) return; @@ -865,7 +865,7 @@ void wxPaintDC::SetBackground( const wxBrush &brush ) } } -void wxPaintDC::SetLogicalFunction( int function ) +void wxWindowDC::SetLogicalFunction( int function ) { if (m_logicalFunction == function) return; GdkFunction mode = GDK_COPY; @@ -881,7 +881,7 @@ void wxPaintDC::SetLogicalFunction( int function ) gdk_gc_set_function( m_textGC, mode ); } -void wxPaintDC::SetTextForeground( const wxColour &col ) +void wxWindowDC::SetTextForeground( const wxColour &col ) { if (!Ok()) return; @@ -894,7 +894,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col ) gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() ); } -void wxPaintDC::SetTextBackground( const wxColour &col ) +void wxWindowDC::SetTextBackground( const wxColour &col ) { if (!Ok()) return; @@ -907,7 +907,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col ) gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); } -void wxPaintDC::SetBackgroundMode( int mode ) +void wxWindowDC::SetBackgroundMode( int mode ) { m_backgroundMode = mode; @@ -920,11 +920,11 @@ void wxPaintDC::SetBackgroundMode( int mode ) } } -void wxPaintDC::SetPalette( const wxPalette& WXUNUSED(palette) ) +void wxWindowDC::SetPalette( const wxPalette& WXUNUSED(palette) ) { } -void wxPaintDC::SetClippingRegion( long x, long y, long width, long height ) +void wxWindowDC::SetClippingRegion( long x, long y, long width, long height ) { wxDC::SetClippingRegion( x, y, width, height ); @@ -939,7 +939,7 @@ void wxPaintDC::SetClippingRegion( long x, long y, long width, long height ) gdk_gc_set_clip_rectangle( m_bgGC, &rect ); } -void wxPaintDC::DestroyClippingRegion(void) +void wxWindowDC::DestroyClippingRegion(void) { wxDC::DestroyClippingRegion(); @@ -949,7 +949,7 @@ void wxPaintDC::DestroyClippingRegion(void) gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL ); } -void wxPaintDC::SetUpDC(void) +void wxWindowDC::SetUpDC(void) { Destroy(); m_ok = TRUE; @@ -994,7 +994,7 @@ void wxPaintDC::SetUpDC(void) } } -void wxPaintDC::Destroy(void) +void wxWindowDC::Destroy(void) { if (m_penGC) gdk_gc_unref( m_penGC ); m_penGC = (GdkGC*) NULL; @@ -1006,7 +1006,7 @@ void wxPaintDC::Destroy(void) m_bgGC = (GdkGC*) NULL; } -GdkWindow *wxPaintDC::GetWindow(void) +GdkWindow *wxWindowDC::GetWindow(void) { return m_window; } @@ -1126,7 +1126,7 @@ static void wx_spline_draw_point_array(wxDC *dc) } } -void wxPaintDC::DrawSpline( wxList *points ) +void wxWindowDC::DrawSpline( wxList *points ) { wxPoint *p; double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; @@ -1175,3 +1175,37 @@ void wxPaintDC::DrawSpline( wxList *points ) wx_spline_draw_point_array( this ); } + + +//----------------------------------------------------------------------------- +// wxPaintDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxPaintDC,wxWindowDC) + +wxPaintDC::wxPaintDC(void) + : wxWindowDC() +{ +} + +wxPaintDC::wxPaintDC( wxWindow *win ) + : wxWindowDC( win ) +{ +} + +//----------------------------------------------------------------------------- +// wxClientDC +//----------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxClientDC,wxWindowDC) + +wxClientDC::wxClientDC(void) + : wxWindowDC() +{ +} + +wxClientDC::wxClientDC( wxWindow *win ) + : wxWindowDC( win ) +{ +} + diff --git a/src/gtk1/dcmemory.cpp b/src/gtk1/dcmemory.cpp index 66f8772b98..c41cb02348 100644 --- a/src/gtk1/dcmemory.cpp +++ b/src/gtk1/dcmemory.cpp @@ -17,16 +17,17 @@ // wxMemoryDC //----------------------------------------------------------------------------- -IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) +IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC) -wxMemoryDC::wxMemoryDC(void) : wxPaintDC() +wxMemoryDC::wxMemoryDC(void) : wxWindowDC() { m_ok = FALSE; m_cmap = gtk_widget_get_default_colormap(); } -wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : wxPaintDC() +wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) + : wxWindowDC() { m_ok = FALSE; diff --git a/src/gtk1/textctrl.cpp b/src/gtk1/textctrl.cpp index e1dd7eafc6..e99ff0e8b7 100644 --- a/src/gtk1/textctrl.cpp +++ b/src/gtk1/textctrl.cpp @@ -71,8 +71,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, SetValidator( validator ); - bool bMultiLine = (style & wxTE_MULTILINE) != 0; - if ( bMultiLine ) + bool multi_line = (style & wxTE_MULTILINE) != 0; + if ( multi_line ) { // a multi-line edit control: create a vertical scrollbar by default and // horizontal if requested @@ -125,7 +125,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, PostCreation(); - if (bMultiLine) + if (multi_line) { gtk_widget_realize(m_text); gtk_widget_show(m_text); @@ -143,12 +143,20 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, SetInsertionPointEnd(); } - if (style & wxTE_READONLY) + if (style & wxTE_PASSWORD) { + if (!multi_line) + gtk_entry_set_visibility( GTK_ENTRY(m_text), FALSE ); + } + + if (style & wxTE_READONLY) + { + if (!multi_line) + gtk_entry_set_editable( GTK_ENTRY(m_text), FALSE ); } else { - if (bMultiLine) + if (multi_line) gtk_text_set_editable( GTK_TEXT(m_text), 1 ); } -- 2.47.2