1. wxTimer::Start() returns bool in wxGTK too (other minor corrections

to this class, such as "const" addition, Notify() is = 0 now...)

2. wxGTK::wxTextCtrl::Delete renamed to Clear for consistency

3. wx/wx_prec.h now includes wx/setup.h even if !wxUSE_PRECOMP because
   otherwise (recently added) tests "#if wxUSE_IOSTREAMH" donb't work.

4. Other compilation fixes for wxGTK (now it compiles again)


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1998-10-12 13:09:15 +00:00
parent fbc535ff08
commit 03f38c58fd
23 changed files with 387 additions and 281 deletions

View File

@@ -86,7 +86,7 @@ class wxTextCtrl: public wxControl, public streambuf
void Cut(); void Cut();
void Copy(); void Copy();
void Paste(); void Paste();
void Delete(); void Clear();
void OnChar( wxKeyEvent &event ); void OnChar( wxKeyEvent &event );

View File

@@ -31,23 +31,26 @@ class wxTimer;
class wxTimer: public wxObject class wxTimer: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTimer) public:
wxTimer();
~wxTimer();
public: int Interval() const { return m_time; }
wxTimer(void); bool OneShot() const { return m_oneShot; }
~wxTimer(void);
int Interval(void);
bool OneShot(void);
virtual void Notify(void);
void Start( int millisecs = -1, bool oneShot = FALSE );
void Stop(void);
private: virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
virtual void Stop();
virtual void Notify() = 0; // override this
protected:
int m_tag; int m_tag;
int m_time; int m_time;
bool m_oneShot; bool m_oneShot;
private:
DECLARE_ABSTRACT_CLASS(wxTimer)
}; };
#endif // __GTKTIMERH__ #endif // __GTKTIMERH__

View File

@@ -86,7 +86,7 @@ class wxTextCtrl: public wxControl, public streambuf
void Cut(); void Cut();
void Copy(); void Copy();
void Paste(); void Paste();
void Delete(); void Clear();
void OnChar( wxKeyEvent &event ); void OnChar( wxKeyEvent &event );

View File

@@ -31,23 +31,26 @@ class wxTimer;
class wxTimer: public wxObject class wxTimer: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTimer) public:
wxTimer();
~wxTimer();
public: int Interval() const { return m_time; }
wxTimer(void); bool OneShot() const { return m_oneShot; }
~wxTimer(void);
int Interval(void);
bool OneShot(void);
virtual void Notify(void);
void Start( int millisecs = -1, bool oneShot = FALSE );
void Stop(void);
private: virtual bool Start( int millisecs = -1, bool oneShot = FALSE );
virtual void Stop();
virtual void Notify() = 0; // override this
protected:
int m_tag; int m_tag;
int m_time; int m_time;
bool m_oneShot; bool m_oneShot;
private:
DECLARE_ABSTRACT_CLASS(wxTimer)
}; };
#endif // __GTKTIMERH__ #endif // __GTKTIMERH__

View File

@@ -1,18 +1,26 @@
#ifndef _WX_ICON_H_BASE_ #ifndef _WX_ICON_H_BASE_
#define _WX_ICON_H_BASE_ #define _WX_ICON_H_BASE_
// this is for Unix (i.e. now for anything other than MSW)
#undef wxICON
#define wxICON(icon_name) wxIcon(icon_name##_xpm)
#if defined(__WXMSW__) #if defined(__WXMSW__)
#include "wx/msw/icon.h" // under Windows, icon name is the ressource id (string)
#undef wxICON
#define wxICON(icon_name) wxIcon(#icon_name)
#include "wx/msw/icon.h"
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)
#include "wx/motif/icon.h" #include "wx/motif/icon.h"
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/gtk/icon.h" #include "wx/gtk/icon.h"
#elif defined(__WXQT__) #elif defined(__WXQT__)
#include "wx/qt/icon.h" #include "wx/qt/icon.h"
#elif defined(__WXMAC__) #elif defined(__WXMAC__)
#include "wx/mac/icon.h" #include "wx/mac/icon.h"
#elif defined(__WXSTUBS__) #elif defined(__WXSTUBS__)
#include "wx/stubs/icon.h" #include "wx/stubs/icon.h"
#endif #endif
#endif #endif

