// 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__
// 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
{
DECLARE_DYNAMIC_CLASS(wxScreenDC)
- public:
+public:
wxScreenDC(void);
~wxScreenDC(void);
// 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__
// 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
{
DECLARE_DYNAMIC_CLASS(wxScreenDC)
- public:
+public:
wxScreenDC(void);
~wxScreenDC(void);
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 );
}
//-----------------------------------------------------------------------------
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()
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;
}
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;
}
//-----------------------------------------------------------------------------
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;
}
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)
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)
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()
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
#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;
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
-// 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;
m_isMemDC = FALSE;
}
-wxPaintDC::wxPaintDC( wxWindow *window )
+wxWindowDC::wxWindowDC( wxWindow *window )
{
m_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL;
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;
CalcBoundingBox(x2, y2);
}
-void wxPaintDC::CrossHair( long x, long y )
+void wxWindowDC::CrossHair( long x, long y )
{
if (!Ok()) return;
}
}
-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;
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;
CalcBoundingBox (x + width, y + height);
}
-void wxPaintDC::DrawPoint( long x, long y )
+void wxWindowDC::DrawPoint( long x, long y )
{
if (!Ok()) return;
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;
}
}
-void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
+void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
if (!Ok()) return;
}
}
-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;
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;
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;
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;
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;
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;
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;
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;
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) )
{
if (externalLeading) (*externalLeading) = 0; // ??
}
-long wxPaintDC::GetCharWidth(void)
+long wxWindowDC::GetCharWidth(void)
{
if (!Ok()) return 0;
return long(gdk_string_width( font, "H" ) / m_scaleX);
}
-long wxPaintDC::GetCharHeight(void)
+long wxWindowDC::GetCharHeight(void)
{
if (!Ok()) return 0;
return long((font->ascent + font->descent) / m_scaleY);
}
-void wxPaintDC::Clear(void)
+void wxWindowDC::Clear(void)
{
if (!Ok()) return;
}
}
-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;
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;
// 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;
}
}
-void wxPaintDC::SetLogicalFunction( int function )
+void wxWindowDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
GdkFunction mode = GDK_COPY;
gdk_gc_set_function( m_textGC, mode );
}
-void wxPaintDC::SetTextForeground( const wxColour &col )
+void wxWindowDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
}
-void wxPaintDC::SetTextBackground( const wxColour &col )
+void wxWindowDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
}
-void wxPaintDC::SetBackgroundMode( int mode )
+void wxWindowDC::SetBackgroundMode( int mode )
{
m_backgroundMode = 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 );
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
}
-void wxPaintDC::DestroyClippingRegion(void)
+void wxWindowDC::DestroyClippingRegion(void)
{
wxDC::DestroyClippingRegion();
gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL );
}
-void wxPaintDC::SetUpDC(void)
+void wxWindowDC::SetUpDC(void)
{
Destroy();
m_ok = TRUE;
}
}
-void wxPaintDC::Destroy(void)
+void wxWindowDC::Destroy(void)
{
if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = (GdkGC*) NULL;
m_bgGC = (GdkGC*) NULL;
}
-GdkWindow *wxPaintDC::GetWindow(void)
+GdkWindow *wxWindowDC::GetWindow(void)
{
return m_window;
}
}
}
-void wxPaintDC::DrawSpline( wxList *points )
+void wxWindowDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
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 )
+{
+}
+
// 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;
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
PostCreation();
- if (bMultiLine)
+ if (multi_line)
{
gtk_widget_realize(m_text);
gtk_widget_show(m_text);
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 );
}
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 );
}
//-----------------------------------------------------------------------------
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()
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;
}
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;
}
//-----------------------------------------------------------------------------
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;
}
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)
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)
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()
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
#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;
}
//-----------------------------------------------------------------------------
}
//-----------------------------------------------------------------------------
-// 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;
m_isMemDC = FALSE;
}
-wxPaintDC::wxPaintDC( wxWindow *window )
+wxWindowDC::wxWindowDC( wxWindow *window )
{
m_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL;
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;
CalcBoundingBox(x2, y2);
}
-void wxPaintDC::CrossHair( long x, long y )
+void wxWindowDC::CrossHair( long x, long y )
{
if (!Ok()) return;
}
}
-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;
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;
CalcBoundingBox (x + width, y + height);
}
-void wxPaintDC::DrawPoint( long x, long y )
+void wxWindowDC::DrawPoint( long x, long y )
{
if (!Ok()) return;
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;
}
}
-void wxPaintDC::DrawLines( wxList *points, long xoffset, long yoffset )
+void wxWindowDC::DrawLines( wxList *points, long xoffset, long yoffset )
{
if (!Ok()) return;
}
}
-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;
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;
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;
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;
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;
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;
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;
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;
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) )
{
if (externalLeading) (*externalLeading) = 0; // ??
}
-long wxPaintDC::GetCharWidth(void)
+long wxWindowDC::GetCharWidth(void)
{
if (!Ok()) return 0;
return long(gdk_string_width( font, "H" ) / m_scaleX);
}
-long wxPaintDC::GetCharHeight(void)
+long wxWindowDC::GetCharHeight(void)
{
if (!Ok()) return 0;
return long((font->ascent + font->descent) / m_scaleY);
}
-void wxPaintDC::Clear(void)
+void wxWindowDC::Clear(void)
{
if (!Ok()) return;
}
}
-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;
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;
// 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;
}
}
-void wxPaintDC::SetLogicalFunction( int function )
+void wxWindowDC::SetLogicalFunction( int function )
{
if (m_logicalFunction == function) return;
GdkFunction mode = GDK_COPY;
gdk_gc_set_function( m_textGC, mode );
}
-void wxPaintDC::SetTextForeground( const wxColour &col )
+void wxWindowDC::SetTextForeground( const wxColour &col )
{
if (!Ok()) return;
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
}
-void wxPaintDC::SetTextBackground( const wxColour &col )
+void wxWindowDC::SetTextBackground( const wxColour &col )
{
if (!Ok()) return;
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
}
-void wxPaintDC::SetBackgroundMode( int mode )
+void wxWindowDC::SetBackgroundMode( int mode )
{
m_backgroundMode = 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 );
gdk_gc_set_clip_rectangle( m_bgGC, &rect );
}
-void wxPaintDC::DestroyClippingRegion(void)
+void wxWindowDC::DestroyClippingRegion(void)
{
wxDC::DestroyClippingRegion();
gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL );
}
-void wxPaintDC::SetUpDC(void)
+void wxWindowDC::SetUpDC(void)
{
Destroy();
m_ok = TRUE;
}
}
-void wxPaintDC::Destroy(void)
+void wxWindowDC::Destroy(void)
{
if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = (GdkGC*) NULL;
m_bgGC = (GdkGC*) NULL;
}
-GdkWindow *wxPaintDC::GetWindow(void)
+GdkWindow *wxWindowDC::GetWindow(void)
{
return m_window;
}
}
}
-void wxPaintDC::DrawSpline( wxList *points )
+void wxWindowDC::DrawSpline( wxList *points )
{
wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
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 )
+{
+}
+
// 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;
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
PostCreation();
- if (bMultiLine)
+ if (multi_line)
{
gtk_widget_realize(m_text);
gtk_widget_show(m_text);
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 );
}