New wxDC hierarchy

wxTE_PASWORD


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1092 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-12-01 12:55:09 +00:00
parent 5b6ec9803a
commit ec758a20a2
16 changed files with 752 additions and 608 deletions

View File

@@ -22,88 +22,114 @@
// classes // classes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxWindowDC;
class wxPaintDC; class wxPaintDC;
typedef wxPaintDC wxClientDC; class wxClientDC;
typedef wxPaintDC wxWindowDC;
//-----------------------------------------------------------------------------
// wxWindowDC
//-----------------------------------------------------------------------------
class wxWindowDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
wxWindowDC(void);
wxWindowDC( wxWindow *win );
~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 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 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 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 SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
// implementation
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);
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxPaintDC // wxPaintDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxPaintDC: public wxDC class wxPaintDC : public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxPaintDC) DECLARE_DYNAMIC_CLASS(wxPaintDC)
public: public:
wxPaintDC(void);
wxPaintDC(void); wxPaintDC( wxWindow *win );
wxPaintDC( wxWindow *win );
~wxPaintDC(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 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 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 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 SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
public: // shouldn't be public
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);
}; };
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class wxClientDC : public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
wxClientDC(void);
wxClientDC( wxWindow *win );
};
#endif // __GTKDCCLIENTH__ #endif // __GTKDCCLIENTH__

View File

@@ -28,20 +28,20 @@ class wxMemoryDC;
// wxMemoryDC // wxMemoryDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxMemoryDC: public wxPaintDC class wxMemoryDC: public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxMemoryDC) DECLARE_DYNAMIC_CLASS(wxMemoryDC)
public: public:
wxMemoryDC(void); wxMemoryDC(void);
wxMemoryDC( wxDC *dc ); // Create compatible DC wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void); ~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap ); virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const; void GetSize( int *width, int *height ) const;
private: // implementation
friend wxPaintDC;
wxBitmap m_selected; wxBitmap m_selected;
}; };
#endif #endif

View File

@@ -26,7 +26,7 @@ class wxScreenDC: public wxPaintDC
{ {
DECLARE_DYNAMIC_CLASS(wxScreenDC) DECLARE_DYNAMIC_CLASS(wxScreenDC)
public: public:
wxScreenDC(void); wxScreenDC(void);
~wxScreenDC(void); ~wxScreenDC(void);

View File

@@ -22,88 +22,114 @@
// classes // classes
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxWindowDC;
class wxPaintDC; class wxPaintDC;
typedef wxPaintDC wxClientDC; class wxClientDC;
typedef wxPaintDC wxWindowDC;
//-----------------------------------------------------------------------------
// wxWindowDC
//-----------------------------------------------------------------------------
class wxWindowDC: public wxDC
{
DECLARE_DYNAMIC_CLASS(wxWindowDC)
public:
wxWindowDC(void);
wxWindowDC( wxWindow *win );
~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 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 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 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 SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
// implementation
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);
};
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxPaintDC // wxPaintDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxPaintDC: public wxDC class wxPaintDC : public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxPaintDC) DECLARE_DYNAMIC_CLASS(wxPaintDC)
public: public:
wxPaintDC(void);
wxPaintDC(void); wxPaintDC( wxWindow *win );
wxPaintDC( wxWindow *win );
~wxPaintDC(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 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 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 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 SetClippingRegion( long x, long y, long width, long height );
virtual void DestroyClippingRegion(void);
virtual void DrawSpline( wxList *points );
public: // shouldn't be public
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);
}; };
//-----------------------------------------------------------------------------
// wxClientDC
//-----------------------------------------------------------------------------
class wxClientDC : public wxWindowDC
{
DECLARE_DYNAMIC_CLASS(wxClientDC)
public:
wxClientDC(void);
wxClientDC( wxWindow *win );
};
#endif // __GTKDCCLIENTH__ #endif // __GTKDCCLIENTH__

View File

@@ -28,20 +28,20 @@ class wxMemoryDC;
// wxMemoryDC // wxMemoryDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
class wxMemoryDC: public wxPaintDC class wxMemoryDC: public wxWindowDC
{ {
DECLARE_DYNAMIC_CLASS(wxMemoryDC) DECLARE_DYNAMIC_CLASS(wxMemoryDC)
public: public:
wxMemoryDC(void); wxMemoryDC(void);
wxMemoryDC( wxDC *dc ); // Create compatible DC wxMemoryDC( wxDC *dc ); // Create compatible DC
~wxMemoryDC(void); ~wxMemoryDC(void);
virtual void SelectObject( const wxBitmap& bitmap ); virtual void SelectObject( const wxBitmap& bitmap );
void GetSize( int *width, int *height ) const; void GetSize( int *width, int *height ) const;
private: // implementation
friend wxPaintDC;
wxBitmap m_selected; wxBitmap m_selected;
}; };
#endif #endif

View File