View File

@@ -188,6 +188,8 @@ protected:
ostream *m_ostr; ostream *m_ostr;
}; };
#ifndef wxUSE_NOGUI
// log everything to a text window (GUI only of course) // log everything to a text window (GUI only of course)
class WXDLLEXPORT wxLogTextCtrl : public wxLogStream class WXDLLEXPORT wxLogTextCtrl : public wxLogStream
{ {
@@ -269,6 +271,8 @@ private:
wxLogFrame *m_pLogFrame; // the log frame wxLogFrame *m_pLogFrame; // the log frame
}; };
#endif // wxUSE_NOGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// /dev/null log target: suppress logging until this object goes out of scope // /dev/null log target: suppress logging until this object goes out of scope
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -18,27 +18,35 @@
#include "wx/object.h" #include "wx/object.h"
class WXDLLEXPORT wxTimer: public wxObject class WXDLLEXPORT wxTimer : public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTimer) public:
wxTimer();
~wxTimer();
public: virtual bool Start(int milliseconds = -1,
bool one_shot = FALSE); // Start timer
virtual void Stop(); // Stop timer
virtual void Notify() = 0; // Override this member
// Returns the current interval time (0 if stop)
int Interval() const { return milli; };
bool OneShot() const { return oneShot; }
protected:
bool oneShot ; bool oneShot ;
int milli ; int milli ;
int lastMilli ; int lastMilli ;
long id; long id;
public:
wxTimer(void); private:
~wxTimer(void); DECLARE_ABSTRACT_CLASS(wxTimer)
virtual bool Start(int milliseconds = -1,bool one_shot = FALSE); // Start timer
virtual void Stop(void); // Stop timer
virtual void Notify(void) = 0; // Override this member
inline int Interval(void) { return milli ; }; // Returns the current interval time (0 if stop)
}; };
// Timer functions (milliseconds) // Timer functions (milliseconds)
void WXDLLEXPORT wxStartTimer(void); void WXDLLEXPORT wxStartTimer();
// Gets time since last wxStartTimer or wxGetElapsedTime // Gets time since last wxStartTimer or wxGetElapsedTime
long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE); long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
@@ -46,7 +54,7 @@ long WXDLLEXPORT wxGetElapsedTime(bool resetTimer = TRUE);
bool WXDLLEXPORT wxGetLocalTime(long *timeZone, int *dstObserved); bool WXDLLEXPORT wxGetLocalTime(long *timeZone, int *dstObserved);
// Get number of seconds since 00:00:00 GMT, Jan 1st 1970. // Get number of seconds since 00:00:00 GMT, Jan 1st 1970.
long WXDLLEXPORT wxGetCurrentTime(void); long WXDLLEXPORT wxGetCurrentTime();
#endif #endif
// _WX_TIMERH_ // _WX_TIMERH_

View File

@@ -20,22 +20,29 @@
class WXDLLEXPORT wxTimer: public wxObject class WXDLLEXPORT wxTimer: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTimer) public:
public:
wxTimer(); wxTimer();
~wxTimer(); ~wxTimer();
virtual bool Start(int milliseconds = -1,bool one_shot = FALSE); // Start timer
virtual bool Start(int milliseconds = -1,
bool one_shot = FALSE); // Start timer
virtual void Stop(); // Stop timer virtual void Stop(); // Stop timer
virtual void Notify() = 0; // Override this member virtual void Notify() = 0; // Override this member
inline int Interval() { return m_milli ; }; // Returns the current interval time (0 if stop)
// Returns the current interval time (0 if stop)
int Interval() const { return milli; };
bool OneShot() const { return oneShot; }
protected: protected:
bool m_oneShot ; bool oneShot ;
int m_milli ; int milli ;
int m_lastMilli ; int lastMilli ;
long m_id;
long id;
private:
DECLARE_ABSTRACT_CLASS(wxTimer)
}; };
/* Note: these are implemented in common/timercmn.cpp, so need to implement them separately. /* Note: these are implemented in common/timercmn.cpp, so need to implement them separately.

View File

@@ -20,22 +20,29 @@
class WXDLLEXPORT wxTimer: public wxObject class WXDLLEXPORT wxTimer: public wxObject
{ {
DECLARE_DYNAMIC_CLASS(wxTimer) public:
public:
wxTimer(); wxTimer();
~wxTimer(); ~wxTimer();
virtual bool Start(int milliseconds = -1,bool one_shot = FALSE); // Start timer
virtual bool Start(int milliseconds = -1,
bool one_shot = FALSE); // Start timer
virtual void Stop(); // Stop timer virtual void Stop(); // Stop timer
virtual void Notify() = 0; // Override this member virtual void Notify() = 0; // Override this member
inline int Interval() { return m_milli ; }; // Returns the current interval time (0 if stop)
// Returns the current interval time (0 if stop)
int Interval() const { return milli; };
bool OneShot() const { return oneShot; }
protected: protected:
bool m_oneShot ; bool oneShot ;
int m_milli ; int milli ;
int m_lastMilli ; int lastMilli ;
long m_id;
long id;
private:
DECLARE_ABSTRACT_CLASS(wxTimer)
}; };
/* Note: these are implemented in common/timercmn.cpp, so need to implement them separately. /* Note: these are implemented in common/timercmn.cpp, so need to implement them separately.

View File

@@ -6,7 +6,7 @@
#elif defined(__WXMOTIF__) #elif defined(__WXMOTIF__)
#include "wx/generic/treectrl.h" #include "wx/generic/treectrl.h"
#elif defined(__WXGTK__) #elif defined(__WXGTK__)
#include "wx/gtk/treectrl.h" #include "wx/generic/treectrl.h"
#elif defined(__WXQT__) #elif defined(__WXQT__)
#include "wx/qt/treectrl.h" #include "wx/qt/treectrl.h"
#elif defined(__WXMAC__) #elif defined(__WXMAC__)

View File

@@ -57,5 +57,8 @@
#undef FindResource #undef FindResource
#endif #endif
#else
// always include this file (under Unix it's generated by configure)
#include "wx/setup.h"
#endif #endif

View File

@@ -387,6 +387,7 @@ void wxLogStream::DoLogString(const char *szString)
(*m_ostr) << szString << endl << flush; (*m_ostr) << szString << endl << flush;
} }
#ifndef wxUSE_NOGUI
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxLogTextCtrl implementation // wxLogTextCtrl implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -410,8 +411,6 @@ wxLogTextCtrl::~wxLogTextCtrl()
// wxLogGui implementation // wxLogGui implementation
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
#ifndef wxUSE_NOGUI
wxLogGui::wxLogGui() wxLogGui::wxLogGui()
{ {
m_bErrors = FALSE; m_bErrors = FALSE;
@@ -960,6 +959,9 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg)
// send it to the normal log destination // send it to the normal log destination
wxLogDebug(szBuf); wxLogDebug(szBuf);
#ifdef wxUSE_NOGUI
Trap();
#else
strcat(szBuf, _("\nDo you want to stop the program?" strcat(szBuf, _("\nDo you want to stop the program?"
"\nYou can also choose [Cancel] to suppress " "\nYou can also choose [Cancel] to suppress "
"further warnings.")); "further warnings."));
@@ -976,6 +978,7 @@ void wxOnAssert(const char *szFile, int nLine, const char *szMsg)
//case wxNO: nothing to do //case wxNO: nothing to do
} }
#endif // USE_NOGUI
} }
s_bInAssert = FALSE; s_bInAssert = FALSE;

View File

@@ -69,6 +69,8 @@
#include "wx/string.h" #include "wx/string.h"
#include "wx/wxexpr.h" #include "wx/wxexpr.h"
#include "wx/settings.h"
// Forward (private) declarations // Forward (private) declarations
bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db); bool wxResourceInterpretResources(wxResourceTable& table, wxExprDatabase& db);
wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE); wxItemResource *wxResourceInterpretDialog(wxResourceTable& table, wxExpr *expr, bool isPanel = FALSE);

View File

@@ -21,9 +21,9 @@
#endif #endif
#if wxUSE_IOSTREAMH #if wxUSE_IOSTREAMH
#include <fstream.h> # include <fstream.h>
#else #else
#include <fstream> # include <fstream>
# ifdef _MSC_VER # ifdef _MSC_VER
using namespace std; using namespace std;
# endif # endif

View File

@@ -108,7 +108,7 @@ LIB_CPP_SRC=\
gtk/tbargtk.cpp \ gtk/tbargtk.cpp \
gtk/textctrl.cpp \ gtk/textctrl.cpp \
gtk/timer.cpp \ gtk/timer.cpp \
gtk/treectrl.cpp \ generic/treectrl.cpp \
gtk/utilsgtk.cpp \ gtk/utilsgtk.cpp \
gtk/utilsres.cpp \ gtk/utilsres.cpp \
gtk/window.cpp \ gtk/window.cpp \

View File

@@ -14,7 +14,6 @@
#endif #endif
#include "wx/toolbar.h" #include "wx/toolbar.h"
#include <wx/intl.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// data // data
@@ -30,8 +29,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex, wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
const wxBitmap& bitmap1, const wxBitmap& bitmap2, const wxBitmap& bitmap1, const wxBitmap& bitmap2,
bool toggle, wxObject *clientData, bool toggle,
const wxString& shortHelpString, const wxString& longHelpString, wxObject *clientData,
const wxString& shortHelpString,
const wxString& longHelpString,
GtkWidget *item ) GtkWidget *item )
{ {
m_owner = owner; m_owner = owner;
@@ -115,6 +116,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
m_widget = gtk_handle_box_new(); m_widget = gtk_handle_box_new();
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) ); m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) );
gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) ); gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
@@ -162,18 +164,22 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData, float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
const wxString& helpString1, const wxString& helpString2 ) const wxString& helpString1, const wxString& helpString2 )
{ {
if (!bitmap.Ok()) return (wxToolBarTool *) NULL; wxCHECK_MSG( bitmap.Ok(), (wxToolBarTool *)NULL,
"invalid bitmap for wxToolBar icon" );
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle, wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
clientData, helpString1, helpString2 ); toggle, clientData,
helpString1, helpString2 );
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL,
"wxToolBar doesn't support GdkBitmap" );
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL,
"wxToolBar::Add needs a wxBitmap" );
GtkWidget *tool_pixmap = (GtkWidget *) NULL; GtkWidget *tool_pixmap = (GtkWidget *) NULL;
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL, "wxToolBar doesn't support GdkBitmap" ) if (TRUE) // FIXME huh?
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL, "wxToolBar::Add needs a wxBitmap" )
if (TRUE)
{ {
GdkPixmap *pixmap = bitmap.GetPixmap(); GdkPixmap *pixmap = bitmap.GetPixmap();
@@ -185,32 +191,56 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON; #if 0
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON; GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
: GTK_TOOLBAR_CHILD_BUTTON;
tool->m_item = gtk_toolbar_append_element( tool->m_item = gtk_toolbar_append_element
m_toolbar, ctype, (GtkWidget *) NULL, (const char *) NULL, helpString1, "", (
tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool ); GTK_TOOLBAR(m_toolbar),
ctype,
(GtkWidget *)NULL,
(const char *)NULL,
helpString1,
"",
tool_pixmap,
(GtkSignalFunc)gtk_toolbar_callback,
(gpointer)tool
);
gtk_signal_connect( GTK_OBJECT(tool->m_item), "enter_notify_event", gtk_signal_connect( GTK_OBJECT(tool->m_item),
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback), (gpointer)tool ); "enter_notify_event",
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback),
(gpointer)tool );
#else
tool->m_item = gtk_toolbar_append_item
(
GTK_TOOLBAR(m_toolbar),
(const char *)NULL,
helpString1,
"",
tool_pixmap,
(GtkSignalFunc)gtk_toolbar_callback,
(gpointer)tool
);
#endif
m_tools.Append( tool ); m_tools.Append( tool );
return tool; return tool;
} }
void wxToolBar::AddSeparator(void) void wxToolBar::AddSeparator()
{ {
gtk_toolbar_append_space( m_toolbar ); gtk_toolbar_append_space( m_toolbar );
} }
void wxToolBar::ClearTools(void) void wxToolBar::ClearTools()
{ {
wxFAIL_MSG( "wxToolBar::ClearTools not implemented" ); wxFAIL_MSG( "wxToolBar::ClearTools not implemented" );
} }
void wxToolBar::Realize(void) void wxToolBar::Realize()
{ {
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;
@@ -316,10 +346,12 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) ) void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
{ {
wxFAIL_MSG( "wxToolBar::SetMargins not implemented" );
} }
void wxToolBar::SetToolPacking( int WXUNUSED(packing) ) void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
{ {
wxFAIL_MSG( "wxToolBar::SetToolPacking not implemented" );
} }
void wxToolBar::SetToolSeparation( int separation ) void wxToolBar::SetToolSeparation( int separation )

View File

@@ -41,7 +41,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
END_EVENT_TABLE() END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf() wxTextCtrl::wxTextCtrl() : streambuf()
{ {
if (allocate()) setp(base(),ebuf()); if (allocate()) setp(base(),ebuf());
@@ -149,7 +149,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
return TRUE; return TRUE;
} }
wxString wxTextCtrl::GetValue(void) const wxString wxTextCtrl::GetValue() const
{ {
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -228,7 +228,7 @@ long wxTextCtrl::XYToPosition( long x, long y )
{ {
} }
int wxTextCtrl::GetNumberOfLines(void) int wxTextCtrl::GetNumberOfLines()
{ {
} }
@@ -242,7 +242,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
gtk_entry_set_position( GTK_ENTRY(m_text), tmp ); gtk_entry_set_position( GTK_ENTRY(m_text), tmp );
} }
void wxTextCtrl::SetInsertionPointEnd(void) void wxTextCtrl::SetInsertionPointEnd()
{ {
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -270,12 +270,12 @@ void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
wxFAIL_MSG(_("wxTextCtrl::ShowPosition not implemented")); wxFAIL_MSG(_("wxTextCtrl::ShowPosition not implemented"));
} }
long wxTextCtrl::GetInsertionPoint(void) const long wxTextCtrl::GetInsertionPoint() const
{ {
return (long) GTK_EDITABLE(m_text)->current_pos; return (long) GTK_EDITABLE(m_text)->current_pos;
} }
long wxTextCtrl::GetLastPosition(void) const long wxTextCtrl::GetLastPosition() const
{ {
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -298,22 +298,22 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
} }
void wxTextCtrl::Cut(void) void wxTextCtrl::Cut()
{ {
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 );
} }
void wxTextCtrl::Copy(void) void wxTextCtrl::Copy()
{ {
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 );
} }
void wxTextCtrl::Paste(void) void wxTextCtrl::Paste()
{ {
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
} }
void wxTextCtrl::Delete(void) void wxTextCtrl::Clear()
{ {
SetValue( "" ); SetValue( "" );
} }
@@ -350,7 +350,7 @@ int wxTextCtrl::overflow( int WXUNUSED(c) )
return EOF; return EOF;
} }
int wxTextCtrl::sync(void) int wxTextCtrl::sync()
{ {
int len = pptr() - pbase(); int len = pptr() - pbase();
char *txt = new char[len+1]; char *txt = new char[len+1];
@@ -362,7 +362,7 @@ int wxTextCtrl::sync(void)
return 0; return 0;
} }
int wxTextCtrl::underflow(void) int wxTextCtrl::underflow()
{ {
return EOF; return EOF;
} }
@@ -415,7 +415,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
return *this; return *this;
} }
GtkWidget* wxTextCtrl::GetConnectWidget(void) GtkWidget* wxTextCtrl::GetConnectWidget()
{ {
return GTK_WIDGET(m_text); return GTK_WIDGET(m_text);
} }

View File

@@ -19,53 +19,50 @@
// wxTimer // wxTimer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTimer,wxObject) IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
gint timeout_callback( gpointer data ) gint timeout_callback( gpointer data )
{ {
wxTimer *timer = (wxTimer*)data; wxTimer *timer = (wxTimer*)data;
timer->Notify(); timer->Notify();
if (timer->OneShot()) timer->Stop();
if ( timer->OneShot() )
timer->Stop();
return TRUE; return TRUE;
} }
wxTimer::wxTimer(void) wxTimer::wxTimer()
{ {
m_tag = -1; m_tag = -1;
m_time = 1000; m_time = 1000;
m_oneShot = FALSE; m_oneShot = FALSE;
} }
wxTimer::~wxTimer(void) wxTimer::~wxTimer()
{ {
Stop(); Stop();
} }
int wxTimer::Interval(void) bool wxTimer::Start( int millisecs, bool oneShot )
{ {
return m_time; if ( millisecs != -1 )
} m_time = millisecs;
bool wxTimer::OneShot(void)
{
return m_oneShot;
}
void wxTimer::Notify(void)
{
}
void wxTimer::Start( int millisecs, bool oneShot )
{
if (millisecs != -1) m_time = millisecs;
m_oneShot = oneShot; m_oneShot = oneShot;
m_tag = gtk_timeout_add( millisecs, timeout_callback, this ); m_tag = gtk_timeout_add( millisecs, timeout_callback, this );
return TRUE;
} }
void wxTimer::Stop(void) void wxTimer::Stop()
{ {
if (m_tag != -1) if ( m_tag != -1 )
{
gtk_timeout_remove( m_tag ); gtk_timeout_remove( m_tag );
m_tag = -1; m_tag = -1;
}
} }

View File

@@ -14,7 +14,6 @@
#endif #endif
#include "wx/toolbar.h" #include "wx/toolbar.h"
#include <wx/intl.h>
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// data // data
@@ -30,8 +29,10 @@ IMPLEMENT_DYNAMIC_CLASS(wxToolBarTool,wxObject)
wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex, wxToolBarTool::wxToolBarTool( wxToolBar *owner, int theIndex,
const wxBitmap& bitmap1, const wxBitmap& bitmap2, const wxBitmap& bitmap1, const wxBitmap& bitmap2,
bool toggle, wxObject *clientData, bool toggle,
const wxString& shortHelpString, const wxString& longHelpString, wxObject *clientData,
const wxString& shortHelpString,
const wxString& longHelpString,
GtkWidget *item ) GtkWidget *item )
{ {
m_owner = owner; m_owner = owner;
@@ -115,6 +116,7 @@ bool wxToolBar::Create( wxWindow *parent, wxWindowID id,
m_widget = gtk_handle_box_new(); m_widget = gtk_handle_box_new();
m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) ); m_toolbar = GTK_TOOLBAR( gtk_toolbar_new( GTK_ORIENTATION_HORIZONTAL, GTK_TOOLBAR_ICONS ) );
gtk_toolbar_set_tooltips( GTK_TOOLBAR(m_toolbar), TRUE );
gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) ); gtk_container_add( GTK_CONTAINER(m_widget), GTK_WIDGET(m_toolbar) );
@@ -162,18 +164,22 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData, float WXUNUSED(xPos), float WXUNUSED(yPos), wxObject *clientData,
const wxString& helpString1, const wxString& helpString2 ) const wxString& helpString1, const wxString& helpString2 )
{ {
if (!bitmap.Ok()) return (wxToolBarTool *) NULL; wxCHECK_MSG( bitmap.Ok(), (wxToolBarTool *)NULL,
"invalid bitmap for wxToolBar icon" );
wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap, toggle, wxToolBarTool *tool = new wxToolBarTool( this, toolIndex, bitmap, pushedBitmap,
clientData, helpString1, helpString2 ); toggle, clientData,
helpString1, helpString2 );
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL,
"wxToolBar doesn't support GdkBitmap" );
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL,
"wxToolBar::Add needs a wxBitmap" );
GtkWidget *tool_pixmap = (GtkWidget *) NULL; GtkWidget *tool_pixmap = (GtkWidget *) NULL;
wxCHECK_MSG( bitmap.GetBitmap() == NULL, (wxToolBarTool *)NULL, "wxToolBar doesn't support GdkBitmap" ) if (TRUE) // FIXME huh?
wxCHECK_MSG( bitmap.GetPixmap() != NULL, (wxToolBarTool *)NULL, "wxToolBar::Add needs a wxBitmap" )
if (TRUE)
{ {
GdkPixmap *pixmap = bitmap.GetPixmap(); GdkPixmap *pixmap = bitmap.GetPixmap();
@@ -185,32 +191,56 @@ wxToolBarTool *wxToolBar::AddTool( int toolIndex, const wxBitmap& bitmap,
gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 ); gtk_misc_set_alignment( GTK_MISC(tool_pixmap), 0.5, 0.5 );
GtkToolbarChildType ctype = GTK_TOOLBAR_CHILD_BUTTON; #if 0
if (toggle) ctype = GTK_TOOLBAR_CHILD_TOGGLEBUTTON; GtkToolbarChildType ctype = toggle ? GTK_TOOLBAR_CHILD_TOGGLEBUTTON
: GTK_TOOLBAR_CHILD_BUTTON;
tool->m_item = gtk_toolbar_append_element( tool->m_item = gtk_toolbar_append_element
m_toolbar, ctype, (GtkWidget *) NULL, (const char *) NULL, helpString1, "", (
tool_pixmap, (GtkSignalFunc)gtk_toolbar_callback, (gpointer)tool ); GTK_TOOLBAR(m_toolbar),
ctype,
(GtkWidget *)NULL,
(const char *)NULL,
helpString1,
"",
tool_pixmap,
(GtkSignalFunc)gtk_toolbar_callback,
(gpointer)tool
);
gtk_signal_connect( GTK_OBJECT(tool->m_item), "enter_notify_event", gtk_signal_connect( GTK_OBJECT(tool->m_item),
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback), (gpointer)tool ); "enter_notify_event",
GTK_SIGNAL_FUNC(gtk_toolbar_enter_callback),
(gpointer)tool );
#else
tool->m_item = gtk_toolbar_append_item
(
GTK_TOOLBAR(m_toolbar),
(const char *)NULL,
helpString1,
"",
tool_pixmap,
(GtkSignalFunc)gtk_toolbar_callback,
(gpointer)tool
);
#endif
m_tools.Append( tool ); m_tools.Append( tool );
return tool; return tool;
} }
void wxToolBar::AddSeparator(void) void wxToolBar::AddSeparator()
{ {
gtk_toolbar_append_space( m_toolbar ); gtk_toolbar_append_space( m_toolbar );
} }
void wxToolBar::ClearTools(void) void wxToolBar::ClearTools()
{ {
wxFAIL_MSG( "wxToolBar::ClearTools not implemented" ); wxFAIL_MSG( "wxToolBar::ClearTools not implemented" );
} }
void wxToolBar::Realize(void) void wxToolBar::Realize()
{ {
m_x = 0; m_x = 0;
m_y = 0; m_y = 0;
@@ -316,10 +346,12 @@ bool wxToolBar::GetToolEnabled(int toolIndex) const
void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) ) void wxToolBar::SetMargins( int WXUNUSED(x), int WXUNUSED(y) )
{ {
wxFAIL_MSG( "wxToolBar::SetMargins not implemented" );
} }
void wxToolBar::SetToolPacking( int WXUNUSED(packing) ) void wxToolBar::SetToolPacking( int WXUNUSED(packing) )
{ {
wxFAIL_MSG( "wxToolBar::SetToolPacking not implemented" );
} }
void wxToolBar::SetToolSeparation( int separation ) void wxToolBar::SetToolSeparation( int separation )

View File

@@ -41,7 +41,7 @@ BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
EVT_CHAR(wxTextCtrl::OnChar) EVT_CHAR(wxTextCtrl::OnChar)
END_EVENT_TABLE() END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf() wxTextCtrl::wxTextCtrl() : streambuf()
{ {
if (allocate()) setp(base(),ebuf()); if (allocate()) setp(base(),ebuf());
@@ -149,7 +149,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
return TRUE; return TRUE;
} }
wxString wxTextCtrl::GetValue(void) const wxString wxTextCtrl::GetValue() const
{ {
wxString tmp; wxString tmp;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -228,7 +228,7 @@ long wxTextCtrl::XYToPosition( long x, long y )
{ {
} }
int wxTextCtrl::GetNumberOfLines(void) int wxTextCtrl::GetNumberOfLines()
{ {
} }
@@ -242,7 +242,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
gtk_entry_set_position( GTK_ENTRY(m_text), tmp ); gtk_entry_set_position( GTK_ENTRY(m_text), tmp );
} }
void wxTextCtrl::SetInsertionPointEnd(void) void wxTextCtrl::SetInsertionPointEnd()
{ {
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -270,12 +270,12 @@ void wxTextCtrl::ShowPosition( long WXUNUSED(pos) )
wxFAIL_MSG(_("wxTextCtrl::ShowPosition not implemented")); wxFAIL_MSG(_("wxTextCtrl::ShowPosition not implemented"));
} }
long wxTextCtrl::GetInsertionPoint(void) const long wxTextCtrl::GetInsertionPoint() const
{ {
return (long) GTK_EDITABLE(m_text)->current_pos; return (long) GTK_EDITABLE(m_text)->current_pos;
} }
long wxTextCtrl::GetLastPosition(void) const long wxTextCtrl::GetLastPosition() const
{ {
int pos = 0; int pos = 0;
if (m_windowStyle & wxTE_MULTILINE) if (m_windowStyle & wxTE_MULTILINE)
@@ -298,22 +298,22 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &pos );
} }
void wxTextCtrl::Cut(void) void wxTextCtrl::Cut()
{ {
gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(m_text), 0 );
} }
void wxTextCtrl::Copy(void) void wxTextCtrl::Copy()
{ {
gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(m_text), 0 );
} }
void wxTextCtrl::Paste(void) void wxTextCtrl::Paste()
{ {
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
} }
void wxTextCtrl::Delete(void) void wxTextCtrl::Clear()
{ {
SetValue( "" ); SetValue( "" );
} }
@@ -350,7 +350,7 @@ int wxTextCtrl::overflow( int WXUNUSED(c) )
return EOF; return EOF;
} }
int wxTextCtrl::sync(void) int wxTextCtrl::sync()
{ {
int len = pptr() - pbase(); int len = pptr() - pbase();
char *txt = new char[len+1]; char *txt = new char[len+1];
@@ -362,7 +362,7 @@ int wxTextCtrl::sync(void)
return 0; return 0;
} }
int wxTextCtrl::underflow(void) int wxTextCtrl::underflow()
{ {
return EOF; return EOF;
} }
@@ -415,7 +415,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
return *this; return *this;
} }
GtkWidget* wxTextCtrl::GetConnectWidget(void) GtkWidget* wxTextCtrl::GetConnectWidget()
{ {
return GTK_WIDGET(m_text); return GTK_WIDGET(m_text);
} }

View File

@@ -19,53 +19,50 @@
// wxTimer // wxTimer
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxTimer,wxObject) IMPLEMENT_ABSTRACT_CLASS(wxTimer,wxObject)
gint timeout_callback( gpointer data ) gint timeout_callback( gpointer data )
{ {
wxTimer *timer = (wxTimer*)data; wxTimer *timer = (wxTimer*)data;
timer->Notify(); timer->Notify();
if (timer->OneShot()) timer->Stop();
if ( timer->OneShot() )
timer->Stop();
return TRUE; return TRUE;
} }
wxTimer::wxTimer(void) wxTimer::wxTimer()
{ {
m_tag = -1; m_tag = -1;
m_time = 1000; m_time = 1000;
m_oneShot = FALSE; m_oneShot = FALSE;
} }
wxTimer::~wxTimer(void) wxTimer::~wxTimer()
{ {
Stop(); Stop();
} }
int wxTimer::Interval(void) bool wxTimer::Start( int millisecs, bool oneShot )
{ {
return m_time; if ( millisecs != -1 )
} m_time = millisecs;
bool wxTimer::OneShot(void)
{
return m_oneShot;
}
void wxTimer::Notify(void)
{
}
void wxTimer::Start( int millisecs, bool oneShot )
{
if (millisecs != -1) m_time = millisecs;
m_oneShot = oneShot; m_oneShot = oneShot;
m_tag = gtk_timeout_add( millisecs, timeout_callback, this ); m_tag = gtk_timeout_add( millisecs, timeout_callback, this );
return TRUE;
} }
void wxTimer::Stop(void) void wxTimer::Stop()
{ {
if (m_tag != -1) if ( m_tag != -1 )
{
gtk_timeout_remove( m_tag ); gtk_timeout_remove( m_tag );
m_tag = -1; m_tag = -1;
}
} }