@@ -26,7 +26,7 @@ class wxScreenDC: public wxPaintDC
{ {
DECLARE_DYNAMIC_CLASS(wxScreenDC) DECLARE_DYNAMIC_CLASS(wxScreenDC)
public: public:
wxScreenDC(void); wxScreenDC(void);
~wxScreenDC(void); ~wxScreenDC(void);

View File

@@ -21,16 +21,16 @@
class wxAccelRefData: public wxObjectRefData class wxAccelRefData: public wxObjectRefData
{ {
public: public:
wxAccelRefData(void); wxAccelRefData(void);
wxList m_accels; wxList m_accels;
}; };
wxAccelRefData::wxAccelRefData(void) wxAccelRefData::wxAccelRefData(void)
{ {
m_accels.DeleteContents( TRUE ); m_accels.DeleteContents( TRUE );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -45,15 +45,16 @@ wxAcceleratorTable::wxAcceleratorTable()
wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
{ {
m_refData = new wxAccelRefData(); m_refData = new wxAccelRefData();
for (int i = 0; i < n; i++)
{ for (int i = 0; i < n; i++)
int flag = entries[i].GetFlags(); {
int keycode = entries[i].GetKeyCode(); int flag = entries[i].GetFlags();
int command = entries[i].GetCommand(); int keycode = entries[i].GetKeyCode();
if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); int command = entries[i].GetCommand();
M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode );
} M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) );
}
} }
wxAcceleratorTable::~wxAcceleratorTable() wxAcceleratorTable::~wxAcceleratorTable()
@@ -62,25 +63,27 @@ wxAcceleratorTable::~wxAcceleratorTable()
bool wxAcceleratorTable::Ok() const bool wxAcceleratorTable::Ok() const
{ {
return (m_refData != NULL); return (m_refData != NULL);
} }
int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
{ {
if (!Ok()) return -1; if (!Ok()) return -1;
wxNode *node = M_ACCELDATA->m_accels.First(); wxNode *node = M_ACCELDATA->m_accels.First();
while (node) while (node)
{ {
wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data(); wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
if ((event.m_keyCode == entry->GetKeyCode()) && if ((event.m_keyCode == entry->GetKeyCode()) &&
(((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) && (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
(((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) && (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
(((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown())) (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
return entry->GetCommand(); {
node = node->Next(); return entry->GetCommand();
} }
node = node->Next();
}
return -1; return -1;
} }

View File

@@ -114,13 +114,13 @@ extern void wxFlushResources(void);
void wxExit(void) void wxExit(void)
{ {
gtk_main_quit(); gtk_main_quit();
} }
bool wxYield(void) bool wxYield(void)
{ {
while (gtk_events_pending() > 0) gtk_main_iteration(); while (gtk_events_pending() > 0) gtk_main_iteration();
return TRUE; return TRUE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -135,88 +135,88 @@ END_EVENT_TABLE()
gint wxapp_idle_callback( gpointer WXUNUSED(data) ) gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{ {
if (wxTheApp) while (wxTheApp->ProcessIdle()) {} if (wxTheApp) while (wxTheApp->ProcessIdle()) {}
usleep( 10000 ); usleep( 10000 );
return TRUE; return TRUE;
} }
wxApp::wxApp() wxApp::wxApp()
{ {
m_idleTag = 0; m_idleTag = 0;
m_topWindow = (wxWindow *) NULL; m_topWindow = (wxWindow *) NULL;
m_exitOnFrameDelete = TRUE; m_exitOnFrameDelete = TRUE;
wxTheApp = this; wxTheApp = this;
} }
wxApp::~wxApp(void) wxApp::~wxApp(void)
{ {
gtk_idle_remove( m_idleTag ); gtk_idle_remove( m_idleTag );
} }
bool wxApp::OnInit(void) bool wxApp::OnInit(void)
{ {
return TRUE; return TRUE;
} }
bool wxApp::OnInitGui(void) bool wxApp::OnInitGui(void)
{ {
m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL );
return TRUE; return TRUE;
} }
int wxApp::OnRun(void) int wxApp::OnRun(void)
{ {
return MainLoop(); return MainLoop();
} }
bool wxApp::ProcessIdle(void) bool wxApp::ProcessIdle(void)
{ {
wxIdleEvent event; wxIdleEvent event;
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); ProcessEvent( event );
return event.MoreRequested(); return event.MoreRequested();
} }
void wxApp::OnIdle( wxIdleEvent &event ) void wxApp::OnIdle( wxIdleEvent &event )
{ {
static bool inOnIdle = FALSE; static bool inOnIdle = FALSE;
// Avoid recursion (via ProcessEvent default case) // Avoid recursion (via ProcessEvent default case)
if (inOnIdle) if (inOnIdle)
return; return;
inOnIdle = TRUE; inOnIdle = TRUE;
// 'Garbage' collection of windows deleted with Close(). // 'Garbage' collection of windows deleted with Close().
DeletePendingObjects(); DeletePendingObjects();
// flush the logged messages if any // flush the logged messages if any
wxLog *pLog = wxLog::GetActiveTarget(); wxLog *pLog = wxLog::GetActiveTarget();
if ( pLog != NULL && pLog->HasPendingMessages() ) if (pLog != NULL && pLog->HasPendingMessages())
pLog->Flush(); pLog->Flush();
// Send OnIdle events to all windows // Send OnIdle events to all windows
bool needMore = SendIdleEvents(); bool needMore = SendIdleEvents();
if (needMore) if (needMore)
event.RequestMore(TRUE); event.RequestMore(TRUE);
inOnIdle = FALSE; inOnIdle = FALSE;
} }
bool wxApp::SendIdleEvents(void) bool wxApp::SendIdleEvents(void)
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First();
while (node) wxNode* node = wxTopLevelWindows.First();
{ while (node)
wxWindow* win = (wxWindow*) node->Data(); {
if (SendIdleEvents(win)) wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next();
node = node->Next(); }
}
return needMore; return needMore;
} }
@@ -245,28 +245,28 @@ bool wxApp::SendIdleEvents( wxWindow* win )
int wxApp::OnExit(void) int wxApp::OnExit(void)
{ {
return 0; return 0;
} }
int wxApp::MainLoop(void) int wxApp::MainLoop(void)
{ {
gtk_main(); gtk_main();
return 0; return 0;
} }
void wxApp::ExitMainLoop(void) void wxApp::ExitMainLoop(void)
{ {
gtk_main_quit(); gtk_main_quit();
} }
bool wxApp::Initialized(void) bool wxApp::Initialized(void)
{ {
return m_initialized; return m_initialized;
} }
bool wxApp::Pending(void) bool wxApp::Pending(void)
{ {
return FALSE; return FALSE;
} }
void wxApp::Dispatch(void) void wxApp::Dispatch(void)
@@ -275,31 +275,31 @@ void wxApp::Dispatch(void)
void wxApp::DeletePendingObjects(void) void wxApp::DeletePendingObjects(void)
{ {
wxNode *node = wxPendingDelete.First(); wxNode *node = wxPendingDelete.First();
while (node) while (node)
{ {
wxObject *obj = (wxObject *)node->Data(); wxObject *obj = (wxObject *)node->Data();
delete obj; delete obj;
if (wxPendingDelete.Member(obj)) if (wxPendingDelete.Member(obj))
delete node; delete node;
node = wxPendingDelete.First(); node = wxPendingDelete.First();
} }
} }
wxWindow *wxApp::GetTopWindow(void) wxWindow *wxApp::GetTopWindow(void)
{ {
if (m_topWindow) return m_topWindow; if (m_topWindow) return m_topWindow;
wxNode *node = wxTopLevelWindows.First(); wxNode *node = wxTopLevelWindows.First();
if (!node) return (wxWindow *) NULL; if (!node) return (wxWindow *) NULL;
return (wxWindow*)node->Data(); return (wxWindow*)node->Data();
} }
void wxApp::SetTopWindow( wxWindow *win ) void wxApp::SetTopWindow( wxWindow *win )
{ {
m_topWindow = win; m_topWindow = win;
} }
void wxApp::CommonInit(void) void wxApp::CommonInit(void)
@@ -331,21 +331,21 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void) void wxApp::CommonCleanUp(void)
{ {
wxDELETE(wxTheColourDatabase); wxDELETE(wxTheColourDatabase);
wxDELETE(wxTheFontNameDirectory); wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects(); wxDeleteStockObjects();
wxFlushResources(); wxFlushResources();
wxDELETE(wxTheResourceCache); wxDELETE(wxTheResourceCache);
wxDeleteStockLists(); wxDeleteStockLists();
wxCleanUpResourceSystem(); wxCleanUpResourceSystem();
wxImage::CleanUpHandlers(); wxImage::CleanUpHandlers();
wxSystemSettings::Done(); wxSystemSettings::Done();
} }
wxLog *wxApp::CreateLogTarget() wxLog *wxApp::CreateLogTarget()
@@ -359,9 +359,9 @@ wxLog *wxApp::CreateLogTarget()
int wxEntry( int argc, char *argv[] ) 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 /* Debug stream no longer used
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
@@ -372,107 +372,107 @@ int wxEntry( int argc, char *argv[] )
#endif #endif
*/ */
if (!wxTheApp) if (!wxTheApp)
{
if (!wxApp::GetInitializerFunction())
{ {
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); if (!wxApp::GetInitializerFunction())
return 0; {
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
return 0;
}
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction();
wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app;
} }
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); if (!wxTheApp)
{
printf( "wxWindows error: wxTheApp == NULL\n" );
return 0;
}
wxObject *test_app = app_ini(); wxTheApp->argc = argc;
wxTheApp->argv = argv;
wxTheApp = (wxApp*) test_app; char name[200];
} strcpy( name, argv[0] );
strcpy( name, wxFileNameFromPath(name) );
if (!wxTheApp) wxStripExtension( name );
{ wxTheApp->SetAppName( name );
printf( "wxWindows error: wxTheApp == NULL\n" );
return 0;
}
wxTheApp->argc = argc;
wxTheApp->argv = argv;
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++) for (int i = 0; i < 64; i++)
{ {
GdkColor col; GdkColor col;
col.red = g_palette[i*3 + 0] << 8; col.red = g_palette[i*3 + 0] << 8;
col.green = g_palette[i*3 + 1] << 8; col.green = g_palette[i*3 + 1] << 8;
col.blue = g_palette[i*3 + 2] << 8; col.blue = g_palette[i*3 + 2] << 8;
col.pixel = 0; 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(); wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE; if (!wxModule::InitializeModules()) return FALSE;
wxTheApp->OnInitGui(); wxTheApp->OnInitGui();
// Here frames insert themselves automatically // Here frames insert themselves automatically
// into wxTopLevelWindows by getting created // into wxTopLevelWindows by getting created
// in OnInit(). // 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 (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
if (wxDebugContext::CountObjectsLeft() > 0) if (wxDebugContext::CountObjectsLeft() > 0)
{ {
wxLogDebug("There were memory leaks.\n"); wxLogDebug("There were memory leaks.\n");
wxDebugContext::Dump(); wxDebugContext::Dump();
wxDebugContext::PrintStatistics(); wxDebugContext::PrintStatistics();
} }
// wxDebugContext::SetStream(NULL, NULL); // wxDebugContext::SetStream(NULL, NULL);
#endif #endif
wxLog *oldLog = wxLog::SetActiveTarget( NULL ); wxLog *oldLog = wxLog::SetActiveTarget( NULL );
if (oldLog) delete oldLog; if (oldLog) delete oldLog;
return retValue;
return retValue;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -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_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL;
@@ -94,7 +94,7 @@ wxPaintDC::wxPaintDC(void)
m_isMemDC = FALSE; m_isMemDC = FALSE;
} }
wxPaintDC::wxPaintDC( wxWindow *window ) wxWindowDC::wxWindowDC( wxWindow *window )
{ {
m_penGC = (GdkGC *) NULL; m_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL;
@@ -125,24 +125,24 @@ wxPaintDC::wxPaintDC( wxWindow *window )
gdk_gc_set_clip_region( m_bgGC, update.GetRegion() ); gdk_gc_set_clip_region( m_bgGC, update.GetRegion() );
} }
wxPaintDC::~wxPaintDC(void) wxWindowDC::~wxWindowDC(void)
{ {
Destroy(); 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) ) 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; 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; if (!Ok()) return;
@@ -156,7 +156,7 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
CalcBoundingBox(x2, y2); CalcBoundingBox(x2, y2);
} }
void wxPaintDC::CrossHair( long x, long y ) void wxWindowDC::CrossHair( long x, long y )
{ {
if (!Ok()) return; 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; 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); 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; if (!Ok()) return;
@@ -247,7 +247,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
CalcBoundingBox (x + width, y + height); CalcBoundingBox (x + width, y + height);
} }
void wxPaintDC::DrawPoint( long x, long y ) void wxWindowDC::DrawPoint( long x, long y )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -257,7 +257,7 @@ void wxPaintDC::DrawPoint( long x, long y )
CalcBoundingBox (x, 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; 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; 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; if (!Ok()) return;
@@ -339,7 +339,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset
delete[] gdkpoints; 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; if (!Ok()) return;
@@ -380,7 +380,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
delete[] gdkpoints; 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; if (!Ok()) return;
@@ -406,7 +406,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
CalcBoundingBox( x + width, y + 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; if (!Ok()) return;
@@ -475,7 +475,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
CalcBoundingBox( x + width, y + height ); 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; if (!Ok()) return;
@@ -498,12 +498,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
CalcBoundingBox( x + width, y + height ); CalcBoundingBox( x + width, y + height );
} }
bool wxPaintDC::CanDrawBitmap(void) const bool wxWindowDC::CanDrawBitmap(void) const
{ {
return TRUE; 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; if (!Ok()) return;
@@ -536,7 +536,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
CalcBoundingBox( x + width, y + height ); 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 ) wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask )
{ {
if (!Ok()) return FALSE; if (!Ok()) return FALSE;
@@ -633,7 +633,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
return TRUE; 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; if (!Ok()) return;
@@ -670,12 +670,12 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
CalcBoundingBox (x, y); CalcBoundingBox (x, y);
} }
bool wxPaintDC::CanGetTextExtent(void) const bool wxWindowDC::CanGetTextExtent(void) const
{ {
return TRUE; 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, long *descent, long *externalLeading,
wxFont *theFont, bool WXUNUSED(use16) ) wxFont *theFont, bool WXUNUSED(use16) )
{ {
@@ -691,7 +691,7 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height
if (externalLeading) (*externalLeading) = 0; // ?? if (externalLeading) (*externalLeading) = 0; // ??
} }
long wxPaintDC::GetCharWidth(void) long wxWindowDC::GetCharWidth(void)
{ {
if (!Ok()) return 0; if (!Ok()) return 0;
@@ -699,7 +699,7 @@ long wxPaintDC::GetCharWidth(void)
return long(gdk_string_width( font, "H" ) / m_scaleX); return long(gdk_string_width( font, "H" ) / m_scaleX);
} }
long wxPaintDC::GetCharHeight(void) long wxWindowDC::GetCharHeight(void)
{ {
if (!Ok()) return 0; if (!Ok()) return 0;
@@ -707,7 +707,7 @@ long wxPaintDC::GetCharHeight(void)
return long((font->ascent + font->descent) / m_scaleY); return long((font->ascent + font->descent) / m_scaleY);
} }
void wxPaintDC::Clear(void) void wxWindowDC::Clear(void)
{ {
if (!Ok()) return; 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; if (!Ok()) return;
m_font = font; m_font = font;
} }
void wxPaintDC::SetPen( const wxPen &pen ) void wxWindowDC::SetPen( const wxPen &pen )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -786,7 +786,7 @@ void wxPaintDC::SetPen( const wxPen &pen )
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); 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; if (!Ok()) return;
@@ -825,7 +825,7 @@ void wxPaintDC::SetBrush( const wxBrush &brush )
// CMB 21/7/98: Added SetBackground. Sets background brush // CMB 21/7/98: Added SetBackground. Sets background brush
// for Clear() and bg colour for shapes filled with cross-hatch 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; 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; if (m_logicalFunction == function) return;
GdkFunction mode = GDK_COPY; GdkFunction mode = GDK_COPY;
@@ -881,7 +881,7 @@ void wxPaintDC::SetLogicalFunction( int function )
gdk_gc_set_function( m_textGC, mode ); gdk_gc_set_function( m_textGC, mode );
} }
void wxPaintDC::SetTextForeground( const wxColour &col ) void wxWindowDC::SetTextForeground( const wxColour &col )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -894,7 +894,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col )
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() ); gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
} }
void wxPaintDC::SetTextBackground( const wxColour &col ) void wxWindowDC::SetTextBackground( const wxColour &col )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -907,7 +907,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col )
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
} }
void wxPaintDC::SetBackgroundMode( int mode ) void wxWindowDC::SetBackgroundMode( int mode )
{ {
m_backgroundMode = 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 ); 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 ); gdk_gc_set_clip_rectangle( m_bgGC, &rect );
} }
void wxPaintDC::DestroyClippingRegion(void) void wxWindowDC::DestroyClippingRegion(void)
{ {
wxDC::DestroyClippingRegion(); wxDC::DestroyClippingRegion();
@@ -949,7 +949,7 @@ void wxPaintDC::DestroyClippingRegion(void)
gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL ); gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL );
} }
void wxPaintDC::SetUpDC(void) void wxWindowDC::SetUpDC(void)
{ {
Destroy(); Destroy();
m_ok = TRUE; 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 ); if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = (GdkGC*) NULL; m_penGC = (GdkGC*) NULL;
@@ -1006,7 +1006,7 @@ void wxPaintDC::Destroy(void)
m_bgGC = (GdkGC*) NULL; m_bgGC = (GdkGC*) NULL;
} }
GdkWindow *wxPaintDC::GetWindow(void) GdkWindow *wxWindowDC::GetWindow(void)
{ {
return m_window; 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; wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
@@ -1175,3 +1175,37 @@ void wxPaintDC::DrawSpline( wxList *points )
wx_spline_draw_point_array( this ); 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 )
{
}

View File

@@ -17,16 +17,17 @@
// wxMemoryDC // wxMemoryDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
wxMemoryDC::wxMemoryDC(void) : wxPaintDC() wxMemoryDC::wxMemoryDC(void) : wxWindowDC()
{ {
m_ok = FALSE; m_ok = FALSE;
m_cmap = gtk_widget_get_default_colormap(); m_cmap = gtk_widget_get_default_colormap();
} }
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : wxPaintDC() wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
: wxWindowDC()
{ {
m_ok = FALSE; m_ok = FALSE;

View File

@@ -71,8 +71,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
SetValidator( validator ); SetValidator( validator );
bool bMultiLine = (style & wxTE_MULTILINE) != 0; bool multi_line = (style & wxTE_MULTILINE) != 0;
if ( bMultiLine ) if ( multi_line )
{ {
// a multi-line edit control: create a vertical scrollbar by default and // a multi-line edit control: create a vertical scrollbar by default and
// horizontal if requested // horizontal if requested
@@ -125,7 +125,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
PostCreation(); PostCreation();
if (bMultiLine) if (multi_line)
{ {
gtk_widget_realize(m_text); gtk_widget_realize(m_text);
gtk_widget_show(m_text); gtk_widget_show(m_text);
@@ -143,12 +143,20 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
SetInsertionPointEnd(); 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 else
{ {
if (bMultiLine) if (multi_line)
gtk_text_set_editable( GTK_TEXT(m_text), 1 ); gtk_text_set_editable( GTK_TEXT(m_text), 1 );
} }

View File

@@ -21,16 +21,16 @@
class wxAccelRefData: public wxObjectRefData class wxAccelRefData: public wxObjectRefData
{ {
public: public:
wxAccelRefData(void); wxAccelRefData(void);
wxList m_accels; wxList m_accels;
}; };
wxAccelRefData::wxAccelRefData(void) wxAccelRefData::wxAccelRefData(void)
{ {
m_accels.DeleteContents( TRUE ); m_accels.DeleteContents( TRUE );
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -45,15 +45,16 @@ wxAcceleratorTable::wxAcceleratorTable()
wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] ) wxAcceleratorTable::wxAcceleratorTable( int n, wxAcceleratorEntry entries[] )
{ {
m_refData = new wxAccelRefData(); m_refData = new wxAccelRefData();
for (int i = 0; i < n; i++)
{ for (int i = 0; i < n; i++)
int flag = entries[i].GetFlags(); {
int keycode = entries[i].GetKeyCode(); int flag = entries[i].GetFlags();
int command = entries[i].GetCommand(); int keycode = entries[i].GetKeyCode();
if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode ); int command = entries[i].GetCommand();
M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) ); if ((keycode >= (int)'A') && (keycode <= (int)'Z')) keycode = (int)tolower( (char)keycode );
} M_ACCELDATA->m_accels.Append( new wxAcceleratorEntry( flag, keycode, command ) );
}
} }
wxAcceleratorTable::~wxAcceleratorTable() wxAcceleratorTable::~wxAcceleratorTable()
@@ -62,25 +63,27 @@ wxAcceleratorTable::~wxAcceleratorTable()
bool wxAcceleratorTable::Ok() const bool wxAcceleratorTable::Ok() const
{ {
return (m_refData != NULL); return (m_refData != NULL);
} }
int wxAcceleratorTable::GetCommand( wxKeyEvent &event ) int wxAcceleratorTable::GetCommand( wxKeyEvent &event )
{ {
if (!Ok()) return -1; if (!Ok()) return -1;
wxNode *node = M_ACCELDATA->m_accels.First(); wxNode *node = M_ACCELDATA->m_accels.First();
while (node) while (node)
{ {
wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data(); wxAcceleratorEntry *entry = (wxAcceleratorEntry*)node->Data();
if ((event.m_keyCode == entry->GetKeyCode()) && if ((event.m_keyCode == entry->GetKeyCode()) &&
(((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) && (((entry->GetFlags() & wxACCEL_CTRL) == 0) || event.ControlDown()) &&
(((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) && (((entry->GetFlags() & wxACCEL_SHIFT) == 0) || event.ShiftDown()) &&
(((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown())) (((entry->GetFlags() & wxACCEL_ALT) == 0) || event.AltDown() || event.MetaDown()))
return entry->GetCommand(); {
node = node->Next(); return entry->GetCommand();
} }
node = node->Next();
}
return -1; return -1;
} }

View File

@@ -114,13 +114,13 @@ extern void wxFlushResources(void);
void wxExit(void) void wxExit(void)
{ {
gtk_main_quit(); gtk_main_quit();
} }
bool wxYield(void) bool wxYield(void)
{ {
while (gtk_events_pending() > 0) gtk_main_iteration(); while (gtk_events_pending() > 0) gtk_main_iteration();
return TRUE; return TRUE;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -135,88 +135,88 @@ END_EVENT_TABLE()
gint wxapp_idle_callback( gpointer WXUNUSED(data) ) gint wxapp_idle_callback( gpointer WXUNUSED(data) )
{ {
if (wxTheApp) while (wxTheApp->ProcessIdle()) {} if (wxTheApp) while (wxTheApp->ProcessIdle()) {}
usleep( 10000 ); usleep( 10000 );
return TRUE; return TRUE;
} }
wxApp::wxApp() wxApp::wxApp()
{ {
m_idleTag = 0; m_idleTag = 0;
m_topWindow = (wxWindow *) NULL; m_topWindow = (wxWindow *) NULL;
m_exitOnFrameDelete = TRUE; m_exitOnFrameDelete = TRUE;
wxTheApp = this; wxTheApp = this;
} }
wxApp::~wxApp(void) wxApp::~wxApp(void)
{ {
gtk_idle_remove( m_idleTag ); gtk_idle_remove( m_idleTag );
} }
bool wxApp::OnInit(void) bool wxApp::OnInit(void)
{ {
return TRUE; return TRUE;
} }
bool wxApp::OnInitGui(void) bool wxApp::OnInitGui(void)
{ {
m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL ); m_idleTag = gtk_idle_add( wxapp_idle_callback, NULL );
return TRUE; return TRUE;
} }
int wxApp::OnRun(void) int wxApp::OnRun(void)
{ {
return MainLoop(); return MainLoop();
} }
bool wxApp::ProcessIdle(void) bool wxApp::ProcessIdle(void)
{ {
wxIdleEvent event; wxIdleEvent event;
event.SetEventObject( this ); event.SetEventObject( this );
ProcessEvent( event ); ProcessEvent( event );
return event.MoreRequested(); return event.MoreRequested();
} }
void wxApp::OnIdle( wxIdleEvent &event ) void wxApp::OnIdle( wxIdleEvent &event )
{ {
static bool inOnIdle = FALSE; static bool inOnIdle = FALSE;
// Avoid recursion (via ProcessEvent default case) // Avoid recursion (via ProcessEvent default case)
if (inOnIdle) if (inOnIdle)
return; return;
inOnIdle = TRUE; inOnIdle = TRUE;
// 'Garbage' collection of windows deleted with Close(). // 'Garbage' collection of windows deleted with Close().
DeletePendingObjects(); DeletePendingObjects();
// flush the logged messages if any // flush the logged messages if any
wxLog *pLog = wxLog::GetActiveTarget(); wxLog *pLog = wxLog::GetActiveTarget();
if ( pLog != NULL && pLog->HasPendingMessages() ) if (pLog != NULL && pLog->HasPendingMessages())
pLog->Flush(); pLog->Flush();
// Send OnIdle events to all windows // Send OnIdle events to all windows
bool needMore = SendIdleEvents(); bool needMore = SendIdleEvents();
if (needMore) if (needMore)
event.RequestMore(TRUE); event.RequestMore(TRUE);
inOnIdle = FALSE; inOnIdle = FALSE;
} }
bool wxApp::SendIdleEvents(void) bool wxApp::SendIdleEvents(void)
{ {
bool needMore = FALSE; bool needMore = FALSE;
wxNode* node = wxTopLevelWindows.First();
while (node) wxNode* node = wxTopLevelWindows.First();
{ while (node)
wxWindow* win = (wxWindow*) node->Data(); {
if (SendIdleEvents(win)) wxWindow* win = (wxWindow*) node->Data();
if (SendIdleEvents(win))
needMore = TRUE; needMore = TRUE;
node = node->Next();
node = node->Next(); }
}
return needMore; return needMore;
} }
@@ -245,28 +245,28 @@ bool wxApp::SendIdleEvents( wxWindow* win )
int wxApp::OnExit(void) int wxApp::OnExit(void)
{ {
return 0; return 0;
} }
int wxApp::MainLoop(void) int wxApp::MainLoop(void)
{ {
gtk_main(); gtk_main();
return 0; return 0;
} }
void wxApp::ExitMainLoop(void) void wxApp::ExitMainLoop(void)
{ {
gtk_main_quit(); gtk_main_quit();
} }
bool wxApp::Initialized(void) bool wxApp::Initialized(void)
{ {
return m_initialized; return m_initialized;
} }
bool wxApp::Pending(void) bool wxApp::Pending(void)
{ {
return FALSE; return FALSE;
} }
void wxApp::Dispatch(void) void wxApp::Dispatch(void)
@@ -275,31 +275,31 @@ void wxApp::Dispatch(void)
void wxApp::DeletePendingObjects(void) void wxApp::DeletePendingObjects(void)
{ {
wxNode *node = wxPendingDelete.First(); wxNode *node = wxPendingDelete.First();
while (node) while (node)
{ {
wxObject *obj = (wxObject *)node->Data(); wxObject *obj = (wxObject *)node->Data();
delete obj; delete obj;
if (wxPendingDelete.Member(obj)) if (wxPendingDelete.Member(obj))
delete node; delete node;
node = wxPendingDelete.First(); node = wxPendingDelete.First();
} }
} }
wxWindow *wxApp::GetTopWindow(void) wxWindow *wxApp::GetTopWindow(void)
{ {
if (m_topWindow) return m_topWindow; if (m_topWindow) return m_topWindow;
wxNode *node = wxTopLevelWindows.First(); wxNode *node = wxTopLevelWindows.First();
if (!node) return (wxWindow *) NULL; if (!node) return (wxWindow *) NULL;
return (wxWindow*)node->Data(); return (wxWindow*)node->Data();
} }
void wxApp::SetTopWindow( wxWindow *win ) void wxApp::SetTopWindow( wxWindow *win )
{ {
m_topWindow = win; m_topWindow = win;
} }
void wxApp::CommonInit(void) void wxApp::CommonInit(void)
@@ -331,21 +331,21 @@ void wxApp::CommonInit(void)
void wxApp::CommonCleanUp(void) void wxApp::CommonCleanUp(void)
{ {
wxDELETE(wxTheColourDatabase); wxDELETE(wxTheColourDatabase);
wxDELETE(wxTheFontNameDirectory); wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects(); wxDeleteStockObjects();
wxFlushResources(); wxFlushResources();
wxDELETE(wxTheResourceCache); wxDELETE(wxTheResourceCache);
wxDeleteStockLists(); wxDeleteStockLists();
wxCleanUpResourceSystem(); wxCleanUpResourceSystem();
wxImage::CleanUpHandlers(); wxImage::CleanUpHandlers();
wxSystemSettings::Done(); wxSystemSettings::Done();
} }
wxLog *wxApp::CreateLogTarget() wxLog *wxApp::CreateLogTarget()
@@ -359,9 +359,9 @@ wxLog *wxApp::CreateLogTarget()
int wxEntry( int argc, char *argv[] ) 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 /* Debug stream no longer used
#if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT #if (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
@@ -372,107 +372,107 @@ int wxEntry( int argc, char *argv[] )
#endif #endif
*/ */
if (!wxTheApp) if (!wxTheApp)
{
if (!wxApp::GetInitializerFunction())
{ {
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" ); if (!wxApp::GetInitializerFunction())
return 0; {
printf( "wxWindows error: No initializer - use IMPLEMENT_APP macro.\n" );
return 0;
}
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction();
wxObject *test_app = app_ini();
wxTheApp = (wxApp*) test_app;
} }
wxAppInitializerFunction app_ini = wxApp::GetInitializerFunction(); if (!wxTheApp)
{
printf( "wxWindows error: wxTheApp == NULL\n" );
return 0;
}
wxObject *test_app = app_ini(); wxTheApp->argc = argc;
wxTheApp->argv = argv;
wxTheApp = (wxApp*) test_app; char name[200];
} strcpy( name, argv[0] );
strcpy( name, wxFileNameFromPath(name) );
if (!wxTheApp) wxStripExtension( name );
{ wxTheApp->SetAppName( name );
printf( "wxWindows error: wxTheApp == NULL\n" );
return 0;
}
wxTheApp->argc = argc;
wxTheApp->argv = argv;
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++) for (int i = 0; i < 64; i++)
{ {
GdkColor col; GdkColor col;
col.red = g_palette[i*3 + 0] << 8; col.red = g_palette[i*3 + 0] << 8;
col.green = g_palette[i*3 + 1] << 8; col.green = g_palette[i*3 + 1] << 8;
col.blue = g_palette[i*3 + 2] << 8; col.blue = g_palette[i*3 + 2] << 8;
col.pixel = 0; 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(); wxModule::RegisterModules();
if (!wxModule::InitializeModules()) return FALSE; if (!wxModule::InitializeModules()) return FALSE;
wxTheApp->OnInitGui(); wxTheApp->OnInitGui();
// Here frames insert themselves automatically // Here frames insert themselves automatically
// into wxTopLevelWindows by getting created // into wxTopLevelWindows by getting created
// in OnInit(). // 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 (defined(__WXDEBUG__) && wxUSE_MEMORY_TRACING) || wxUSE_DEBUG_CONTEXT
if (wxDebugContext::CountObjectsLeft() > 0) if (wxDebugContext::CountObjectsLeft() > 0)
{ {
wxLogDebug("There were memory leaks.\n"); wxLogDebug("There were memory leaks.\n");
wxDebugContext::Dump(); wxDebugContext::Dump();
wxDebugContext::PrintStatistics(); wxDebugContext::PrintStatistics();
} }
// wxDebugContext::SetStream(NULL, NULL); // wxDebugContext::SetStream(NULL, NULL);
#endif #endif
wxLog *oldLog = wxLog::SetActiveTarget( NULL ); wxLog *oldLog = wxLog::SetActiveTarget( NULL );
if (oldLog) delete oldLog; if (oldLog) delete oldLog;
return retValue;
return retValue;
} }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@@ -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_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL;
@@ -94,7 +94,7 @@ wxPaintDC::wxPaintDC(void)
m_isMemDC = FALSE; m_isMemDC = FALSE;
} }
wxPaintDC::wxPaintDC( wxWindow *window ) wxWindowDC::wxWindowDC( wxWindow *window )
{ {
m_penGC = (GdkGC *) NULL; m_penGC = (GdkGC *) NULL;
m_brushGC = (GdkGC *) NULL; m_brushGC = (GdkGC *) NULL;
@@ -125,24 +125,24 @@ wxPaintDC::wxPaintDC( wxWindow *window )
gdk_gc_set_clip_region( m_bgGC, update.GetRegion() ); gdk_gc_set_clip_region( m_bgGC, update.GetRegion() );
} }
wxPaintDC::~wxPaintDC(void) wxWindowDC::~wxWindowDC(void)
{ {
Destroy(); 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) ) 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; 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; if (!Ok()) return;
@@ -156,7 +156,7 @@ void wxPaintDC::DrawLine( long x1, long y1, long x2, long y2 )
CalcBoundingBox(x2, y2); CalcBoundingBox(x2, y2);
} }
void wxPaintDC::CrossHair( long x, long y ) void wxWindowDC::CrossHair( long x, long y )
{ {
if (!Ok()) return; 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; 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); 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; if (!Ok()) return;
@@ -247,7 +247,7 @@ void wxPaintDC::DrawEllipticArc( long x, long y, long width, long height, double
CalcBoundingBox (x + width, y + height); CalcBoundingBox (x + width, y + height);
} }
void wxPaintDC::DrawPoint( long x, long y ) void wxWindowDC::DrawPoint( long x, long y )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -257,7 +257,7 @@ void wxPaintDC::DrawPoint( long x, long y )
CalcBoundingBox (x, 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; 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; 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; if (!Ok()) return;
@@ -339,7 +339,7 @@ void wxPaintDC::DrawPolygon( int n, wxPoint points[], long xoffset, long yoffset
delete[] gdkpoints; 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; if (!Ok()) return;
@@ -380,7 +380,7 @@ void wxPaintDC::DrawPolygon( wxList *lines, long xoffset, long yoffset, int WXUN
delete[] gdkpoints; 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; if (!Ok()) return;
@@ -406,7 +406,7 @@ void wxPaintDC::DrawRectangle( long x, long y, long width, long height )
CalcBoundingBox( x + width, y + 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; if (!Ok()) return;
@@ -475,7 +475,7 @@ void wxPaintDC::DrawRoundedRectangle( long x, long y, long width, long height, d
CalcBoundingBox( x + width, y + height ); 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; if (!Ok()) return;
@@ -498,12 +498,12 @@ void wxPaintDC::DrawEllipse( long x, long y, long width, long height )
CalcBoundingBox( x + width, y + height ); CalcBoundingBox( x + width, y + height );
} }
bool wxPaintDC::CanDrawBitmap(void) const bool wxWindowDC::CanDrawBitmap(void) const
{ {
return TRUE; 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; if (!Ok()) return;
@@ -536,7 +536,7 @@ void wxPaintDC::DrawIcon( const wxIcon &icon, long x, long y, bool useMask )
CalcBoundingBox( x + width, y + height ); 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 ) wxDC *source, long xsrc, long ysrc, int WXUNUSED(logical_func), bool useMask )
{ {
if (!Ok()) return FALSE; if (!Ok()) return FALSE;
@@ -633,7 +633,7 @@ bool wxPaintDC::Blit( long xdest, long ydest, long width, long height,
return TRUE; 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; if (!Ok()) return;
@@ -670,12 +670,12 @@ void wxPaintDC::DrawText( const wxString &text, long x, long y, bool WXUNUSED(us
CalcBoundingBox (x, y); CalcBoundingBox (x, y);
} }
bool wxPaintDC::CanGetTextExtent(void) const bool wxWindowDC::CanGetTextExtent(void) const
{ {
return TRUE; 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, long *descent, long *externalLeading,
wxFont *theFont, bool WXUNUSED(use16) ) wxFont *theFont, bool WXUNUSED(use16) )
{ {
@@ -691,7 +691,7 @@ void wxPaintDC::GetTextExtent( const wxString &string, long *width, long *height
if (externalLeading) (*externalLeading) = 0; // ?? if (externalLeading) (*externalLeading) = 0; // ??
} }
long wxPaintDC::GetCharWidth(void) long wxWindowDC::GetCharWidth(void)
{ {
if (!Ok()) return 0; if (!Ok()) return 0;
@@ -699,7 +699,7 @@ long wxPaintDC::GetCharWidth(void)
return long(gdk_string_width( font, "H" ) / m_scaleX); return long(gdk_string_width( font, "H" ) / m_scaleX);
} }
long wxPaintDC::GetCharHeight(void) long wxWindowDC::GetCharHeight(void)
{ {
if (!Ok()) return 0; if (!Ok()) return 0;
@@ -707,7 +707,7 @@ long wxPaintDC::GetCharHeight(void)
return long((font->ascent + font->descent) / m_scaleY); return long((font->ascent + font->descent) / m_scaleY);
} }
void wxPaintDC::Clear(void) void wxWindowDC::Clear(void)
{ {
if (!Ok()) return; 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; if (!Ok()) return;
m_font = font; m_font = font;
} }
void wxPaintDC::SetPen( const wxPen &pen ) void wxWindowDC::SetPen( const wxPen &pen )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -786,7 +786,7 @@ void wxPaintDC::SetPen( const wxPen &pen )
gdk_gc_set_foreground( m_penGC, m_pen.GetColour().GetColor() ); 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; if (!Ok()) return;
@@ -825,7 +825,7 @@ void wxPaintDC::SetBrush( const wxBrush &brush )
// CMB 21/7/98: Added SetBackground. Sets background brush // CMB 21/7/98: Added SetBackground. Sets background brush
// for Clear() and bg colour for shapes filled with cross-hatch 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; 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; if (m_logicalFunction == function) return;
GdkFunction mode = GDK_COPY; GdkFunction mode = GDK_COPY;
@@ -881,7 +881,7 @@ void wxPaintDC::SetLogicalFunction( int function )
gdk_gc_set_function( m_textGC, mode ); gdk_gc_set_function( m_textGC, mode );
} }
void wxPaintDC::SetTextForeground( const wxColour &col ) void wxWindowDC::SetTextForeground( const wxColour &col )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -894,7 +894,7 @@ void wxPaintDC::SetTextForeground( const wxColour &col )
gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() ); gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() );
} }
void wxPaintDC::SetTextBackground( const wxColour &col ) void wxWindowDC::SetTextBackground( const wxColour &col )
{ {
if (!Ok()) return; if (!Ok()) return;
@@ -907,7 +907,7 @@ void wxPaintDC::SetTextBackground( const wxColour &col )
gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() );
} }
void wxPaintDC::SetBackgroundMode( int mode ) void wxWindowDC::SetBackgroundMode( int mode )
{ {
m_backgroundMode = 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 ); 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 ); gdk_gc_set_clip_rectangle( m_bgGC, &rect );
} }
void wxPaintDC::DestroyClippingRegion(void) void wxWindowDC::DestroyClippingRegion(void)
{ {
wxDC::DestroyClippingRegion(); wxDC::DestroyClippingRegion();
@@ -949,7 +949,7 @@ void wxPaintDC::DestroyClippingRegion(void)
gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL ); gdk_gc_set_clip_rectangle( m_bgGC, (GdkRectangle *) NULL );
} }
void wxPaintDC::SetUpDC(void) void wxWindowDC::SetUpDC(void)
{ {
Destroy(); Destroy();
m_ok = TRUE; 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 ); if (m_penGC) gdk_gc_unref( m_penGC );
m_penGC = (GdkGC*) NULL; m_penGC = (GdkGC*) NULL;
@@ -1006,7 +1006,7 @@ void wxPaintDC::Destroy(void)
m_bgGC = (GdkGC*) NULL; m_bgGC = (GdkGC*) NULL;
} }
GdkWindow *wxPaintDC::GetWindow(void) GdkWindow *wxWindowDC::GetWindow(void)
{ {
return m_window; 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; wxPoint *p;
double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4; double cx1, cy1, cx2, cy2, cx3, cy3, cx4, cy4;
@@ -1175,3 +1175,37 @@ void wxPaintDC::DrawSpline( wxList *points )
wx_spline_draw_point_array( this ); 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 )
{
}

View File

@@ -17,16 +17,17 @@
// wxMemoryDC // wxMemoryDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxPaintDC) IMPLEMENT_DYNAMIC_CLASS(wxMemoryDC,wxWindowDC)
wxMemoryDC::wxMemoryDC(void) : wxPaintDC() wxMemoryDC::wxMemoryDC(void) : wxWindowDC()
{ {
m_ok = FALSE; m_ok = FALSE;
m_cmap = gtk_widget_get_default_colormap(); m_cmap = gtk_widget_get_default_colormap();
} }
wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) ) : wxPaintDC() wxMemoryDC::wxMemoryDC( wxDC *WXUNUSED(dc) )
: wxWindowDC()
{ {
m_ok = FALSE; m_ok = FALSE;

View File

@@ -71,8 +71,8 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
SetValidator( validator ); SetValidator( validator );
bool bMultiLine = (style & wxTE_MULTILINE) != 0; bool multi_line = (style & wxTE_MULTILINE) != 0;
if ( bMultiLine ) if ( multi_line )
{ {
// a multi-line edit control: create a vertical scrollbar by default and // a multi-line edit control: create a vertical scrollbar by default and
// horizontal if requested // horizontal if requested
@@ -125,7 +125,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
PostCreation(); PostCreation();
if (bMultiLine) if (multi_line)
{ {
gtk_widget_realize(m_text); gtk_widget_realize(m_text);
gtk_widget_show(m_text); gtk_widget_show(m_text);
@@ -143,12 +143,20 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
SetInsertionPointEnd(); 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 else
{ {
if (bMultiLine) if (multi_line)
gtk_text_set_editable( GTK_TEXT(m_text), 1 ); gtk_text_set_editable( GTK_TEXT(m_text), 1 );
} }