Added wxRadioButton (not tested)

Added wxValidator to constructros
  Added resource.cpp
  Added parser stuff
  Added the coolest Makefile.in
  Added callbacks to Menu
  Changed parser.y to include lexer.c for wxGTK
    (Is that right?)
  Can't remeber havning changed the printing stuff.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@530 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-08-14 10:07:38 +00:00
parent 3ebece2bda
commit 6de97a3b94
74 changed files with 1347 additions and 926 deletions

View File

@@ -1,2 +1,4 @@
system.list system.list
bin bin
.gdb_history
Test

View File

@@ -598,7 +598,7 @@ class wxListCtrl: public wxControl
void SetSingleStyle( long style, bool add = TRUE ) ; void SetSingleStyle( long style, bool add = TRUE ) ;
void SetWindowStyleFlag(long style); void SetWindowStyleFlag(long style);
void RecreateWindow(void) {}; void RecreateWindow(void) {};
long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE); long GetNextItem(long item, int geometry = wxLIST_NEXT_ALL, int state = wxLIST_STATE_DONTCARE) const;
wxImageList *GetImageList(int which); wxImageList *GetImageList(int which);
void SetImageList(wxImageList *imageList, int which) ; void SetImageList(wxImageList *imageList, int which) ;
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC

View File

@@ -44,12 +44,19 @@ class wxBitmapButton: public wxControl
public: public:
wxBitmapButton(void); wxBitmapButton(void);
wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxButtonNameStr ); const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
bool Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxValidator& validator = wxDefaultValidator,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxButtonNameStr)
long style = 0, const wxString &name = wxButtonNameStr ); {
Create(parent, id, bitmap, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
void SetDefault(void); void SetDefault(void);
void SetLabel( const wxString &label ); void SetLabel( const wxString &label );
wxString GetLabel(void) const; wxString GetLabel(void) const;

View File

@@ -44,12 +44,19 @@ class wxButton: public wxControl
public: public:
wxButton(void); wxButton(void);
wxButton( wxWindow *parent, wxWindowID id, const wxString &label, inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxButtonNameStr ); const wxSize& size = wxDefaultSize, long style = 0,
bool Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxValidator& validator = wxDefaultValidator,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxButtonNameStr)
long style = 0, const wxString &name = wxButtonNameStr ); {
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
void SetDefault(void); void SetDefault(void);
void SetLabel( const wxString &label ); void SetLabel( const wxString &label );
}; };

View File

@@ -44,12 +44,19 @@ class wxCheckBox: public wxControl
public: public:
wxCheckBox(void); wxCheckBox(void);
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label, inline wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxCheckBoxNameStr ); const wxSize& size = wxDefaultSize, long style = 0,
bool Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxValidator& validator = wxDefaultValidator,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxCheckBoxNameStr)
long style = 0, const wxString &name = wxCheckBoxNameStr ); {
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr );
void SetValue( bool state ); void SetValue( bool state );
bool GetValue(void) const; bool GetValue(void) const;
}; };

View File

@@ -44,14 +44,23 @@ class wxChoice: public wxControl
public: public:
wxChoice(void); wxChoice(void);
wxChoice( wxWindow *parent, wxWindowID id, inline wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxChoiceNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr )
{
Create(parent, id, pos, size, n, choices, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxChoiceNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr );
void Append( const wxString &item ); void Append( const wxString &item );
void Clear(void); void Clear(void);
int FindString( const wxString &string ) const; int FindString( const wxString &string ) const;

View File

@@ -50,17 +50,18 @@ class wxComboBox: public wxControl
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) const wxString& name = wxComboBoxNameStr)
{ {
Create(parent, id, value, pos, size, n, choices, style, name); Create(parent, id, value, pos, size, n, choices, style, validator, name);
} }
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr); const wxString& name = wxComboBoxNameStr);
// List functions // List functions

View File

@@ -88,6 +88,8 @@ public:
virtual wxString GetTitle() const { return m_title; } virtual wxString GetTitle() const { return m_title; }
virtual void SetIcon( const wxIcon &icon ); virtual void SetIcon( const wxIcon &icon );
void Iconize( bool WXUNUSED(iconize)) { }
bool IsIconized(void) const { return FALSE; }
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );

View File

@@ -44,34 +44,34 @@ class wxGauge: public wxControl
public: public:
inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; } inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; }
inline wxGauge(wxWindow *parent, wxWindowID id, inline wxGauge( wxWindow *parent, wxWindowID id,
int range, int range,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL, long style = wxGA_HORIZONTAL,
const wxString& name = wxGaugeNameStr) const wxValidator& validator = wxDefaultValidator,
{ const wxString& name = wxGaugeNameStr )
Create(parent, id, range, pos, size, style, name); {
}; Create(parent, id, range, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
int range, int range,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL, long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxGaugeNameStr ); const wxString& name = wxGaugeNameStr );
void SetShadowWidth( int WXUNUSED(w) ) {};
void SetBezelFace( int WXUNUSED(w) ) {};
void SetRange( int r );
void SetValue( int pos );
int GetShadowWidth(void) const { return 0; };
int GetBezelFace(void) const { return 0; };
int GetRange(void) const;
int GetValue(void) const;
void SetShadowWidth( int WXUNUSED(w) ) {}; // Are we a Win95/GTK progress bar, or a normal gauge?
void SetBezelFace( int WXUNUSED(w) ) {}; inline bool GetProgressBar(void) const { return m_useProgressBar; }
void SetRange( int r );
void SetValue( int pos );
int GetShadowWidth(void) const { return 0; };
int GetBezelFace(void) const { return 0; };
int GetRange(void) const;
int GetValue(void) const;
// Are we a Win95/GTK progress bar, or a normal gauge?
inline bool GetProgressBar(void) const { return m_useProgressBar; }
protected: protected:

View File

@@ -45,14 +45,23 @@ class wxListBox: public wxControl
public: public:
wxListBox(void); wxListBox(void);
wxListBox( wxWindow *parent, wxWindowID id, inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxListBoxNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
Create(parent, id, pos, size, n, choices, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxListBoxNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr );
void Append( const wxString &item ); void Append( const wxString &item );
void Append( const wxString &item, char *clientData ); void Append( const wxString &item, char *clientData );
void Clear(void); void Clear(void);

View File

@@ -123,7 +123,7 @@ DECLARE_DYNAMIC_CLASS(wxMenu)
public: public:
// construction // construction
wxMenu( const wxString &title = "" ); wxMenu( const wxString& title = wxEmptyString, const wxFunction func = NULL );
// operations // operations
// menu creation // menu creation
@@ -149,16 +149,23 @@ public:
// accessors // accessors
wxList& GetItems() { return m_items; } wxList& GetItems() { return m_items; }
inline void Callback(const wxFunction func) { m_callback = func; }
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
public: public:
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
void SetInvokingWindow( wxWindow *win ); void SetInvokingWindow( wxWindow *win );
wxWindow *GetInvokingWindow(); wxWindow *GetInvokingWindow();
wxString m_title; wxString m_title;
wxList m_items; wxList m_items;
wxWindow *m_invokingWindow; wxWindow *m_invokingWindow;
wxFunction m_callback;
wxEvtHandler *m_eventHandler;
GtkWidget *m_menu; // GtkMenu GtkWidget *m_menu; // GtkMenu
}; };
#endif // __GTKMENUH__ #endif // __GTKMENUH__

View File

@@ -46,16 +46,21 @@ class wxRadioBox: public wxControl
public: public:
wxRadioBox(void); wxRadioBox(void);
wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title, inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxString &name = wxRadioBoxNameStr ); const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr )
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
}
bool Create( wxWindow *parent, wxWindowID id, const wxString& title, bool Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxString &name = wxRadioBoxNameStr ); const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr );
int FindString( const wxString& s) const; int FindString( const wxString& s) const;
void SetSelection( int n ); void SetSelection( int n );
int GetSelection(void) const; int GetSelection(void) const;

View File

@@ -27,5 +27,40 @@
class wxRadioButton; class wxRadioButton;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern const char* wxRadioButtonNameStr;
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
class wxRadioButton: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxRadioButton)
public:
inline wxRadioButton(void) {}
inline wxRadioButton( wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRadioButtonNameStr )
{
Create( parent, id, label, pos, size, style, validator, name );
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRadioButtonNameStr );
virtual void SetLabel(const wxString& label);
virtual void SetValue(bool val);
virtual bool GetValue(void) const;
};
#endif // __GTKRADIOBUTTONH__ #endif // __GTKRADIOBUTTONH__

View File

@@ -43,17 +43,22 @@ class wxScrollBar: public wxControl
public: public:
wxScrollBar(void) { m_adjust = NULL; m_oldPos = 0.0; }; wxScrollBar(void) { m_adjust = NULL; m_oldPos = 0.0; };
wxScrollBar(wxWindow *parent, wxWindowID id, inline wxScrollBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL, long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxScrollBarNameStr )
{
Create( parent, id, pos, size, style, validator, name );
}
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxScrollBarNameStr ); const wxString& name = wxScrollBarNameStr );
~wxScrollBar(void); ~wxScrollBar(void);
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxString& name = wxScrollBarNameStr);
int GetPosition(void) const; int GetPosition(void) const;
int GetThumbSize() const; int GetThumbSize() const;
int GetPageSize() const; int GetPageSize() const;

View File

@@ -43,21 +43,24 @@ class wxSlider: public wxControl
public: public:
wxSlider(void); wxSlider(void);
wxSlider( wxWindow *parent, wxWindowID id, inline wxSlider( wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue, int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL, long style = wxSL_HORIZONTAL,
/* const wxValidator& validator = wxDefaultValidator, */ const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr); const wxString& name = wxSliderNameStr )
~wxSlider(void); {
bool Create(wxWindow *parent, wxWindowID id, Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name );
}
~wxSlider(void);
bool Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue, int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL, long style = wxSL_HORIZONTAL,
/* const wxValidator& validator = wxDefaultValidator, */ const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr); const wxString& name = wxSliderNameStr );
virtual int GetValue(void) const; virtual int GetValue(void) const;
virtual void SetValue( int ); virtual void SetValue( int );
void GetSize( int *x, int *y ) const; void GetSize( int *x, int *y ) const;

View File

@@ -52,10 +52,12 @@ public:
wxTextCtrl(); wxTextCtrl();
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "", wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int style = 0, const wxString &name = wxTextCtrlNameStr ); int style = 0, const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "", bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int style = 0, const wxString &name = wxTextCtrlNameStr ); int style = 0, const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr );
wxString GetValue() const; wxString GetValue() const;
void SetValue( const wxString &value ); void SetValue( const wxString &value );
void WriteText( const wxString &text ); void WriteText( const wxString &text );

View File

@@ -40,6 +40,8 @@ extern wxList wxTopLevelWindows;
class wxLayoutConstraints; class wxLayoutConstraints;
class wxSizer; class wxSizer;
class wxResourceTable;
class wxItemResource;
class wxWindow; class wxWindow;
class wxCanvas; class wxCanvas;
@@ -60,13 +62,24 @@ class wxWindow: public wxEvtHandler
{ {
public: public:
wxWindow(); wxWindow();
wxWindow( wxWindow *parent, wxWindowID id, inline wxWindow(wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxPanelNameStr ); const wxSize& size = wxDefaultSize,
bool Create( wxWindow *parent, wxWindowID id, long style = 0,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxPanelNameStr)
long style = 0, const wxString &name = wxPanelNameStr ); {
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
virtual ~wxWindow(); virtual ~wxWindow();
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL);
bool Close( bool force = FALSE ); bool Close( bool force = FALSE );
virtual bool Destroy(); virtual bool Destroy();
virtual bool DestroyChildren(); virtual bool DestroyChildren();
@@ -107,7 +120,7 @@ public:
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
virtual wxValidator *GetValidator(); virtual wxValidator *GetValidator();
virtual void SetValidator( wxValidator *validator ); virtual void SetValidator( const wxValidator &validator );
bool IsBeingDeleted(); bool IsBeingDeleted();
@@ -123,6 +136,8 @@ public:
virtual wxColour GetBackgroundColour() const; virtual wxColour GetBackgroundColour() const;
virtual void SetBackgroundColour( const wxColour &colour ); virtual void SetBackgroundColour( const wxColour &colour );
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
virtual void SetDefaultBackgroundColour( const wxColour& col ) virtual void SetDefaultBackgroundColour( const wxColour& col )
{ m_defaultBackgroundColour = col; }; { m_defaultBackgroundColour = col; };

View File

@@ -44,12 +44,19 @@ class wxBitmapButton: public wxControl
public: public:
wxBitmapButton(void); wxBitmapButton(void);
wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, inline wxBitmapButton(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxButtonNameStr ); const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
bool Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, const wxValidator& validator = wxDefaultValidator,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxButtonNameStr)
long style = 0, const wxString &name = wxButtonNameStr ); {
Create(parent, id, bitmap, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxBitmap& bitmap,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = wxBU_AUTODRAW,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
void SetDefault(void); void SetDefault(void);
void SetLabel( const wxString &label ); void SetLabel( const wxString &label );
wxString GetLabel(void) const; wxString GetLabel(void) const;

View File

@@ -44,12 +44,19 @@ class wxButton: public wxControl
public: public:
wxButton(void); wxButton(void);
wxButton( wxWindow *parent, wxWindowID id, const wxString &label, inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxButtonNameStr ); const wxSize& size = wxDefaultSize, long style = 0,
bool Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxValidator& validator = wxDefaultValidator,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxButtonNameStr)
long style = 0, const wxString &name = wxButtonNameStr ); {
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
void SetDefault(void); void SetDefault(void);
void SetLabel( const wxString &label ); void SetLabel( const wxString &label );
}; };

View File

@@ -44,12 +44,19 @@ class wxCheckBox: public wxControl
public: public:
wxCheckBox(void); wxCheckBox(void);
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label, inline wxCheckBox( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxCheckBoxNameStr ); const wxSize& size = wxDefaultSize, long style = 0,
bool Create( wxWindow *parent, wxWindowID id, const wxString &label, const wxValidator& validator = wxDefaultValidator,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxCheckBoxNameStr)
long style = 0, const wxString &name = wxCheckBoxNameStr ); {
Create(parent, id, label, pos, size, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxCheckBoxNameStr );
void SetValue( bool state ); void SetValue( bool state );
bool GetValue(void) const; bool GetValue(void) const;
}; };

View File

@@ -44,14 +44,23 @@ class wxChoice: public wxControl
public: public:
wxChoice(void); wxChoice(void);
wxChoice( wxWindow *parent, wxWindowID id, inline wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxChoiceNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr )
{
Create(parent, id, pos, size, n, choices, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxChoiceNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr );
void Append( const wxString &item ); void Append( const wxString &item );
void Clear(void); void Clear(void);
int FindString( const wxString &string ) const; int FindString( const wxString &string ) const;

View File

@@ -50,17 +50,18 @@ class wxComboBox: public wxControl
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr) const wxString& name = wxComboBoxNameStr)
{ {
Create(parent, id, value, pos, size, n, choices, style, name); Create(parent, id, value, pos, size, n, choices, style, validator, name);
} }
bool Create(wxWindow *parent, wxWindowID id, bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString, const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
long style = 0, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr); const wxString& name = wxComboBoxNameStr);
// List functions // List functions

View File

@@ -88,6 +88,8 @@ public:
virtual wxString GetTitle() const { return m_title; } virtual wxString GetTitle() const { return m_title; }
virtual void SetIcon( const wxIcon &icon ); virtual void SetIcon( const wxIcon &icon );
void Iconize( bool WXUNUSED(iconize)) { }
bool IsIconized(void) const { return FALSE; }
void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp void OnActivate( wxActivateEvent &WXUNUSED(event) ) { } // called from docview.cpp
void OnSize( wxSizeEvent &event ); void OnSize( wxSizeEvent &event );

View File

@@ -44,34 +44,34 @@ class wxGauge: public wxControl
public: public:
inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; } inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = TRUE; }
inline wxGauge(wxWindow *parent, wxWindowID id, inline wxGauge( wxWindow *parent, wxWindowID id,
int range, int range,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL, long style = wxGA_HORIZONTAL,
const wxString& name = wxGaugeNameStr) const wxValidator& validator = wxDefaultValidator,
{ const wxString& name = wxGaugeNameStr )
Create(parent, id, range, pos, size, style, name); {
}; Create(parent, id, range, pos, size, style, validator, name);
}
bool Create(wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
int range, int range,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL, long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxGaugeNameStr ); const wxString& name = wxGaugeNameStr );
void SetShadowWidth( int WXUNUSED(w) ) {};
void SetBezelFace( int WXUNUSED(w) ) {};
void SetRange( int r );
void SetValue( int pos );
int GetShadowWidth(void) const { return 0; };
int GetBezelFace(void) const { return 0; };
int GetRange(void) const;
int GetValue(void) const;
void SetShadowWidth( int WXUNUSED(w) ) {}; // Are we a Win95/GTK progress bar, or a normal gauge?
void SetBezelFace( int WXUNUSED(w) ) {}; inline bool GetProgressBar(void) const { return m_useProgressBar; }
void SetRange( int r );
void SetValue( int pos );
int GetShadowWidth(void) const { return 0; };
int GetBezelFace(void) const { return 0; };
int GetRange(void) const;
int GetValue(void) const;
// Are we a Win95/GTK progress bar, or a normal gauge?
inline bool GetProgressBar(void) const { return m_useProgressBar; }
protected: protected:

View File

@@ -45,14 +45,23 @@ class wxListBox: public wxControl
public: public:
wxListBox(void); wxListBox(void);
wxListBox( wxWindow *parent, wxWindowID id, inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxListBoxNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
Create(parent, id, pos, size, n, choices, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id, bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
int n = 0, const wxString choices[] = NULL, const wxSize& size = wxDefaultSize,
long style = 0, const wxString &name = wxListBoxNameStr ); int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr );
void Append( const wxString &item ); void Append( const wxString &item );
void Append( const wxString &item, char *clientData ); void Append( const wxString &item, char *clientData );
void Clear(void); void Clear(void);

View File

@@ -123,7 +123,7 @@ DECLARE_DYNAMIC_CLASS(wxMenu)
public: public:
// construction // construction
wxMenu( const wxString &title = "" ); wxMenu( const wxString& title = wxEmptyString, const wxFunction func = NULL );
// operations // operations
// menu creation // menu creation
@@ -149,16 +149,23 @@ public:
// accessors // accessors
wxList& GetItems() { return m_items; } wxList& GetItems() { return m_items; }
inline void Callback(const wxFunction func) { m_callback = func; }
inline void SetEventHandler(wxEvtHandler *handler) { m_eventHandler = handler; }
inline wxEvtHandler *GetEventHandler() { return m_eventHandler; }
public: public:
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const; int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
void SetInvokingWindow( wxWindow *win ); void SetInvokingWindow( wxWindow *win );
wxWindow *GetInvokingWindow(); wxWindow *GetInvokingWindow();
wxString m_title; wxString m_title;
wxList m_items; wxList m_items;
wxWindow *m_invokingWindow; wxWindow *m_invokingWindow;
wxFunction m_callback;
wxEvtHandler *m_eventHandler;
GtkWidget *m_menu; // GtkMenu GtkWidget *m_menu; // GtkMenu
}; };
#endif // __GTKMENUH__ #endif // __GTKMENUH__

View File

@@ -46,16 +46,21 @@ class wxRadioBox: public wxControl
public: public:
wxRadioBox(void); wxRadioBox(void);
wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title, inline wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxString &name = wxRadioBoxNameStr ); const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr )
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, val, name );
}
bool Create( wxWindow *parent, wxWindowID id, const wxString& title, bool Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL, int n = 0, const wxString choices[] = NULL,
int majorDim = 0, long style = wxRA_HORIZONTAL, int majorDim = 0, long style = wxRA_HORIZONTAL,
const wxString &name = wxRadioBoxNameStr ); const wxValidator& val = wxDefaultValidator,
const wxString& name = wxRadioBoxNameStr );
int FindString( const wxString& s) const; int FindString( const wxString& s) const;
void SetSelection( int n ); void SetSelection( int n );
int GetSelection(void) const; int GetSelection(void) const;

View File

@@ -27,5 +27,40 @@
class wxRadioButton; class wxRadioButton;
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern const char* wxRadioButtonNameStr;
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
class wxRadioButton: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxRadioButton)
public:
inline wxRadioButton(void) {}
inline wxRadioButton( wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRadioButtonNameStr )
{
Create( parent, id, label, pos, size, style, validator, name );
}
bool Create(wxWindow *parent, wxWindowID id,
const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxRadioButtonNameStr );
virtual void SetLabel(const wxString& label);
virtual void SetValue(bool val);
virtual bool GetValue(void) const;
};
#endif // __GTKRADIOBUTTONH__ #endif // __GTKRADIOBUTTONH__

View File

@@ -43,17 +43,22 @@ class wxScrollBar: public wxControl
public: public:
wxScrollBar(void) { m_adjust = NULL; m_oldPos = 0.0; }; wxScrollBar(void) { m_adjust = NULL; m_oldPos = 0.0; };
wxScrollBar(wxWindow *parent, wxWindowID id, inline wxScrollBar( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL, long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxScrollBarNameStr )
{
Create( parent, id, pos, size, style, validator, name );
}
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxScrollBarNameStr ); const wxString& name = wxScrollBarNameStr );
~wxScrollBar(void); ~wxScrollBar(void);
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxSB_HORIZONTAL,
const wxString& name = wxScrollBarNameStr);
int GetPosition(void) const; int GetPosition(void) const;
int GetThumbSize() const; int GetThumbSize() const;
int GetPageSize() const; int GetPageSize() const;

View File

@@ -43,21 +43,24 @@ class wxSlider: public wxControl
public: public:
wxSlider(void); wxSlider(void);
wxSlider( wxWindow *parent, wxWindowID id, inline wxSlider( wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue, int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL, long style = wxSL_HORIZONTAL,
/* const wxValidator& validator = wxDefaultValidator, */ const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr); const wxString& name = wxSliderNameStr )
~wxSlider(void); {
bool Create(wxWindow *parent, wxWindowID id, Create( parent, id, value, minValue, maxValue, pos, size, style, validator, name );
}
~wxSlider(void);
bool Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue, int value, int minValue, int maxValue,
const wxPoint& pos = wxDefaultPosition, const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, const wxSize& size = wxDefaultSize,
long style = wxSL_HORIZONTAL, long style = wxSL_HORIZONTAL,
/* const wxValidator& validator = wxDefaultValidator, */ const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxSliderNameStr); const wxString& name = wxSliderNameStr );
virtual int GetValue(void) const; virtual int GetValue(void) const;
virtual void SetValue( int ); virtual void SetValue( int );
void GetSize( int *x, int *y ) const; void GetSize( int *x, int *y ) const;

View File

@@ -52,10 +52,12 @@ public:
wxTextCtrl(); wxTextCtrl();
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "", wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int style = 0, const wxString &name = wxTextCtrlNameStr ); int style = 0, const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "", bool Create( wxWindow *parent, wxWindowID id, const wxString &value = "",
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int style = 0, const wxString &name = wxTextCtrlNameStr ); int style = 0, const wxValidator& validator = wxDefaultValidator,
const wxString &name = wxTextCtrlNameStr );
wxString GetValue() const; wxString GetValue() const;
void SetValue( const wxString &value ); void SetValue( const wxString &value );
void WriteText( const wxString &text ); void WriteText( const wxString &text );

View File

@@ -40,6 +40,8 @@ extern wxList wxTopLevelWindows;
class wxLayoutConstraints; class wxLayoutConstraints;
class wxSizer; class wxSizer;
class wxResourceTable;
class wxItemResource;
class wxWindow; class wxWindow;
class wxCanvas; class wxCanvas;
@@ -60,13 +62,24 @@ class wxWindow: public wxEvtHandler
{ {
public: public:
wxWindow(); wxWindow();
wxWindow( wxWindow *parent, wxWindowID id, inline wxWindow(wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxPoint& pos = wxDefaultPosition,
long style = 0, const wxString &name = wxPanelNameStr ); const wxSize& size = wxDefaultSize,
bool Create( wxWindow *parent, wxWindowID id, long style = 0,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize, const wxString& name = wxPanelNameStr)
long style = 0, const wxString &name = wxPanelNameStr ); {
Create(parent, id, pos, size, style, name);
}
bool Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
const wxString& name = wxPanelNameStr);
virtual ~wxWindow(); virtual ~wxWindow();
virtual bool LoadFromResource(wxWindow *parent, const wxString& resourceName, const wxResourceTable *table = NULL);
virtual wxControl *CreateItem(const wxItemResource *childResource, const wxResourceTable *table = NULL);
bool Close( bool force = FALSE ); bool Close( bool force = FALSE );
virtual bool Destroy(); virtual bool Destroy();
virtual bool DestroyChildren(); virtual bool DestroyChildren();
@@ -107,7 +120,7 @@ public:
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE ); wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
virtual wxValidator *GetValidator(); virtual wxValidator *GetValidator();
virtual void SetValidator( wxValidator *validator ); virtual void SetValidator( const wxValidator &validator );
bool IsBeingDeleted(); bool IsBeingDeleted();
@@ -123,6 +136,8 @@ public:
virtual wxColour GetBackgroundColour() const; virtual wxColour GetBackgroundColour() const;
virtual void SetBackgroundColour( const wxColour &colour ); virtual void SetBackgroundColour( const wxColour &colour );
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
virtual void SetDefaultBackgroundColour( const wxColour& col ) virtual void SetDefaultBackgroundColour( const wxColour& col )
{ m_defaultBackgroundColour = col; }; { m_defaultBackgroundColour = col; };

View File

@@ -1 +1 @@
include ../src/gtk/setup/general/makedirs include ../install/unix/setup/general/makedirs

View File

@@ -20,13 +20,23 @@ include @MAKEINCLUDE@
LIB_CPP_ALL_SRC=$(LIB_CPP_SRC) @GTK_JOYSTICK@ @UNIX_THREAD@ LIB_CPP_ALL_SRC=$(LIB_CPP_SRC) @GTK_JOYSTICK@ @UNIX_THREAD@
LIB_C_ALL_SRC=$(LIB_C_SRC) parser.c
#define library objects #define library objects
LIB_OBJ=\ LIB_OBJ=\
$(LIB_CPP_ALL_SRC:.cpp=.o) \ $(LIB_CPP_ALL_SRC:.cpp=.o) \
$(LIB_C_SRC:.c=.o) $(LIB_C_ALL_SRC:.c=.o)
all:: all::
-../mkdirs @if test ! -d gtk; then mkdir gtk; fi
@if test ! -d qt; then mkdir qt; fi
@if test ! -d motif; then mkdir motif; fi
@if test ! -d common; then mkdir common; fi
@if test ! -d generic; then mkdir generic; fi
@if test ! -d png; then mkdir png; fi
@if test ! -d zlib; then mkdir zlib; fi
@if test ! -d gdk_imlib; then mkdir gdk_imlib; fi
@if test ! -d iodbc; then mkdir iodbc; fi
clean:: clean::
$(RM) -rf gtk $(RM) -rf gtk
@@ -38,6 +48,7 @@ clean::
$(RM) -rf zlib $(RM) -rf zlib
$(RM) -rf gdk_imlib $(RM) -rf gdk_imlib
$(RM) -rf iodbc $(RM) -rf iodbc
@$(RM) lexer.c parser.c
#additional things needed for compile #additional things needed for compile
ADD_COMPILE= \ ADD_COMPILE= \
@@ -45,3 +56,34 @@ ADD_COMPILE= \
# include the definitions now # include the definitions now
include ../../template.mak include ../../template.mak
# things for the prolog stuff
parser.c: ../common/parser.y lexer.c
@if test ! -f parser.y; then \
cp -f ../common/parser.y . ; \
fi
@$(YACC) parser.y
@sed -e "s/y.tab.c/parser.y/g" < y.tab.c | \
sed -e "s/BUFSIZ/5000/g" | \
sed -e "s/YYLMAX 200/YYLMAX 5000/g" | \
sed -e "s/yy/PROIO_yy/g" | \
sed -e "s/input/PROIO_input/g" | \
sed -e "s/unput/PROIO_unput/g" > parser.c
@$(RM) y.tab.c
@$(RM) parser.y
lexer.c: ../common/lexer.l
@if test ! -f lexer.l; then \
cp -f ../common/lexer.l . ;\
fi
@$(LEX) lexer.l
@sed -e "s/lex.yy.c/lexer.l/g" < lex.yy.c | \
sed -e "s/yy/PROIO_yy/g" | \
sed -e "s/input/PROIO_input/g" | \
sed -e "s/unput/PROIO_unput/g" > lexer.c
@$(RM) lex.yy.c
@$(RM) lexer.l
clean::

View File

@@ -117,7 +117,11 @@ arg1 : WORD
%% %%
#ifdef __WXGTK__
#include "lexer.c"
#else
#include "../common/lex_yy.c" #include "../common/lex_yy.c"
#endif
/* /*
void yyerror(s) void yyerror(s)

View File

@@ -31,6 +31,7 @@
#include "wx/menu.h" #include "wx/menu.h"
#include "wx/stattext.h" #include "wx/stattext.h"
#include "wx/button.h" #include "wx/button.h"
#include "wx/bmpbuttn.h"
#include "wx/radiobox.h" #include "wx/radiobox.h"
#include "wx/listbox.h" #include "wx/listbox.h"
#include "wx/choice.h" #include "wx/choice.h"
@@ -41,7 +42,8 @@
#include "wx/gauge.h" #include "wx/gauge.h"
#endif #endif
#include "wx/textctrl.h" #include "wx/textctrl.h"
#include "wx/msgbxdlg.h" #include "wx/msgdlg.h"
#include "wx/intl.h"
#endif #endif
#if USE_SCROLLBAR #if USE_SCROLLBAR
@@ -2125,7 +2127,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
break; break;
} }
#endif #endif
#ifdef __X__ #ifdef __WXGTK__
case RESOURCE_PLATFORM_X: case RESOURCE_PLATFORM_X:
{ {
if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) if (!optResource && ((noColours == 0) || (noColours <= thisNoColours)))
@@ -2169,7 +2171,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
{ {
case wxBITMAP_TYPE_XBM_DATA: case wxBITMAP_TYPE_XBM_DATA:
{ {
#ifdef __X__ #ifdef __WXGTK__
wxItemResource *item = table->FindResource(name); wxItemResource *item = table->FindResource(name);
if (!item) if (!item)
{ {
@@ -2185,7 +2187,7 @@ wxBitmap *wxResourceCreateBitmap(char *resource, wxResourceTable *table)
} }
case wxBITMAP_TYPE_XPM_DATA: case wxBITMAP_TYPE_XPM_DATA:
{ {
#if (defined(__X__) && USE_XPM_IN_X) || (defined(__WXMSW__) && USE_XPM_IN_MSW) #if (defined(__WXGTK__)) || (defined(__WXMSW__) && USE_XPM_IN_MSW)
wxItemResource *item = table->FindResource(name); wxItemResource *item = table->FindResource(name);
if (!item) if (!item)
{ {
@@ -2292,7 +2294,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
break; break;
} }
#endif #endif
#ifdef __X__ #ifdef __WXGTK__
case RESOURCE_PLATFORM_X: case RESOURCE_PLATFORM_X:
{ {
if (!optResource && ((noColours == 0) || (noColours <= thisNoColours))) if (!optResource && ((noColours == 0) || (noColours <= thisNoColours)))
@@ -2336,7 +2338,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
{ {
case wxBITMAP_TYPE_XBM_DATA: case wxBITMAP_TYPE_XBM_DATA:
{ {
#ifdef __X__ #ifdef __WXGTK__
wxItemResource *item = table->FindResource(name); wxItemResource *item = table->FindResource(name);
if (!item) if (!item)
{ {
@@ -2344,7 +2346,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
"Forgot to use wxResourceLoadIconData?"), name); "Forgot to use wxResourceLoadIconData?"), name);
return NULL; return NULL;
} }
icon = new wxIcon((char *)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3()); icon = new wxIcon((char **)item->GetValue1(), (int)item->GetValue2(), (int)item->GetValue3());
#else #else
wxLogWarning(_("No XBM facility available!")); wxLogWarning(_("No XBM facility available!"));
#endif #endif
@@ -2354,7 +2356,7 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
{ {
// *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS *** // *** XPM ICON NOT YET IMPLEMENTED IN WXWINDOWS ***
/* /*
#if (defined(__X__) && USE_XPM_IN_X) || (defined(__WXMSW__) && USE_XPM_IN_MSW) #if (defined(__WXGTK__)) || (defined(__WXMSW__) && USE_XPM_IN_MSW)
wxItemResource *item = table->FindResource(name); wxItemResource *item = table->FindResource(name);
if (!item) if (!item)
{ {
@@ -2373,7 +2375,11 @@ wxIcon *wxResourceCreateIcon(char *resource, wxResourceTable *table)
} }
default: default:
{ {
#ifdef __WXGTK__
wxLogWarning(_("Icon resource specification %s not found."), resource);
#else
icon = new wxIcon(name, bitmapType); icon = new wxIcon(name, bitmapType);
#endif
break; break;
} }
} }

View File

@@ -21,7 +21,7 @@
#endif #endif
#ifndef WX_PRECOMP #ifndef WX_PRECOMP
#include "wx.h" #include "wx/wx.h"
#endif #endif
#include "wx/validate.h" #include "wx/validate.h"

View File

@@ -2326,7 +2326,7 @@ long wxListCtrl::GetTopItem(void)
return 0; return 0;
}; };
long wxListCtrl::GetNextItem( long item, int geom, int state ) long wxListCtrl::GetNextItem( long item, int geom, int state ) const
{ {
return m_mainWin->GetNextItem( item, geom, state ); return m_mainWin->GetNextItem( item, geom, state );
}; };

View File

@@ -36,6 +36,7 @@ LIB_CPP_SRC=\
common/odbc.cpp \ common/odbc.cpp \
common/postscrp.cpp \ common/postscrp.cpp \
common/prntbase.cpp \ common/prntbase.cpp \
common/resource.cpp \
common/serbase.cpp \ common/serbase.cpp \
common/string.cpp \ common/string.cpp \
common/textfile.cpp \ common/textfile.cpp \
@@ -50,9 +51,12 @@ LIB_CPP_SRC=\
common/mstream.cpp \ common/mstream.cpp \
common/zstream.cpp \ common/zstream.cpp \
common/objstrm.cpp \ common/objstrm.cpp \
common/validate.cpp \
common/wxexpr.cpp \
\ \
gtk/app.cpp \ gtk/app.cpp \
gtk/bitmap.cpp \ gtk/bitmap.cpp \
gtk/bmpbuttn.cpp \
gtk/brush.cpp \ gtk/brush.cpp \
gtk/button.cpp \ gtk/button.cpp \
gtk/checkbox.cpp \ gtk/checkbox.cpp \

View File

@@ -40,24 +40,17 @@ static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitma
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxBitmapButton::wxBitmapButton(void) wxBitmapButton::wxBitmapButton(void)
{ {
}; }
wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, bitmap, pos, size, style, name );
};
bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
@@ -65,6 +58,8 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
PreCreation( parent, id, pos, newSize, style, name ); PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_bitmap = bitmap; m_bitmap = bitmap;
m_label = ""; m_label = "";
@@ -78,7 +73,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
gtk_widget_show( pixmap ); gtk_widget_show( pixmap );
gtk_container_add( GTK_CONTAINER(m_widget), pixmap ); gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
}; }
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10; if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10; if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
@@ -92,18 +87,19 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxBitmapButton::SetDefault(void) void wxBitmapButton::SetDefault(void)
{ {
}; gtk_widget_grab_default( m_widget );
}
void wxBitmapButton::SetLabel( const wxString &label ) void wxBitmapButton::SetLabel( const wxString &label )
{ {
wxControl::SetLabel( label ); wxControl::SetLabel( label );
}; }
wxString wxBitmapButton::GetLabel(void) const wxString wxBitmapButton::GetLabel(void) const
{ {
return wxControl::GetLabel(); return wxControl::GetLabel();
}; }

View File

@@ -40,30 +40,25 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxButton::wxButton(void) wxButton::wxButton(void)
{ {
}; }
wxButton::wxButton( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
wxSize newSize = size; wxSize newSize = size;
PreCreation( parent, id, pos, newSize, style, name ); PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_widget = gtk_button_new_with_label( m_label ); m_widget = gtk_button_new_with_label( m_label );
SetLabel(label); SetLabel(label);
@@ -80,11 +75,12 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxButton::SetDefault(void) void wxButton::SetDefault(void)
{ {
}; gtk_widget_grab_default( m_widget );
}
void wxButton::SetLabel( const wxString &label ) void wxButton::SetLabel( const wxString &label )
{ {
@@ -92,5 +88,5 @@ void wxButton::SetLabel( const wxString &label )
GtkButton *bin = GTK_BUTTON( m_widget ); GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child ); GtkLabel *g_label = GTK_LABEL( bin->child );
gtk_label_set( g_label, GetLabel() ); gtk_label_set( g_label, GetLabel() );
}; }

View File

@@ -34,7 +34,7 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB
event.SetInt( cb->GetValue() ); event.SetInt( cb->GetValue() );
event.SetEventObject(cb); event.SetEventObject(cb);
cb->GetEventHandler()->ProcessEvent(event); cb->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -42,23 +42,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)
wxCheckBox::wxCheckBox(void) wxCheckBox::wxCheckBox(void)
{ {
}; }
wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label, bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
SetLabel( label ); SetLabel( label );
m_widget = gtk_check_button_new_with_label( label ); m_widget = gtk_check_button_new_with_label( label );
@@ -76,7 +71,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxCheckBox::SetValue( bool state ) void wxCheckBox::SetValue( bool state )
{ {
@@ -84,11 +79,11 @@ void wxCheckBox::SetValue( bool state )
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
}; }
bool wxCheckBox::GetValue(void) const bool wxCheckBox::GetValue(void) const
{ {
GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget); GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
return tb->active; return tb->active;
}; }

View File

@@ -36,7 +36,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
event.SetString( WXSTRINGCAST(tmp) ); event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice); event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event); choice->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -44,25 +44,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void) wxChoice::wxChoice(void)
{ {
}; }
wxChoice::wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxChoice::Create( wxWindow *parent, wxWindowID id, bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_option_menu_new(); m_widget = gtk_option_menu_new();
wxSize newSize = size; wxSize newSize = size;
@@ -81,7 +75,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), item ); gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item ); gtk_widget_show( item );
}; }
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu ); gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation(); PostCreation();
@@ -89,7 +83,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxChoice::Append( const wxString &item ) void wxChoice::Append( const wxString &item )
{ {
@@ -100,14 +94,14 @@ void wxChoice::Append( const wxString &item )
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), menu_item ); gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item ); gtk_widget_show( menu_item );
}; }
void wxChoice::Clear(void) void wxChoice::Clear(void)
{ {
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) ); gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new(); GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu ); gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
}; }
int wxChoice::FindString( const wxString &string ) const int wxChoice::FindString( const wxString &string ) const
{ {
@@ -129,17 +123,17 @@ int wxChoice::FindString( const wxString &string ) const
if (string == label->label) return count; if (string == label->label) return count;
child = child->next; child = child->next;
count++; count++;
}; }
wxFAIL_MSG( "wxChoice: string not found" ); wxFAIL_MSG( "wxChoice: string not found" );
return -1; return -1;
}; }
int wxChoice::GetColumns(void) const int wxChoice::GetColumns(void) const
{ {
return 1; return 1;
}; }
int wxChoice::GetSelection(void) int wxChoice::GetSelection(void)
{ {
@@ -152,12 +146,12 @@ int wxChoice::GetSelection(void)
if (!bin->child) return count; if (!bin->child) return count;
child = child->next; child = child->next;
count++; count++;
}; }
wxFAIL_MSG( "wxChoice: no selection" ); wxFAIL_MSG( "wxChoice: no selection" );
return -1; return -1;
}; }
wxString wxChoice::GetString( int n ) const wxString wxChoice::GetString( int n ) const
{ {
@@ -176,15 +170,15 @@ wxString wxChoice::GetString( int n ) const
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child ); if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
return label->label; return label->label;
}; }
child = child->next; child = child->next;
count++; count++;
}; }
wxFAIL_MSG( "wxChoice: string not found" ); wxFAIL_MSG( "wxChoice: string not found" );
return ""; return "";
}; }
wxString wxChoice::GetStringSelection(void) const wxString wxChoice::GetStringSelection(void) const
{ {
@@ -193,7 +187,7 @@ wxString wxChoice::GetStringSelection(void) const
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" ); wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label; return label->label;
}; }
int wxChoice::Number(void) const int wxChoice::Number(void) const
{ {
@@ -204,13 +198,13 @@ int wxChoice::Number(void) const
{ {
count++; count++;
child = child->next; child = child->next;
}; }
return count; return count;
}; }
void wxChoice::SetColumns( int WXUNUSED(n) ) void wxChoice::SetColumns( int WXUNUSED(n) )
{ {
}; }
void wxChoice::SetSelection( int n ) void wxChoice::SetSelection( int n )
{ {
@@ -218,11 +212,11 @@ void wxChoice::SetSelection( int n )
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
gtk_choice_clicked_callback( NULL, this ); gtk_choice_clicked_callback( NULL, this );
}; }
void wxChoice::SetStringSelection( const wxString &string ) void wxChoice::SetStringSelection( const wxString &string )
{ {
int n = FindString( string ); int n = FindString( string );
if (n != -1) SetSelection( n ); if (n != -1) SetSelection( n );
}; }

View File

@@ -47,7 +47,7 @@ static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox
event.SetString( WXSTRINGCAST(tmp) ); event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(combo); event.SetEventObject(combo);
combo->GetEventHandler()->ProcessEvent(event); combo->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// size // size
@@ -63,7 +63,7 @@ static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxC
alloc->width - widget->button->allocation.width; alloc->width - widget->button->allocation.width;
return FALSE; return FALSE;
}; }
*/ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -73,13 +73,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxString& name ) long style, const wxValidator& validator, const wxString& name )
{ {
m_alreadySent = FALSE; m_alreadySent = FALSE;
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_combo_new(); m_widget = gtk_combo_new();
wxSize newSize = size; wxSize newSize = size;
@@ -102,7 +104,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
gtk_signal_connect( GTK_OBJECT(list_item), "select", gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
}; }
PostCreation(); PostCreation();
@@ -116,7 +118,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxComboBox::Clear(void) void wxComboBox::Clear(void)
{ {
@@ -124,12 +126,12 @@ void wxComboBox::Clear(void)
gtk_list_clear_items( GTK_LIST(list), 0, Number() ); gtk_list_clear_items( GTK_LIST(list), 0, Number() );
m_clientData.Clear(); m_clientData.Clear();
}; }
void wxComboBox::Append( const wxString &item ) void wxComboBox::Append( const wxString &item )
{ {
Append( item, (char*)NULL ); Append( item, (char*)NULL );
}; }
void wxComboBox::Append( const wxString &item, char *clientData ) void wxComboBox::Append( const wxString &item, char *clientData )
{ {
@@ -146,7 +148,7 @@ void wxComboBox::Append( const wxString &item, char *clientData )
gtk_widget_show( list_item ); gtk_widget_show( list_item );
m_clientData.Append( (wxObject*)clientData ); m_clientData.Append( (wxObject*)clientData );
}; }
void wxComboBox::Delete( int n ) void wxComboBox::Delete( int n )
{ {
@@ -160,7 +162,7 @@ void wxComboBox::Delete( int n )
} }
else else
m_clientData.DeleteNode( node ); m_clientData.DeleteNode( node );
}; }
int wxComboBox::FindString( const wxString &item ) int wxComboBox::FindString( const wxString &item )
{ {
@@ -175,12 +177,12 @@ int wxComboBox::FindString( const wxString &item )
if (item == label->label) return count; if (item == label->label) return count;
count++; count++;
child = child->next; child = child->next;
}; }
wxFAIL_MSG( "wxComboBox: string not found" ); wxFAIL_MSG( "wxComboBox: string not found" );
return -1; return -1;
}; }
char* wxComboBox::GetClientData( int n ) char* wxComboBox::GetClientData( int n )
{ {
@@ -190,7 +192,7 @@ char* wxComboBox::GetClientData( int n )
wxFAIL_MSG( "wxComboBox: wrong index" ); wxFAIL_MSG( "wxComboBox: wrong index" );
return NULL; return NULL;
}; }
void wxComboBox::SetClientData( int n, char * clientData ) void wxComboBox::SetClientData( int n, char * clientData )
{ {
@@ -198,7 +200,7 @@ void wxComboBox::SetClientData( int n, char * clientData )
if (node) node->SetData( (wxObject*) clientData ); if (node) node->SetData( (wxObject*) clientData );
wxFAIL_MSG( "wxComboBox: wrong index" ); wxFAIL_MSG( "wxComboBox: wrong index" );
}; }
int wxComboBox::GetSelection(void) const int wxComboBox::GetSelection(void) const
{ {
@@ -214,13 +216,13 @@ int wxComboBox::GetSelection(void) const
if (child->data == selection->data) return count; if (child->data == selection->data) return count;
count++; count++;
child = child->next; child = child->next;
}; }
}; }
wxFAIL_MSG( "wxComboBox: no selection" ); wxFAIL_MSG( "wxComboBox: no selection" );
return -1; return -1;
}; }
wxString wxComboBox::GetString( int n ) const wxString wxComboBox::GetString( int n ) const
{ {
@@ -232,12 +234,12 @@ wxString wxComboBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
return label->label; return label->label;
}; }
wxFAIL_MSG( "wxComboBox: wrong index" ); wxFAIL_MSG( "wxComboBox: wrong index" );
return ""; return "";
}; }
wxString wxComboBox::GetStringSelection(void) const wxString wxComboBox::GetStringSelection(void) const
{ {
@@ -249,12 +251,12 @@ wxString wxComboBox::GetStringSelection(void) const
GtkBin *bin = GTK_BIN( selection->data ); GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label; wxString tmp = GTK_LABEL( bin->child )->label;
return tmp; return tmp;
}; }
wxFAIL_MSG( "wxComboBox: no selection" ); wxFAIL_MSG( "wxComboBox: no selection" );
return ""; return "";
}; }
int wxComboBox::Number(void) const int wxComboBox::Number(void) const
{ {
@@ -262,29 +264,29 @@ int wxComboBox::Number(void) const
GList *child = GTK_LIST(list)->children; GList *child = GTK_LIST(list)->children;
int count = 0; int count = 0;
while (child) { count++; child = child->next; }; while (child) { count++; child = child->next; }
return count; return count;
}; }
void wxComboBox::SetSelection( int n ) void wxComboBox::SetSelection( int n )
{ {
GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_select_item( GTK_LIST(list), n ); gtk_list_select_item( GTK_LIST(list), n );
}; }
void wxComboBox::SetStringSelection( const wxString &string ) void wxComboBox::SetStringSelection( const wxString &string )
{ {
int res = FindString( string ); int res = FindString( string );
if (res == -1) return; if (res == -1) return;
SetSelection( res ); SetSelection( res );
}; }
wxString wxComboBox::GetValue(void) const wxString wxComboBox::GetValue(void) const
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) ); wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) );
return tmp; return tmp;
}; }
void wxComboBox::SetValue( const wxString& value ) void wxComboBox::SetValue( const wxString& value )
{ {
@@ -292,52 +294,52 @@ void wxComboBox::SetValue( const wxString& value )
wxString tmp = ""; wxString tmp = "";
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
gtk_entry_set_text( GTK_ENTRY(entry), tmp ); gtk_entry_set_text( GTK_ENTRY(entry), tmp );
}; }
void wxComboBox::Copy(void) void wxComboBox::Copy(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
}; }
void wxComboBox::Cut(void) void wxComboBox::Cut(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
}; }
void wxComboBox::Paste(void) void wxComboBox::Paste(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
}; }
void wxComboBox::SetInsertionPoint( long pos ) void wxComboBox::SetInsertionPoint( long pos )
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int tmp = (int) pos; int tmp = (int) pos;
gtk_entry_set_position( GTK_ENTRY(entry), tmp ); gtk_entry_set_position( GTK_ENTRY(entry), tmp );
}; }
void wxComboBox::SetInsertionPointEnd(void) void wxComboBox::SetInsertionPointEnd(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length; int pos = GTK_ENTRY(entry)->text_length;
SetInsertionPoint( pos-1 ); SetInsertionPoint( pos-1 );
}; }
long wxComboBox::GetInsertionPoint(void) const long wxComboBox::GetInsertionPoint(void) const
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
return (long) GTK_EDITABLE(entry)->current_pos; return (long) GTK_EDITABLE(entry)->current_pos;
}; }
long wxComboBox::GetLastPosition(void) const long wxComboBox::GetLastPosition(void) const
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length; int pos = GTK_ENTRY(entry)->text_length;
return (long) pos-1; return (long) pos-1;
}; }
void wxComboBox::Replace( long from, long to, const wxString& value ) void wxComboBox::Replace( long from, long to, const wxString& value )
{ {
@@ -346,20 +348,20 @@ void wxComboBox::Replace( long from, long to, const wxString& value )
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
gtk_editable_insert_text( GTK_EDITABLE(entry), value, value.Length(), &pos ); gtk_editable_insert_text( GTK_EDITABLE(entry), value, value.Length(), &pos );
}; }
void wxComboBox::Remove(long from, long to) void wxComboBox::Remove(long from, long to)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
}; }
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) ) void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{ {
}; }
void wxComboBox::SetEditable( bool WXUNUSED(editable) ) void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{ {
}; }

View File

@@ -23,18 +23,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
wxControl::wxControl(void) wxControl::wxControl(void)
{ {
m_needParent = TRUE; m_needParent = TRUE;
}; }
wxControl::wxControl( wxWindow *parent, wxWindowID id, wxControl::wxControl( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) : long style, const wxString &name ) :
wxWindow( parent, id, pos, size, style, name ) wxWindow( parent, id, pos, size, style, name )
{ {
}; }
void wxControl::Command( wxCommandEvent &WXUNUSED(event) ) void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
{ {
}; }
void wxControl::SetLabel( const wxString &label ) void wxControl::SetLabel( const wxString &label )
{ {
@@ -50,12 +50,12 @@ void wxControl::SetLabel( const wxString &label )
m_label << *pc; m_label << *pc;
} }
}; }
wxString wxControl::GetLabel(void) const wxString wxControl::GetLabel(void) const
{ {
return m_label; return m_label;
}; }

View File

@@ -22,12 +22,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range, bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) long style, const wxValidator& validator, const wxString& name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_rangeMax = range; m_rangeMax = range;
m_gaugePos = 0; m_gaugePos = 0;
m_useProgressBar = TRUE; m_useProgressBar = TRUE;
@@ -39,7 +41,7 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxGauge::SetRange( int r ) void wxGauge::SetRange( int r )
{ {
@@ -47,7 +49,7 @@ void wxGauge::SetRange( int r )
if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
}; }
void wxGauge::SetValue( int pos ) void wxGauge::SetValue( int pos )
{ {
@@ -55,15 +57,15 @@ void wxGauge::SetValue( int pos )
if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
}; }
int wxGauge::GetRange(void) const int wxGauge::GetRange(void) const
{ {
return m_rangeMax; return m_rangeMax;
}; }
int wxGauge::GetValue(void) const int wxGauge::GetValue(void) const
{ {
return m_gaugePos; return m_gaugePos;
}; }

View File

@@ -55,7 +55,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
listbox->GetEventHandler()->ProcessEvent( event ); listbox->GetEventHandler()->ProcessEvent( event );
if (event.m_commandString) delete[] event.m_commandString ; if (event.m_commandString) delete[] event.m_commandString ;
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -64,25 +64,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
wxListBox::wxListBox(void) wxListBox::wxListBox(void)
{ {
m_list = NULL; m_list = NULL;
}; }
wxListBox::wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxListBox::Create( wxWindow *parent, wxWindowID id, bool wxListBox::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_scrolled_window_new( NULL, NULL ); m_widget = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget), gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
@@ -118,7 +112,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_clientData.Append( (wxObject*)NULL ); m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item ); gtk_widget_show( list_item );
}; }
PostCreation(); PostCreation();
@@ -127,12 +121,12 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxListBox::Append( const wxString &item ) void wxListBox::Append( const wxString &item )
{ {
Append( item, (char*)NULL ); Append( item, (char*)NULL );
}; }
void wxListBox::Append( const wxString &item, char *clientData ) void wxListBox::Append( const wxString &item, char *clientData )
{ {
@@ -151,14 +145,14 @@ void wxListBox::Append( const wxString &item, char *clientData )
m_clientData.Append( (wxObject*)clientData ); m_clientData.Append( (wxObject*)clientData );
gtk_widget_show( list_item ); gtk_widget_show( list_item );
}; }
void wxListBox::Clear(void) void wxListBox::Clear(void)
{ {
gtk_list_clear_items( m_list, 0, Number() ); gtk_list_clear_items( m_list, 0, Number() );
m_clientData.Clear(); m_clientData.Clear();
}; }
void wxListBox::Delete( int n ) void wxListBox::Delete( int n )
{ {
@@ -171,12 +165,12 @@ void wxListBox::Delete( int n )
} }
else else
m_clientData.DeleteNode( node ); m_clientData.DeleteNode( node );
}; }
void wxListBox::Deselect( int n ) void wxListBox::Deselect( int n )
{ {
gtk_list_unselect_item( m_list, n ); gtk_list_unselect_item( m_list, n );
}; }
int wxListBox::FindString( const wxString &item ) const int wxListBox::FindString( const wxString &item ) const
{ {
@@ -189,16 +183,16 @@ int wxListBox::FindString( const wxString &item ) const
if (item == label->label) return count; if (item == label->label) return count;
count++; count++;
child = child->next; child = child->next;
}; }
return -1; return -1;
}; }
char *wxListBox::GetClientData( int n ) const char *wxListBox::GetClientData( int n ) const
{ {
wxNode *node = m_clientData.Nth( n ); wxNode *node = m_clientData.Nth( n );
if (node) return ((char*)node->Data()); if (node) return ((char*)node->Data());
return NULL; return NULL;
}; }
int wxListBox::GetSelection(void) const int wxListBox::GetSelection(void) const
{ {
@@ -212,10 +206,10 @@ int wxListBox::GetSelection(void) const
if (child->data == selection->data) return count; if (child->data == selection->data) return count;
count++; count++;
child = child->next; child = child->next;
}; }
}; }
return -1; return -1;
}; }
int wxListBox::GetSelections(wxArrayInt& aSelections) const int wxListBox::GetSelections(wxArrayInt& aSelections) const
{ {
@@ -240,7 +234,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
} }
return count; return count;
}; }
wxString wxListBox::GetString( int n ) const wxString wxListBox::GetString( int n ) const
{ {
@@ -250,9 +244,9 @@ wxString wxListBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
return label->label; return label->label;
}; }
return ""; return "";
}; }
wxString wxListBox::GetStringSelection(void) const wxString wxListBox::GetStringSelection(void) const
{ {
@@ -262,17 +256,17 @@ wxString wxListBox::GetStringSelection(void) const
GtkBin *bin = GTK_BIN( selection->data ); GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label; wxString tmp = GTK_LABEL( bin->child )->label;
return tmp; return tmp;
}; }
return ""; return "";
}; }
int wxListBox::Number(void) int wxListBox::Number(void)
{ {
GList *child = m_list->children; GList *child = m_list->children;
int count = 0; int count = 0;
while (child) { count++; child = child->next; }; while (child) { count++; child = child->next; }
return count; return count;
}; }
bool wxListBox::Selected( int n ) bool wxListBox::Selected( int n )
{ {
@@ -284,28 +278,28 @@ bool wxListBox::Selected( int n )
{ {
if (child->data == target->data) return TRUE; if (child->data == target->data) return TRUE;
child = child->next; child = child->next;
}; }
}; }
return FALSE; return FALSE;
}; }
void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) ) void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) )
{ {
}; }
void wxListBox::SetClientData( int n, char *clientData ) void wxListBox::SetClientData( int n, char *clientData )
{ {
wxNode *node = m_clientData.Nth( n ); wxNode *node = m_clientData.Nth( n );
if (node) node->SetData( (wxObject*)clientData ); if (node) node->SetData( (wxObject*)clientData );
}; }
void wxListBox::SetFirstItem( int WXUNUSED(n) ) void wxListBox::SetFirstItem( int WXUNUSED(n) )
{ {
}; }
void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) ) void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
{ {
}; }
void wxListBox::SetSelection( int n, bool select ) void wxListBox::SetSelection( int n, bool select )
{ {
@@ -313,7 +307,7 @@ void wxListBox::SetSelection( int n, bool select )
gtk_list_select_item( m_list, n ); gtk_list_select_item( m_list, n );
else else
gtk_list_unselect_item( m_list, n ); gtk_list_unselect_item( m_list, n );
}; }
void wxListBox::SetString( int n, const wxString &string ) void wxListBox::SetString( int n, const wxString &string )
{ {
@@ -323,13 +317,13 @@ void wxListBox::SetString( int n, const wxString &string )
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
gtk_label_set( label, string ); gtk_label_set( label, string );
}; }
}; }
void wxListBox::SetStringSelection( const wxString &string, bool select ) void wxListBox::SetStringSelection( const wxString &string, bool select )
{ {
SetSelection( FindString(string), select ); SetSelection( FindString(string), select );
}; }
int wxListBox::GetIndex( GtkWidget *item ) const int wxListBox::GetIndex( GtkWidget *item ) const
{ {
@@ -342,15 +336,15 @@ int wxListBox::GetIndex( GtkWidget *item ) const
if (GTK_WIDGET(child->data) == item) return count; if (GTK_WIDGET(child->data) == item) return count;
count++; count++;
child = child->next; child = child->next;
}; }
}; }
return -1; return -1;
}; }
GtkWidget *wxListBox::GetConnectWidget(void) GtkWidget *wxListBox::GetConnectWidget(void)
{ {
return GTK_WIDGET(m_list); return GTK_WIDGET(m_list);
}; }

View File

@@ -42,7 +42,7 @@ wxMenuBar::wxMenuBar()
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
}; }
void wxMenuBar::Append( wxMenu *menu, const wxString &title ) void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{ {
@@ -61,7 +61,7 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu ); gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu );
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu ); gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu );
}; }
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
{ {
@@ -69,7 +69,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
{ {
int res = menu->FindItem( itemString ); int res = menu->FindItem( itemString );
if (res != -1) return res; if (res != -1) return res;
}; }
wxNode *node = menu->m_items.First(); wxNode *node = menu->m_items.First();
while (node) while (node)
{ {
@@ -77,9 +77,9 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
if (item->IsSubMenu()) if (item->IsSubMenu())
return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString);
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{ {
@@ -90,9 +90,9 @@ int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemStr
int res = FindMenuItemRecursive( menu, menuString, itemString); int res = FindMenuItemRecursive( menu, menuString, itemString);
if (res != -1) return res; if (res != -1) return res;
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
// Find a wxMenuItem using its id. Recurses down into sub-menus // Find a wxMenuItem using its id. Recurses down into sub-menus
static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
@@ -105,10 +105,10 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
if ( item->IsSubMenu() ) if ( item->IsSubMenu() )
result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); result = FindMenuItemByIdRecursive( item->GetSubMenu(), id );
node = node->Next(); node = node->Next();
}; }
return result; return result;
}; }
wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const
{ {
@@ -127,48 +127,55 @@ void wxMenuBar::Check( int id, bool check )
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) item->Check(check); if (item) item->Check(check);
}; }
bool wxMenuBar::Checked( int id ) const bool wxMenuBar::Checked( int id ) const
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsChecked(); if (item) return item->IsChecked();
return FALSE; return FALSE;
}; }
void wxMenuBar::Enable( int id, bool enable ) void wxMenuBar::Enable( int id, bool enable )
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) item->Enable(enable); if (item) item->Enable(enable);
}; }
bool wxMenuBar::Enabled( int id ) const bool wxMenuBar::Enabled( int id ) const
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsEnabled(); if (item) return item->IsEnabled();
return FALSE; return FALSE;
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMenu // wxMenu
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void gtk_menu_clicked_callback( GtkWidget *widget, gpointer data ) static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{ {
wxMenu *menu = (wxMenu*)data;
int id = menu->FindMenuIdByMenuItem(widget); int id = menu->FindMenuIdByMenuItem(widget);
wxASSERT( id != -1 ); // should find it! wxASSERT( id != -1 ); // should find it!
if (!menu->IsEnabled(id)) if (!menu->IsEnabled(id)) return;
return;
wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, id ); wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, id );
event.SetEventObject( menu ); event.SetEventObject( menu );
event.SetInt(id ); event.SetInt(id );
if (menu->m_callback)
{
(void) (*(menu->m_callback)) (*menu, event);
return;
}
if (menu->GetEventHandler()->ProcessEvent(event)) return;
wxWindow *win = menu->GetInvokingWindow(); wxWindow *win = menu->GetInvokingWindow();
if (win) win->GetEventHandler()->ProcessEvent( event ); if (win) win->GetEventHandler()->ProcessEvent( event );
}; }
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject)
@@ -180,7 +187,7 @@ wxMenuItem::wxMenuItem()
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_subMenu = NULL; m_subMenu = NULL;
m_menuItem = NULL; m_menuItem = NULL;
}; }
void wxMenuItem::SetText(const wxString& str) void wxMenuItem::SetText(const wxString& str)
{ {
@@ -214,13 +221,21 @@ bool wxMenuItem::IsChecked() const
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
wxMenu::wxMenu( const wxString &title ) wxMenu::wxMenu( const wxString& title, const wxFunction func )
{ {
m_title = title; m_title = title;
m_items.DeleteContents( TRUE ); m_items.DeleteContents( TRUE );
m_invokingWindow = NULL; m_invokingWindow = NULL;
m_menu = gtk_menu_new(); // Do not show! m_menu = gtk_menu_new(); // Do not show!
}; m_callback = func;
m_eventHandler = this;
if (m_title.IsNull()) m_title = "";
if (m_title != "")
{
Append(-2, m_title);
AppendSeparator();
}
}
void wxMenu::AppendSeparator() void wxMenu::AppendSeparator()
{ {
@@ -232,7 +247,7 @@ void wxMenu::AppendSeparator()
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
mitem->SetMenuItem(menuItem); mitem->SetMenuItem(menuItem);
m_items.Append( mitem ); m_items.Append( mitem );
}; }
void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable ) void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable )
{ {
@@ -253,7 +268,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
m_items.Append( mitem ); m_items.Append( mitem );
}; }
void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr ) void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr )
{ {
@@ -270,7 +285,7 @@ void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxStri
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
m_items.Append( mitem ); m_items.Append( mitem );
}; }
int wxMenu::FindItem( const wxString itemString ) const int wxMenu::FindItem( const wxString itemString ) const
{ {
@@ -289,17 +304,17 @@ int wxMenu::FindItem( const wxString itemString ) const
if (item->GetText() == s) if (item->GetText() == s)
return item->GetId(); return item->GetId();
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
void wxMenu::Enable( int id, bool enable ) void wxMenu::Enable( int id, bool enable )
{ {
wxMenuItem *item = FindItem(id); wxMenuItem *item = FindItem(id);
if ( item ) if ( item )
item->Enable(enable); item->Enable(enable);
}; }
bool wxMenu::IsEnabled( int id ) const bool wxMenu::IsEnabled( int id ) const
{ {
@@ -308,14 +323,14 @@ bool wxMenu::IsEnabled( int id ) const
return item->IsEnabled(); return item->IsEnabled();
else else
return FALSE; return FALSE;
}; }
void wxMenu::Check( int id, bool enable ) void wxMenu::Check( int id, bool enable )
{ {
wxMenuItem *item = FindItem(id); wxMenuItem *item = FindItem(id);
if ( item ) if ( item )
item->Check(enable); item->Check(enable);
}; }
bool wxMenu::IsChecked( int id ) const bool wxMenu::IsChecked( int id ) const
{ {
@@ -324,14 +339,14 @@ bool wxMenu::IsChecked( int id ) const
return item->IsChecked(); return item->IsChecked();
else else
return FALSE; return FALSE;
}; }
void wxMenu::SetLabel( int id, const wxString &label ) void wxMenu::SetLabel( int id, const wxString &label )
{ {
wxMenuItem *item = FindItem(id); wxMenuItem *item = FindItem(id);
if ( item ) if ( item )
item->SetText(label); item->SetText(label);
}; }
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{ {
@@ -342,10 +357,10 @@ int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
if (item->GetMenuItem() == menuItem) if (item->GetMenuItem() == menuItem)
return item->GetId(); return item->GetId();
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
wxMenuItem *wxMenu::FindItem(int id) const wxMenuItem *wxMenu::FindItem(int id) const
{ {
@@ -355,7 +370,7 @@ wxMenuItem *wxMenu::FindItem(int id) const
if ( item->GetId() == id ) if ( item->GetId() == id )
return item; return item;
node = node->Next(); node = node->Next();
}; }
wxLogDebug(_("wxMenu::FindItem: item %d not found."), id); wxLogDebug(_("wxMenu::FindItem: item %d not found."), id);
@@ -365,11 +380,11 @@ wxMenuItem *wxMenu::FindItem(int id) const
void wxMenu::SetInvokingWindow( wxWindow *win ) void wxMenu::SetInvokingWindow( wxWindow *win )
{ {
m_invokingWindow = win; m_invokingWindow = win;
}; }
wxWindow *wxMenu::GetInvokingWindow() wxWindow *wxMenu::GetInvokingWindow()
{ {
return m_invokingWindow; return m_invokingWindow;
}; }

View File

@@ -47,7 +47,7 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
event.SetString( WXSTRINGCAST(tmp) ); event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject( rb ); event.SetEventObject( rb );
rb->GetEventHandler()->ProcessEvent(event); rb->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -55,28 +55,20 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
wxRadioBox::wxRadioBox(void) wxRadioBox::wxRadioBox(void)
{ {
}; }
wxRadioBox::wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
int majorDim, long style,
const wxString &name )
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, name );
};
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int n, const wxString choices[], int WXUNUSED(majorDim),
int WXUNUSED(majorDim), long style, long style, const wxValidator& validator, const wxString &name )
const wxString &name )
{ {
m_alreadySent = FALSE; m_alreadySent = FALSE;
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_frame_new( title ); m_widget = gtk_frame_new( title );
int x = m_x+5; int x = m_x+5;
@@ -111,8 +103,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
y += 20; y += 20;
height += 20; height += 20;
}; }
}; }
wxSize newSize = size; wxSize newSize = size;
if (newSize.x == -1) newSize.x = maxLen+10; if (newSize.x == -1) newSize.x = maxLen+10;
@@ -124,7 +116,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
bool wxRadioBox::Show( bool show ) bool wxRadioBox::Show( bool show )
{ {
@@ -136,10 +128,10 @@ bool wxRadioBox::Show( bool show )
GtkWidget *w = GTK_WIDGET( item->data ); GtkWidget *w = GTK_WIDGET( item->data );
if (show) gtk_widget_show( w ); else gtk_widget_hide( w ); if (show) gtk_widget_show( w ); else gtk_widget_hide( w );
item = item->next; item = item->next;
}; }
return TRUE; return TRUE;
}; }
int wxRadioBox::FindString( const wxString &s ) const int wxRadioBox::FindString( const wxString &s ) const
{ {
@@ -154,10 +146,10 @@ int wxRadioBox::FindString( const wxString &s ) const
if (s == l->label) return count; if (s == l->label) return count;
count--; count--;
item = item->next; item = item->next;
}; }
return -1; return -1;
}; }
void wxRadioBox::SetSelection( int n ) void wxRadioBox::SetSelection( int n )
{ {
@@ -168,7 +160,7 @@ void wxRadioBox::SetSelection( int n )
GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data ); GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
gtk_toggle_button_set_state( button, 1 ); gtk_toggle_button_set_state( button, 1 );
}; }
int wxRadioBox::GetSelection(void) const int wxRadioBox::GetSelection(void) const
{ {
@@ -180,9 +172,9 @@ int wxRadioBox::GetSelection(void) const
if (GTK_TOGGLE_BUTTON(button)->active) return count; if (GTK_TOGGLE_BUTTON(button)->active) return count;
count++; count++;
item = item->next; item = item->next;
}; }
return -1; return -1;
}; }
wxString wxRadioBox::GetString( int n ) const wxString wxRadioBox::GetString( int n ) const
{ {
@@ -196,48 +188,48 @@ wxString wxRadioBox::GetString( int n ) const
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
return wxString( label->label ); return wxString( label->label );
}; }
wxString wxRadioBox::GetLabel(void) const wxString wxRadioBox::GetLabel(void) const
{ {
return wxControl::GetLabel(); return wxControl::GetLabel();
}; }
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented."); wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; }
void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented."); wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; }
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) ) void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented."); wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; }
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{ {
wxFAIL_MSG("wxRadioBox::GetLabel not implemented."); wxFAIL_MSG("wxRadioBox::GetLabel not implemented.");
return ""; return "";
}; }
void wxRadioBox::Enable( bool WXUNUSED(enable) ) void wxRadioBox::Enable( bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented."); wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; }
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) ) void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented."); wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; }
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) ) void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{ {
wxFAIL_MSG("wxRadioBox::Show not implemented."); wxFAIL_MSG("wxRadioBox::Show not implemented.");
}; }
wxString wxRadioBox::GetStringSelection(void) const wxString wxRadioBox::GetStringSelection(void) const
{ {
@@ -249,11 +241,11 @@ wxString wxRadioBox::GetStringSelection(void) const
{ {
GtkLabel *label = GTK_LABEL( button->child ); GtkLabel *label = GTK_LABEL( button->child );
return label->label; return label->label;
}; }
item = item->next; item = item->next;
}; }
return ""; return "";
}; }
bool wxRadioBox::SetStringSelection( const wxString&s ) bool wxRadioBox::SetStringSelection( const wxString&s )
{ {
@@ -261,7 +253,7 @@ bool wxRadioBox::SetStringSelection( const wxString&s )
if (res == -1) return FALSE; if (res == -1) return FALSE;
SetSelection( res ); SetSelection( res );
return TRUE; return TRUE;
}; }
int wxRadioBox::Number(void) const int wxRadioBox::Number(void) const
{ {
@@ -271,17 +263,17 @@ int wxRadioBox::Number(void) const
{ {
item = item->next; item = item->next;
count++; count++;
}; }
return count; return count;
}; }
int wxRadioBox::GetNumberOfRowsOrCols(void) const int wxRadioBox::GetNumberOfRowsOrCols(void) const
{ {
return 1; return 1;
}; }
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{ {
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented."); wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
}; }

View File

@@ -15,3 +15,75 @@
#include "wx/radiobut.h" #include "wx/radiobut.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton,wxControl)
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButton *rb )
{
if (!rb->HasVMT()) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
event.SetInt( rb->GetValue() );
event.SetEventObject( rb );
rb->GetEventHandler()->ProcessEvent( event );
}
bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos, const wxSize& size, long style,
const wxValidator& validator, const wxString& name )
{
m_needParent = TRUE;
wxSize newSize = size;
PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_widget = gtk_radio_button_new_with_label( NULL, label );
SetLabel(label);
if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
PostCreation();
Show( TRUE );
return TRUE;
}
void wxRadioButton::SetLabel( const wxString& label )
{
wxControl::SetLabel( label );
GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child );
gtk_label_set( g_label, GetLabel() );
}
void wxRadioButton::SetValue( bool val )
{
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
}
bool wxRadioButton::GetValue(void) const
{
return GTK_TOGGLE_BUTTON(m_widget)->active;
}

View File

@@ -59,29 +59,24 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
cevent.SetEventObject( win ); cevent.SetEventObject( win );
win->ProcessEvent( cevent ); win->ProcessEvent( cevent );
*/ */
}; }
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
wxScrollBar::wxScrollBar(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
wxScrollBar::~wxScrollBar(void) wxScrollBar::~wxScrollBar(void)
{ {
}; }
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) long style, const wxValidator& validator, const wxString& name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0; m_oldPos = 0.0;
if (style & wxSB_VERTICAL == wxSB_VERTICAL) if (style & wxSB_VERTICAL == wxSB_VERTICAL)
@@ -99,27 +94,27 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
int wxScrollBar::GetPosition(void) const int wxScrollBar::GetPosition(void) const
{ {
return (int)(m_adjust->value+0.5); return (int)(m_adjust->value+0.5);
}; }
int wxScrollBar::GetThumbSize() const int wxScrollBar::GetThumbSize() const
{ {
return (int)(m_adjust->page_size+0.5); return (int)(m_adjust->page_size+0.5);
}; }
int wxScrollBar::GetPageSize() const int wxScrollBar::GetPageSize() const
{ {
return (int)(m_adjust->page_increment+0.5); return (int)(m_adjust->page_increment+0.5);
}; }
int wxScrollBar::GetRange() const int wxScrollBar::GetRange() const
{ {
return (int)(m_adjust->upper+0.5); return (int)(m_adjust->upper+0.5);
}; }
void wxScrollBar::SetPosition( int viewStart ) void wxScrollBar::SetPosition( int viewStart )
{ {
@@ -129,7 +124,7 @@ void wxScrollBar::SetPosition( int viewStart )
m_adjust->value = fpos; m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}; }
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize, void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) ) bool WXUNUSED(refresh) )
@@ -154,18 +149,18 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page
m_adjust->page_size = fthumb; m_adjust->page_size = fthumb;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
// Backward compatibility // Backward compatibility
int wxScrollBar::GetValue(void) const int wxScrollBar::GetValue(void) const
{ {
return GetPosition(); return GetPosition();
}; }
void wxScrollBar::SetValue( int viewStart ) void wxScrollBar::SetValue( int viewStart )
{ {
SetPosition( viewStart ); SetPosition( viewStart );
}; }
void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const
{ {
@@ -178,17 +173,17 @@ void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength,
*viewLength = range; *viewLength = range;
*objectLength = thumb; *objectLength = thumb;
*pageLength = page; *pageLength = page;
}; }
int wxScrollBar::GetViewLength() const int wxScrollBar::GetViewLength() const
{ {
return (int)(m_adjust->upper+0.5); return (int)(m_adjust->upper+0.5);
}; }
int wxScrollBar::GetObjectLength() const int wxScrollBar::GetObjectLength() const
{ {
return (int)(m_adjust->page_size+0.5); return (int)(m_adjust->page_size+0.5);
}; }
void wxScrollBar::SetPageSize( int pageLength ) void wxScrollBar::SetPageSize( int pageLength )
{ {
@@ -196,7 +191,7 @@ void wxScrollBar::SetPageSize( int pageLength )
int thumb = (int)(m_adjust->page_size+0.5); int thumb = (int)(m_adjust->page_size+0.5);
int range = (int)(m_adjust->upper+0.5); int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, thumb, range, pageLength ); SetScrollbar( pos, thumb, range, pageLength );
}; }
void wxScrollBar::SetObjectLength( int objectLength ) void wxScrollBar::SetObjectLength( int objectLength )
{ {
@@ -204,7 +199,7 @@ void wxScrollBar::SetObjectLength( int objectLength )
int page = (int)(m_adjust->page_increment+0.5); int page = (int)(m_adjust->page_increment+0.5);
int range = (int)(m_adjust->upper+0.5); int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, objectLength, range, page ); SetScrollbar( pos, objectLength, range, page );
}; }
void wxScrollBar::SetViewLength( int viewLength ) void wxScrollBar::SetViewLength( int viewLength )
{ {
@@ -212,5 +207,5 @@ void wxScrollBar::SetViewLength( int viewLength )
int thumb = (int)(m_adjust->page_size+0.5); int thumb = (int)(m_adjust->page_size+0.5);
int page = (int)(m_adjust->page_increment+0.5); int page = (int)(m_adjust->page_increment+0.5);
SetScrollbar( pos, thumb, viewLength, page ); SetScrollbar( pos, thumb, viewLength, page );
}; }

View File

@@ -57,40 +57,29 @@ static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() ); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
cevent.SetEventObject( win ); cevent.SetEventObject( win );
win->ProcessEvent( cevent ); win->ProcessEvent( cevent );
}; }
IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl)
wxSlider::wxSlider(void) wxSlider::wxSlider(void)
{ {
}; }
wxSlider::wxSlider( wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos, const wxSize& size,
long style,
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{
Create( parent, id, value, minValue, maxValue,
pos, size, style, name );
};
wxSlider::~wxSlider(void) wxSlider::~wxSlider(void)
{ {
}; }
bool wxSlider::Create(wxWindow *parent, wxWindowID id, bool wxSlider::Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue, int value, int minValue, int maxValue,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, long style, const wxValidator& validator, const wxString& name )
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0; m_oldPos = 0.0;
if (style & wxSL_VERTICAL == wxSL_VERTICAL) if (style & wxSL_VERTICAL == wxSL_VERTICAL)
@@ -110,12 +99,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
int wxSlider::GetValue(void) const int wxSlider::GetValue(void) const
{ {
return (int)(m_adjust->value+0.5); return (int)(m_adjust->value+0.5);
}; }
void wxSlider::SetValue( int value ) void wxSlider::SetValue( int value )
{ {
@@ -125,7 +114,7 @@ void wxSlider::SetValue( int value )
m_adjust->value = fpos; m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}; }
void wxSlider::SetRange( int minValue, int maxValue ) void wxSlider::SetRange( int minValue, int maxValue )
{ {
@@ -140,17 +129,17 @@ void wxSlider::SetRange( int minValue, int maxValue )
m_adjust->upper = fmax; m_adjust->upper = fmax;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
int wxSlider::GetMin(void) const int wxSlider::GetMin(void) const
{ {
return (int)(m_adjust->lower+0.5); return (int)(m_adjust->lower+0.5);
}; }
int wxSlider::GetMax(void) const int wxSlider::GetMax(void) const
{ {
return (int)(m_adjust->upper+0.5); return (int)(m_adjust->upper+0.5);
}; }
void wxSlider::SetPageSize( int pageSize ) void wxSlider::SetPageSize( int pageSize )
{ {
@@ -161,12 +150,12 @@ void wxSlider::SetPageSize( int pageSize )
m_adjust->page_increment = fpage; m_adjust->page_increment = fpage;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
int wxSlider::GetPageSize(void) const int wxSlider::GetPageSize(void) const
{ {
return (int)(m_adjust->page_increment+0.5); return (int)(m_adjust->page_increment+0.5);
}; }
void wxSlider::SetThumbLength( int len ) void wxSlider::SetThumbLength( int len )
{ {
@@ -177,71 +166,71 @@ void wxSlider::SetThumbLength( int len )
m_adjust->page_size = flen; m_adjust->page_size = flen;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
int wxSlider::GetThumbLength(void) const int wxSlider::GetThumbLength(void) const
{ {
return (int)(m_adjust->page_size+0.5); return (int)(m_adjust->page_size+0.5);
}; }
void wxSlider::SetLineSize( int WXUNUSED(lineSize) ) void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
{ {
}; }
int wxSlider::GetLineSize(void) const int wxSlider::GetLineSize(void) const
{ {
return 0; return 0;
}; }
// not supported in wxGTK (and GTK) // not supported in wxGTK (and GTK)
void wxSlider::GetSize( int *x, int *y ) const void wxSlider::GetSize( int *x, int *y ) const
{ {
wxWindow::GetSize( x, y ); wxWindow::GetSize( x, y );
}; }
void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags ) void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxWindow::SetSize( x, y, width, height, sizeFlags ); wxWindow::SetSize( x, y, width, height, sizeFlags );
}; }
void wxSlider::GetPosition( int *x, int *y ) const void wxSlider::GetPosition( int *x, int *y ) const
{ {
wxWindow::GetPosition( x, y ); wxWindow::GetPosition( x, y );
}; }
void wxSlider::SetTick( int WXUNUSED(tickPos) ) void wxSlider::SetTick( int WXUNUSED(tickPos) )
{ {
}; }
void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) ) void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
{ {
}; }
int wxSlider::GetTickFreq(void) const int wxSlider::GetTickFreq(void) const
{ {
return 0; return 0;
}; }
void wxSlider::ClearTicks(void) void wxSlider::ClearTicks(void)
{ {
}; }
void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) ) void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
{ {
}; }
int wxSlider::GetSelEnd(void) const int wxSlider::GetSelEnd(void) const
{ {
return 0; return 0;
}; }
int wxSlider::GetSelStart(void) const int wxSlider::GetSelStart(void) const
{ {
return 0; return 0;
}; }
void wxSlider::ClearSel(void) void wxSlider::ClearSel(void)
{ {
}; }

View File

@@ -22,10 +22,10 @@
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{ {
win->SetModified(); win->SetModified();
}; }
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
@@ -34,31 +34,31 @@ END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf() wxTextCtrl::wxTextCtrl(void) : streambuf()
{ {
if( allocate() ) if (allocate()) setp(base(),ebuf());
setp(base(),ebuf());
m_modified = FALSE; m_modified = FALSE;
}; }
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value, wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) : streambuf() int style, const wxValidator& validator, const wxString &name ) : streambuf()
{ {
if( allocate() ) if (allocate()) setp(base(),ebuf());
setp(base(),ebuf());
m_modified = FALSE; m_modified = FALSE;
Create( parent, id, value, pos, size, style, name ); Create( parent, id, value, pos, size, style, validator, name );
}; }
bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) int style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
bool bMultiLine = (style & wxTE_MULTILINE) != 0; bool bMultiLine = (style & wxTE_MULTILINE) != 0;
if ( bMultiLine ) if ( bMultiLine )
{ {
@@ -121,7 +121,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
{ {
gint tmp = 0; gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp );
}; }
if (style & wxTE_READONLY) if (style & wxTE_READONLY)
{ {
@@ -130,12 +130,12 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
{ {
if ( bMultiLine ) if ( bMultiLine )
gtk_text_set_editable( GTK_TEXT(m_text), 1 ); gtk_text_set_editable( GTK_TEXT(m_text), 1 );
}; }
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
wxString wxTextCtrl::GetValue(void) const wxString wxTextCtrl::GetValue(void) const
{ {
@@ -148,9 +148,9 @@ wxString wxTextCtrl::GetValue(void) const
else else
{ {
tmp = gtk_entry_get_text( GTK_ENTRY(m_text) ); tmp = gtk_entry_get_text( GTK_ENTRY(m_text) );
}; }
return tmp; return tmp;
}; }
void wxTextCtrl::SetValue( const wxString &value ) void wxTextCtrl::SetValue( const wxString &value )
{ {
@@ -166,8 +166,8 @@ void wxTextCtrl::SetValue( const wxString &value )
else else
{ {
gtk_entry_set_text( GTK_ENTRY(m_text), tmp ); gtk_entry_set_text( GTK_ENTRY(m_text), tmp );
}; }
}; }
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
{ {
@@ -181,44 +181,44 @@ void wxTextCtrl::WriteText( const wxString &text )
else else
{ {
gtk_entry_append_text( GTK_ENTRY(m_text), text ); gtk_entry_append_text( GTK_ENTRY(m_text), text );
}; }
}; }
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) ) bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
{ {
wxFAIL_MSG(_("wxTextCtrl::LoadFile not implemented")); wxFAIL_MSG( "wxTextCtrl::LoadFile not implemented" );
return FALSE; return FALSE;
}; }
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) ) bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
{ {
wxFAIL_MSG(_("wxTextCtrl::SaveFile not implemented")); wxFAIL_MSG( "wxTextCtrl::SaveFile not implemented" );
return FALSE; return FALSE;
}; }
/* /*
wxString wxTextCtrl::GetLineText( long lineNo ) const wxString wxTextCtrl::GetLineText( long lineNo ) const
{ {
}; }
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event ) void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
{ {
}; }
long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const
{ {
}; }
long wxTextCtrl::XYToPosition( long x, long y ) long wxTextCtrl::XYToPosition( long x, long y )
{ {
}; }
int wxTextCtrl::GetNumberOfLines(void) int wxTextCtrl::GetNumberOfLines(void)
{ {
}; }
*/ */
void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetInsertionPoint( long pos )
@@ -228,7 +228,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
gtk_text_set_point( GTK_TEXT(m_text), tmp ); gtk_text_set_point( GTK_TEXT(m_text), tmp );
else else
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(void)
{ {
@@ -238,7 +238,7 @@ void wxTextCtrl::SetInsertionPointEnd(void)
else else
pos = GTK_ENTRY(m_text)->text_length; pos = GTK_ENTRY(m_text)->text_length;
SetInsertionPoint( pos-1 ); SetInsertionPoint( pos-1 );
}; }
void wxTextCtrl::SetEditable( bool editable ) void wxTextCtrl::SetEditable( bool editable )
{ {
@@ -246,22 +246,22 @@ void wxTextCtrl::SetEditable( bool editable )
gtk_text_set_editable( GTK_TEXT(m_text), editable ); gtk_text_set_editable( GTK_TEXT(m_text), editable );
else else
gtk_entry_set_editable( GTK_ENTRY(m_text), editable ); gtk_entry_set_editable( GTK_ENTRY(m_text), editable );
}; }
void wxTextCtrl::SetSelection( long from, long to ) void wxTextCtrl::SetSelection( long from, long to )
{ {
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}; }
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) ) 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(void) 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(void) const
{ {
@@ -271,12 +271,12 @@ long wxTextCtrl::GetLastPosition(void) const
else else
pos = GTK_ENTRY(m_text)->text_length; pos = GTK_ENTRY(m_text)->text_length;
return (long)pos-1; return (long)pos-1;
}; }
void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Remove( long from, long to )
{ {
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}; }
void wxTextCtrl::Replace( long from, long to, const wxString &value ) void wxTextCtrl::Replace( long from, long to, const wxString &value )
{ {
@@ -284,31 +284,31 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
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(void)
{ {
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(void)
{ {
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(void)
{ {
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
}; }
void wxTextCtrl::Delete(void) void wxTextCtrl::Delete(void)
{ {
SetValue( "" ); SetValue( "" );
}; }
void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) ) void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
{ {
}; }
int wxTextCtrl::overflow( int WXUNUSED(c) ) int wxTextCtrl::overflow( int WXUNUSED(c) )
{ {
@@ -320,7 +320,7 @@ int wxTextCtrl::overflow( int WXUNUSED(c) )
setp(pbase(), epptr()); setp(pbase(), epptr());
delete[] txt; delete[] txt;
return EOF; return EOF;
}; }
int wxTextCtrl::sync(void) int wxTextCtrl::sync(void)
{ {
@@ -332,12 +332,12 @@ int wxTextCtrl::sync(void)
setp(pbase(), epptr()); setp(pbase(), epptr());
delete[] txt; delete[] txt;
return 0; return 0;
}; }
int wxTextCtrl::underflow(void) int wxTextCtrl::underflow(void)
{ {
return EOF; return EOF;
}; }
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s) wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{ {
@@ -390,7 +390,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
GtkWidget* wxTextCtrl::GetConnectWidget(void) GtkWidget* wxTextCtrl::GetConnectWidget(void)
{ {
return GTK_WIDGET(m_text); return GTK_WIDGET(m_text);
}; }

View File

@@ -57,6 +57,25 @@ void wxDisplaySize( int *width, int *height )
if (height) *height = gdk_screen_height(); if (height) *height = gdk_screen_height();
} }
void wxGetMousePosition( int* x, int* y )
{
wxFAIL_MSG( "GetMousePosition not yet implemented" );
if (x) *x = 0;
if (y) *y = 0;
};
bool wxColourDisplay(void)
{
wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
return TRUE;
}
int wxDisplayDepth(void)
{
wxFAIL_MSG( "wxDisplayDepth always returns 8" );
return 8;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// user and home routines // user and home routines
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -754,22 +754,16 @@ wxWindow::wxWindow()
m_resizing = FALSE; m_resizing = FALSE;
} }
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_cursor = NULL;
Create( parent, id, pos, size, style, name );
}
bool wxWindow::Create( wxWindow *parent, wxWindowID id, bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
m_isShown = FALSE; m_isShown = FALSE;
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_needParent = TRUE; m_needParent = TRUE;
m_cursor = NULL;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_scrolled_window_new( NULL, NULL ); m_widget = gtk_scrolled_window_new( NULL, NULL );
@@ -887,8 +881,7 @@ wxWindow::~wxWindow(void)
m_windowSizer = NULL; m_windowSizer = NULL;
} }
// If this is a child of a sizer, remove self from parent // If this is a child of a sizer, remove self from parent
if (m_sizerParent) if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
m_sizerParent->RemoveChild((wxWindow *)this);
// Just in case the window has been Closed, but // Just in case the window has been Closed, but
// we're then deleting immediately: don't leave // we're then deleting immediately: don't leave
@@ -900,6 +893,7 @@ wxWindow::~wxWindow(void)
// class // class
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
} }
void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
@@ -921,7 +915,6 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
if (m_height == -1) m_height = 20; if (m_height == -1) m_height = 20;
m_retCode = 0; m_retCode = 0;
m_eventHandler = this; m_eventHandler = this;
m_windowValidator = NULL;
m_windowId = id; m_windowId = id;
m_sizeSet = FALSE; m_sizeSet = FALSE;
if (m_cursor == NULL) if (m_cursor == NULL)
@@ -940,6 +933,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_drawingOffsetY = 0; m_drawingOffsetY = 0;
m_pDropTarget = NULL; m_pDropTarget = NULL;
m_resizing = FALSE; m_resizing = FALSE;
m_windowValidator = NULL;
} }
void wxWindow::PostCreation(void) void wxWindow::PostCreation(void)
@@ -1580,9 +1574,11 @@ wxValidator *wxWindow::GetValidator(void)
return m_windowValidator; return m_windowValidator;
} }
void wxWindow::SetValidator( wxValidator *validator ) void wxWindow::SetValidator( const wxValidator& validator )
{ {
m_windowValidator = validator; if (m_windowValidator) delete m_windowValidator;
m_windowValidator = validator.Clone();
if (m_windowValidator) m_windowValidator->SetWindow(this);
} }
bool wxWindow::IsBeingDeleted(void) bool wxWindow::IsBeingDeleted(void)
@@ -1696,6 +1692,16 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
// do something ? // do something ?
} }
wxColour wxWindow::GetForegroundColour(void) const
{
return m_foregroundColour;
}
void wxWindow::SetForegroundColour( const wxColour &colour )
{
m_foregroundColour = colour;
}
bool wxWindow::Validate(void) bool wxWindow::Validate(void)
{ {
wxNode *node = GetChildren()->First(); wxNode *node = GetChildren()->First();

View File

@@ -40,24 +40,17 @@ static void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitma
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxBitmapButton::wxBitmapButton(void) wxBitmapButton::wxBitmapButton(void)
{ {
}; }
wxBitmapButton::wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, bitmap, pos, size, style, name );
};
bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap, bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
@@ -65,6 +58,8 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
PreCreation( parent, id, pos, newSize, style, name ); PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_bitmap = bitmap; m_bitmap = bitmap;
m_label = ""; m_label = "";
@@ -78,7 +73,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
gtk_widget_show( pixmap ); gtk_widget_show( pixmap );
gtk_container_add( GTK_CONTAINER(m_widget), pixmap ); gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
}; }
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10; if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+10;
if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10; if (newSize.y == -1) newSize.y = m_bitmap.GetWidth()+10;
@@ -92,18 +87,19 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxBitmapButton::SetDefault(void) void wxBitmapButton::SetDefault(void)
{ {
}; gtk_widget_grab_default( m_widget );
}
void wxBitmapButton::SetLabel( const wxString &label ) void wxBitmapButton::SetLabel( const wxString &label )
{ {
wxControl::SetLabel( label ); wxControl::SetLabel( label );
}; }
wxString wxBitmapButton::GetLabel(void) const wxString wxBitmapButton::GetLabel(void) const
{ {
return wxControl::GetLabel(); return wxControl::GetLabel();
}; }

View File

@@ -40,30 +40,25 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId()); wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button); event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event); button->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
wxButton::wxButton(void) wxButton::wxButton(void)
{ {
}; }
wxButton::wxButton( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label, bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
wxSize newSize = size; wxSize newSize = size;
PreCreation( parent, id, pos, newSize, style, name ); PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_widget = gtk_button_new_with_label( m_label ); m_widget = gtk_button_new_with_label( m_label );
SetLabel(label); SetLabel(label);
@@ -80,11 +75,12 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxButton::SetDefault(void) void wxButton::SetDefault(void)
{ {
}; gtk_widget_grab_default( m_widget );
}
void wxButton::SetLabel( const wxString &label ) void wxButton::SetLabel( const wxString &label )
{ {
@@ -92,5 +88,5 @@ void wxButton::SetLabel( const wxString &label )
GtkButton *bin = GTK_BUTTON( m_widget ); GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child ); GtkLabel *g_label = GTK_LABEL( bin->child );
gtk_label_set( g_label, GetLabel() ); gtk_label_set( g_label, GetLabel() );
}; }

View File

@@ -34,7 +34,7 @@ static void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckB
event.SetInt( cb->GetValue() ); event.SetInt( cb->GetValue() );
event.SetEventObject(cb); event.SetEventObject(cb);
cb->GetEventHandler()->ProcessEvent(event); cb->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -42,23 +42,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)
wxCheckBox::wxCheckBox(void) wxCheckBox::wxCheckBox(void)
{ {
}; }
wxCheckBox::wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
Create( parent, id, label, pos, size, style, name );
};
bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label, bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
SetLabel( label ); SetLabel( label );
m_widget = gtk_check_button_new_with_label( label ); m_widget = gtk_check_button_new_with_label( label );
@@ -76,7 +71,7 @@ bool wxCheckBox::Create( wxWindow *parent, wxWindowID id, const wxString &label
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxCheckBox::SetValue( bool state ) void wxCheckBox::SetValue( bool state )
{ {
@@ -84,11 +79,11 @@ void wxCheckBox::SetValue( bool state )
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_ACTIVE );
else else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL ); gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
}; }
bool wxCheckBox::GetValue(void) const bool wxCheckBox::GetValue(void) const
{ {
GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget); GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
return tb->active; return tb->active;
}; }

View File

@@ -36,7 +36,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
event.SetString( WXSTRINGCAST(tmp) ); event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice); event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event); choice->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -44,25 +44,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void) wxChoice::wxChoice(void)
{ {
}; }
wxChoice::wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxChoice::Create( wxWindow *parent, wxWindowID id, bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_option_menu_new(); m_widget = gtk_option_menu_new();
wxSize newSize = size; wxSize newSize = size;
@@ -81,7 +75,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), item ); gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item ); gtk_widget_show( item );
}; }
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu ); gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation(); PostCreation();
@@ -89,7 +83,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxChoice::Append( const wxString &item ) void wxChoice::Append( const wxString &item )
{ {
@@ -100,14 +94,14 @@ void wxChoice::Append( const wxString &item )
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this ); GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), menu_item ); gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item ); gtk_widget_show( menu_item );
}; }
void wxChoice::Clear(void) void wxChoice::Clear(void)
{ {
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) ); gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new(); GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu ); gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
}; }
int wxChoice::FindString( const wxString &string ) const int wxChoice::FindString( const wxString &string ) const
{ {
@@ -129,17 +123,17 @@ int wxChoice::FindString( const wxString &string ) const
if (string == label->label) return count; if (string == label->label) return count;
child = child->next; child = child->next;
count++; count++;
}; }
wxFAIL_MSG( "wxChoice: string not found" ); wxFAIL_MSG( "wxChoice: string not found" );
return -1; return -1;
}; }
int wxChoice::GetColumns(void) const int wxChoice::GetColumns(void) const
{ {
return 1; return 1;
}; }
int wxChoice::GetSelection(void) int wxChoice::GetSelection(void)
{ {
@@ -152,12 +146,12 @@ int wxChoice::GetSelection(void)
if (!bin->child) return count; if (!bin->child) return count;
child = child->next; child = child->next;
count++; count++;
}; }
wxFAIL_MSG( "wxChoice: no selection" ); wxFAIL_MSG( "wxChoice: no selection" );
return -1; return -1;
}; }
wxString wxChoice::GetString( int n ) const wxString wxChoice::GetString( int n ) const
{ {
@@ -176,15 +170,15 @@ wxString wxChoice::GetString( int n ) const
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child ); if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
return label->label; return label->label;
}; }
child = child->next; child = child->next;
count++; count++;
}; }
wxFAIL_MSG( "wxChoice: string not found" ); wxFAIL_MSG( "wxChoice: string not found" );
return ""; return "";
}; }
wxString wxChoice::GetStringSelection(void) const wxString wxChoice::GetStringSelection(void) const
{ {
@@ -193,7 +187,7 @@ wxString wxChoice::GetStringSelection(void) const
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" ); wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label; return label->label;
}; }
int wxChoice::Number(void) const int wxChoice::Number(void) const
{ {
@@ -204,13 +198,13 @@ int wxChoice::Number(void) const
{ {
count++; count++;
child = child->next; child = child->next;
}; }
return count; return count;
}; }
void wxChoice::SetColumns( int WXUNUSED(n) ) void wxChoice::SetColumns( int WXUNUSED(n) )
{ {
}; }
void wxChoice::SetSelection( int n ) void wxChoice::SetSelection( int n )
{ {
@@ -218,11 +212,11 @@ void wxChoice::SetSelection( int n )
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp ); gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
gtk_choice_clicked_callback( NULL, this ); gtk_choice_clicked_callback( NULL, this );
}; }
void wxChoice::SetStringSelection( const wxString &string ) void wxChoice::SetStringSelection( const wxString &string )
{ {
int n = FindString( string ); int n = FindString( string );
if (n != -1) SetSelection( n ); if (n != -1) SetSelection( n );
}; }

View File

@@ -47,7 +47,7 @@ static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox
event.SetString( WXSTRINGCAST(tmp) ); event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(combo); event.SetEventObject(combo);
combo->GetEventHandler()->ProcessEvent(event); combo->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// size // size
@@ -63,7 +63,7 @@ static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxC
alloc->width - widget->button->allocation.width; alloc->width - widget->button->allocation.width;
return FALSE; return FALSE;
}; }
*/ */
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -73,13 +73,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxString& name ) long style, const wxValidator& validator, const wxString& name )
{ {
m_alreadySent = FALSE; m_alreadySent = FALSE;
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_combo_new(); m_widget = gtk_combo_new();
wxSize newSize = size; wxSize newSize = size;
@@ -102,7 +104,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
gtk_signal_connect( GTK_OBJECT(list_item), "select", gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
}; }
PostCreation(); PostCreation();
@@ -116,7 +118,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxComboBox::Clear(void) void wxComboBox::Clear(void)
{ {
@@ -124,12 +126,12 @@ void wxComboBox::Clear(void)
gtk_list_clear_items( GTK_LIST(list), 0, Number() ); gtk_list_clear_items( GTK_LIST(list), 0, Number() );
m_clientData.Clear(); m_clientData.Clear();
}; }
void wxComboBox::Append( const wxString &item ) void wxComboBox::Append( const wxString &item )
{ {
Append( item, (char*)NULL ); Append( item, (char*)NULL );
}; }
void wxComboBox::Append( const wxString &item, char *clientData ) void wxComboBox::Append( const wxString &item, char *clientData )
{ {
@@ -146,7 +148,7 @@ void wxComboBox::Append( const wxString &item, char *clientData )
gtk_widget_show( list_item ); gtk_widget_show( list_item );
m_clientData.Append( (wxObject*)clientData ); m_clientData.Append( (wxObject*)clientData );
}; }
void wxComboBox::Delete( int n ) void wxComboBox::Delete( int n )
{ {
@@ -160,7 +162,7 @@ void wxComboBox::Delete( int n )
} }
else else
m_clientData.DeleteNode( node ); m_clientData.DeleteNode( node );
}; }
int wxComboBox::FindString( const wxString &item ) int wxComboBox::FindString( const wxString &item )
{ {
@@ -175,12 +177,12 @@ int wxComboBox::FindString( const wxString &item )
if (item == label->label) return count; if (item == label->label) return count;
count++; count++;
child = child->next; child = child->next;
}; }
wxFAIL_MSG( "wxComboBox: string not found" ); wxFAIL_MSG( "wxComboBox: string not found" );
return -1; return -1;
}; }
char* wxComboBox::GetClientData( int n ) char* wxComboBox::GetClientData( int n )
{ {
@@ -190,7 +192,7 @@ char* wxComboBox::GetClientData( int n )
wxFAIL_MSG( "wxComboBox: wrong index" ); wxFAIL_MSG( "wxComboBox: wrong index" );
return NULL; return NULL;
}; }
void wxComboBox::SetClientData( int n, char * clientData ) void wxComboBox::SetClientData( int n, char * clientData )
{ {
@@ -198,7 +200,7 @@ void wxComboBox::SetClientData( int n, char * clientData )
if (node) node->SetData( (wxObject*) clientData ); if (node) node->SetData( (wxObject*) clientData );
wxFAIL_MSG( "wxComboBox: wrong index" ); wxFAIL_MSG( "wxComboBox: wrong index" );
}; }
int wxComboBox::GetSelection(void) const int wxComboBox::GetSelection(void) const
{ {
@@ -214,13 +216,13 @@ int wxComboBox::GetSelection(void) const
if (child->data == selection->data) return count; if (child->data == selection->data) return count;
count++; count++;
child = child->next; child = child->next;
}; }
}; }
wxFAIL_MSG( "wxComboBox: no selection" ); wxFAIL_MSG( "wxComboBox: no selection" );
return -1; return -1;
}; }
wxString wxComboBox::GetString( int n ) const wxString wxComboBox::GetString( int n ) const
{ {
@@ -232,12 +234,12 @@ wxString wxComboBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
return label->label; return label->label;
}; }
wxFAIL_MSG( "wxComboBox: wrong index" ); wxFAIL_MSG( "wxComboBox: wrong index" );
return ""; return "";
}; }
wxString wxComboBox::GetStringSelection(void) const wxString wxComboBox::GetStringSelection(void) const
{ {
@@ -249,12 +251,12 @@ wxString wxComboBox::GetStringSelection(void) const
GtkBin *bin = GTK_BIN( selection->data ); GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label; wxString tmp = GTK_LABEL( bin->child )->label;
return tmp; return tmp;
}; }
wxFAIL_MSG( "wxComboBox: no selection" ); wxFAIL_MSG( "wxComboBox: no selection" );
return ""; return "";
}; }
int wxComboBox::Number(void) const int wxComboBox::Number(void) const
{ {
@@ -262,29 +264,29 @@ int wxComboBox::Number(void) const
GList *child = GTK_LIST(list)->children; GList *child = GTK_LIST(list)->children;
int count = 0; int count = 0;
while (child) { count++; child = child->next; }; while (child) { count++; child = child->next; }
return count; return count;
}; }
void wxComboBox::SetSelection( int n ) void wxComboBox::SetSelection( int n )
{ {
GtkWidget *list = GTK_COMBO(m_widget)->list; GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_select_item( GTK_LIST(list), n ); gtk_list_select_item( GTK_LIST(list), n );
}; }
void wxComboBox::SetStringSelection( const wxString &string ) void wxComboBox::SetStringSelection( const wxString &string )
{ {
int res = FindString( string ); int res = FindString( string );
if (res == -1) return; if (res == -1) return;
SetSelection( res ); SetSelection( res );
}; }
wxString wxComboBox::GetValue(void) const wxString wxComboBox::GetValue(void) const
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) ); wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) );
return tmp; return tmp;
}; }
void wxComboBox::SetValue( const wxString& value ) void wxComboBox::SetValue( const wxString& value )
{ {
@@ -292,52 +294,52 @@ void wxComboBox::SetValue( const wxString& value )
wxString tmp = ""; wxString tmp = "";
if (!value.IsNull()) tmp = value; if (!value.IsNull()) tmp = value;
gtk_entry_set_text( GTK_ENTRY(entry), tmp ); gtk_entry_set_text( GTK_ENTRY(entry), tmp );
}; }
void wxComboBox::Copy(void) void wxComboBox::Copy(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
}; }
void wxComboBox::Cut(void) void wxComboBox::Cut(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
}; }
void wxComboBox::Paste(void) void wxComboBox::Paste(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
}; }
void wxComboBox::SetInsertionPoint( long pos ) void wxComboBox::SetInsertionPoint( long pos )
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int tmp = (int) pos; int tmp = (int) pos;
gtk_entry_set_position( GTK_ENTRY(entry), tmp ); gtk_entry_set_position( GTK_ENTRY(entry), tmp );
}; }
void wxComboBox::SetInsertionPointEnd(void) void wxComboBox::SetInsertionPointEnd(void)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length; int pos = GTK_ENTRY(entry)->text_length;
SetInsertionPoint( pos-1 ); SetInsertionPoint( pos-1 );
}; }
long wxComboBox::GetInsertionPoint(void) const long wxComboBox::GetInsertionPoint(void) const
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
return (long) GTK_EDITABLE(entry)->current_pos; return (long) GTK_EDITABLE(entry)->current_pos;
}; }
long wxComboBox::GetLastPosition(void) const long wxComboBox::GetLastPosition(void) const
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length; int pos = GTK_ENTRY(entry)->text_length;
return (long) pos-1; return (long) pos-1;
}; }
void wxComboBox::Replace( long from, long to, const wxString& value ) void wxComboBox::Replace( long from, long to, const wxString& value )
{ {
@@ -346,20 +348,20 @@ void wxComboBox::Replace( long from, long to, const wxString& value )
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
gtk_editable_insert_text( GTK_EDITABLE(entry), value, value.Length(), &pos ); gtk_editable_insert_text( GTK_EDITABLE(entry), value, value.Length(), &pos );
}; }
void wxComboBox::Remove(long from, long to) void wxComboBox::Remove(long from, long to)
{ {
GtkWidget *entry = GTK_COMBO(m_widget)->entry; GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
}; }
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) ) void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{ {
}; }
void wxComboBox::SetEditable( bool WXUNUSED(editable) ) void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{ {
}; }

View File

@@ -23,18 +23,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxControl,wxWindow)
wxControl::wxControl(void) wxControl::wxControl(void)
{ {
m_needParent = TRUE; m_needParent = TRUE;
}; }
wxControl::wxControl( wxWindow *parent, wxWindowID id, wxControl::wxControl( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) : long style, const wxString &name ) :
wxWindow( parent, id, pos, size, style, name ) wxWindow( parent, id, pos, size, style, name )
{ {
}; }
void wxControl::Command( wxCommandEvent &WXUNUSED(event) ) void wxControl::Command( wxCommandEvent &WXUNUSED(event) )
{ {
}; }
void wxControl::SetLabel( const wxString &label ) void wxControl::SetLabel( const wxString &label )
{ {
@@ -50,12 +50,12 @@ void wxControl::SetLabel( const wxString &label )
m_label << *pc; m_label << *pc;
} }
}; }
wxString wxControl::GetLabel(void) const wxString wxControl::GetLabel(void) const
{ {
return m_label; return m_label;
}; }

View File

@@ -22,12 +22,14 @@ IMPLEMENT_DYNAMIC_CLASS(wxGauge,wxControl)
bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range, bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) long style, const wxValidator& validator, const wxString& name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_rangeMax = range; m_rangeMax = range;
m_gaugePos = 0; m_gaugePos = 0;
m_useProgressBar = TRUE; m_useProgressBar = TRUE;
@@ -39,7 +41,7 @@ bool wxGauge::Create( wxWindow *parent, wxWindowID id, int range,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxGauge::SetRange( int r ) void wxGauge::SetRange( int r )
{ {
@@ -47,7 +49,7 @@ void wxGauge::SetRange( int r )
if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
}; }
void wxGauge::SetValue( int pos ) void wxGauge::SetValue( int pos )
{ {
@@ -55,15 +57,15 @@ void wxGauge::SetValue( int pos )
if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax; if (m_gaugePos > m_rangeMax) m_gaugePos = m_rangeMax;
gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax ); gtk_progress_bar_update( GTK_PROGRESS_BAR(m_widget), ((float)m_gaugePos)/m_rangeMax );
}; }
int wxGauge::GetRange(void) const int wxGauge::GetRange(void) const
{ {
return m_rangeMax; return m_rangeMax;
}; }
int wxGauge::GetValue(void) const int wxGauge::GetValue(void) const
{ {
return m_gaugePos; return m_gaugePos;
}; }

View File

@@ -55,7 +55,7 @@ static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox
listbox->GetEventHandler()->ProcessEvent( event ); listbox->GetEventHandler()->ProcessEvent( event );
if (event.m_commandString) delete[] event.m_commandString ; if (event.m_commandString) delete[] event.m_commandString ;
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -64,25 +64,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxListBox,wxControl)
wxListBox::wxListBox(void) wxListBox::wxListBox(void)
{ {
m_list = NULL; m_list = NULL;
}; }
wxListBox::wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
{
Create( parent, id, pos, size, n, choices, style, name );
};
bool wxListBox::Create( wxWindow *parent, wxWindowID id, bool wxListBox::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int n, const wxString choices[],
long style, const wxString &name ) long style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_scrolled_window_new( NULL, NULL ); m_widget = gtk_scrolled_window_new( NULL, NULL );
gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget), gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW(m_widget),
GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC ); GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC );
@@ -118,7 +112,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
m_clientData.Append( (wxObject*)NULL ); m_clientData.Append( (wxObject*)NULL );
gtk_widget_show( list_item ); gtk_widget_show( list_item );
}; }
PostCreation(); PostCreation();
@@ -127,12 +121,12 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
void wxListBox::Append( const wxString &item ) void wxListBox::Append( const wxString &item )
{ {
Append( item, (char*)NULL ); Append( item, (char*)NULL );
}; }
void wxListBox::Append( const wxString &item, char *clientData ) void wxListBox::Append( const wxString &item, char *clientData )
{ {
@@ -151,14 +145,14 @@ void wxListBox::Append( const wxString &item, char *clientData )
m_clientData.Append( (wxObject*)clientData ); m_clientData.Append( (wxObject*)clientData );
gtk_widget_show( list_item ); gtk_widget_show( list_item );
}; }
void wxListBox::Clear(void) void wxListBox::Clear(void)
{ {
gtk_list_clear_items( m_list, 0, Number() ); gtk_list_clear_items( m_list, 0, Number() );
m_clientData.Clear(); m_clientData.Clear();
}; }
void wxListBox::Delete( int n ) void wxListBox::Delete( int n )
{ {
@@ -171,12 +165,12 @@ void wxListBox::Delete( int n )
} }
else else
m_clientData.DeleteNode( node ); m_clientData.DeleteNode( node );
}; }
void wxListBox::Deselect( int n ) void wxListBox::Deselect( int n )
{ {
gtk_list_unselect_item( m_list, n ); gtk_list_unselect_item( m_list, n );
}; }
int wxListBox::FindString( const wxString &item ) const int wxListBox::FindString( const wxString &item ) const
{ {
@@ -189,16 +183,16 @@ int wxListBox::FindString( const wxString &item ) const
if (item == label->label) return count; if (item == label->label) return count;
count++; count++;
child = child->next; child = child->next;
}; }
return -1; return -1;
}; }
char *wxListBox::GetClientData( int n ) const char *wxListBox::GetClientData( int n ) const
{ {
wxNode *node = m_clientData.Nth( n ); wxNode *node = m_clientData.Nth( n );
if (node) return ((char*)node->Data()); if (node) return ((char*)node->Data());
return NULL; return NULL;
}; }
int wxListBox::GetSelection(void) const int wxListBox::GetSelection(void) const
{ {
@@ -212,10 +206,10 @@ int wxListBox::GetSelection(void) const
if (child->data == selection->data) return count; if (child->data == selection->data) return count;
count++; count++;
child = child->next; child = child->next;
}; }
}; }
return -1; return -1;
}; }
int wxListBox::GetSelections(wxArrayInt& aSelections) const int wxListBox::GetSelections(wxArrayInt& aSelections) const
{ {
@@ -240,7 +234,7 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
} }
return count; return count;
}; }
wxString wxListBox::GetString( int n ) const wxString wxListBox::GetString( int n ) const
{ {
@@ -250,9 +244,9 @@ wxString wxListBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
return label->label; return label->label;
}; }
return ""; return "";
}; }
wxString wxListBox::GetStringSelection(void) const wxString wxListBox::GetStringSelection(void) const
{ {
@@ -262,17 +256,17 @@ wxString wxListBox::GetStringSelection(void) const
GtkBin *bin = GTK_BIN( selection->data ); GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label; wxString tmp = GTK_LABEL( bin->child )->label;
return tmp; return tmp;
}; }
return ""; return "";
}; }
int wxListBox::Number(void) int wxListBox::Number(void)
{ {
GList *child = m_list->children; GList *child = m_list->children;
int count = 0; int count = 0;
while (child) { count++; child = child->next; }; while (child) { count++; child = child->next; }
return count; return count;
}; }
bool wxListBox::Selected( int n ) bool wxListBox::Selected( int n )
{ {
@@ -284,28 +278,28 @@ bool wxListBox::Selected( int n )
{ {
if (child->data == target->data) return TRUE; if (child->data == target->data) return TRUE;
child = child->next; child = child->next;
}; }
}; }
return FALSE; return FALSE;
}; }
void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) ) void wxListBox::Set( int WXUNUSED(n), const wxString *WXUNUSED(choices) )
{ {
}; }
void wxListBox::SetClientData( int n, char *clientData ) void wxListBox::SetClientData( int n, char *clientData )
{ {
wxNode *node = m_clientData.Nth( n ); wxNode *node = m_clientData.Nth( n );
if (node) node->SetData( (wxObject*)clientData ); if (node) node->SetData( (wxObject*)clientData );
}; }
void wxListBox::SetFirstItem( int WXUNUSED(n) ) void wxListBox::SetFirstItem( int WXUNUSED(n) )
{ {
}; }
void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) ) void wxListBox::SetFirstItem( const wxString &WXUNUSED(item) )
{ {
}; }
void wxListBox::SetSelection( int n, bool select ) void wxListBox::SetSelection( int n, bool select )
{ {
@@ -313,7 +307,7 @@ void wxListBox::SetSelection( int n, bool select )
gtk_list_select_item( m_list, n ); gtk_list_select_item( m_list, n );
else else
gtk_list_unselect_item( m_list, n ); gtk_list_unselect_item( m_list, n );
}; }
void wxListBox::SetString( int n, const wxString &string ) void wxListBox::SetString( int n, const wxString &string )
{ {
@@ -323,13 +317,13 @@ void wxListBox::SetString( int n, const wxString &string )
GtkBin *bin = GTK_BIN( child->data ); GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child ); GtkLabel *label = GTK_LABEL( bin->child );
gtk_label_set( label, string ); gtk_label_set( label, string );
}; }
}; }
void wxListBox::SetStringSelection( const wxString &string, bool select ) void wxListBox::SetStringSelection( const wxString &string, bool select )
{ {
SetSelection( FindString(string), select ); SetSelection( FindString(string), select );
}; }
int wxListBox::GetIndex( GtkWidget *item ) const int wxListBox::GetIndex( GtkWidget *item ) const
{ {
@@ -342,15 +336,15 @@ int wxListBox::GetIndex( GtkWidget *item ) const
if (GTK_WIDGET(child->data) == item) return count; if (GTK_WIDGET(child->data) == item) return count;
count++; count++;
child = child->next; child = child->next;
}; }
}; }
return -1; return -1;
}; }
GtkWidget *wxListBox::GetConnectWidget(void) GtkWidget *wxListBox::GetConnectWidget(void)
{ {
return GTK_WIDGET(m_list); return GTK_WIDGET(m_list);
}; }

View File

@@ -42,7 +42,7 @@ wxMenuBar::wxMenuBar()
PostCreation(); PostCreation();
Show( TRUE ); Show( TRUE );
}; }
void wxMenuBar::Append( wxMenu *menu, const wxString &title ) void wxMenuBar::Append( wxMenu *menu, const wxString &title )
{ {
@@ -61,7 +61,7 @@ void wxMenuBar::Append( wxMenu *menu, const wxString &title )
gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu ); gtk_menu_item_set_submenu( GTK_MENU_ITEM(root_menu), menu->m_menu );
gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu ); gtk_menu_bar_append( GTK_MENU_BAR(m_menubar), root_menu );
}; }
static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString ) static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString, const wxString &itemString )
{ {
@@ -69,7 +69,7 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
{ {
int res = menu->FindItem( itemString ); int res = menu->FindItem( itemString );
if (res != -1) return res; if (res != -1) return res;
}; }
wxNode *node = menu->m_items.First(); wxNode *node = menu->m_items.First();
while (node) while (node)
{ {
@@ -77,9 +77,9 @@ static int FindMenuItemRecursive( const wxMenu *menu, const wxString &menuString
if (item->IsSubMenu()) if (item->IsSubMenu())
return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString); return FindMenuItemRecursive(item->GetSubMenu(), menuString, itemString);
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemString ) const
{ {
@@ -90,9 +90,9 @@ int wxMenuBar::FindMenuItem( const wxString &menuString, const wxString &itemStr
int res = FindMenuItemRecursive( menu, menuString, itemString); int res = FindMenuItemRecursive( menu, menuString, itemString);
if (res != -1) return res; if (res != -1) return res;
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
// Find a wxMenuItem using its id. Recurses down into sub-menus // Find a wxMenuItem using its id. Recurses down into sub-menus
static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id) static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
@@ -105,10 +105,10 @@ static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
if ( item->IsSubMenu() ) if ( item->IsSubMenu() )
result = FindMenuItemByIdRecursive( item->GetSubMenu(), id ); result = FindMenuItemByIdRecursive( item->GetSubMenu(), id );
node = node->Next(); node = node->Next();
}; }
return result; return result;
}; }
wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const
{ {
@@ -127,48 +127,55 @@ void wxMenuBar::Check( int id, bool check )
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) item->Check(check); if (item) item->Check(check);
}; }
bool wxMenuBar::Checked( int id ) const bool wxMenuBar::Checked( int id ) const
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsChecked(); if (item) return item->IsChecked();
return FALSE; return FALSE;
}; }
void wxMenuBar::Enable( int id, bool enable ) void wxMenuBar::Enable( int id, bool enable )
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) item->Enable(enable); if (item) item->Enable(enable);
}; }
bool wxMenuBar::Enabled( int id ) const bool wxMenuBar::Enabled( int id ) const
{ {
wxMenuItem* item = FindMenuItemById( id ); wxMenuItem* item = FindMenuItemById( id );
if (item) return item->IsEnabled(); if (item) return item->IsEnabled();
return FALSE; return FALSE;
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
// wxMenu // wxMenu
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
void gtk_menu_clicked_callback( GtkWidget *widget, gpointer data ) static void gtk_menu_clicked_callback( GtkWidget *widget, wxMenu *menu )
{ {
wxMenu *menu = (wxMenu*)data;
int id = menu->FindMenuIdByMenuItem(widget); int id = menu->FindMenuIdByMenuItem(widget);
wxASSERT( id != -1 ); // should find it! wxASSERT( id != -1 ); // should find it!
if (!menu->IsEnabled(id)) if (!menu->IsEnabled(id)) return;
return;
wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, id ); wxCommandEvent event( wxEVENT_TYPE_MENU_COMMAND, id );
event.SetEventObject( menu ); event.SetEventObject( menu );
event.SetInt(id ); event.SetInt(id );
if (menu->m_callback)
{
(void) (*(menu->m_callback)) (*menu, event);
return;
}
if (menu->GetEventHandler()->ProcessEvent(event)) return;
wxWindow *win = menu->GetInvokingWindow(); wxWindow *win = menu->GetInvokingWindow();
if (win) win->GetEventHandler()->ProcessEvent( event ); if (win) win->GetEventHandler()->ProcessEvent( event );
}; }
IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject) IMPLEMENT_DYNAMIC_CLASS(wxMenuItem,wxObject)
@@ -180,7 +187,7 @@ wxMenuItem::wxMenuItem()
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_subMenu = NULL; m_subMenu = NULL;
m_menuItem = NULL; m_menuItem = NULL;
}; }
void wxMenuItem::SetText(const wxString& str) void wxMenuItem::SetText(const wxString& str)
{ {
@@ -214,13 +221,21 @@ bool wxMenuItem::IsChecked() const
IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler) IMPLEMENT_DYNAMIC_CLASS(wxMenu,wxEvtHandler)
wxMenu::wxMenu( const wxString &title ) wxMenu::wxMenu( const wxString& title, const wxFunction func )
{ {
m_title = title; m_title = title;
m_items.DeleteContents( TRUE ); m_items.DeleteContents( TRUE );
m_invokingWindow = NULL; m_invokingWindow = NULL;
m_menu = gtk_menu_new(); // Do not show! m_menu = gtk_menu_new(); // Do not show!
}; m_callback = func;
m_eventHandler = this;
if (m_title.IsNull()) m_title = "";
if (m_title != "")
{
Append(-2, m_title);
AppendSeparator();
}
}
void wxMenu::AppendSeparator() void wxMenu::AppendSeparator()
{ {
@@ -232,7 +247,7 @@ void wxMenu::AppendSeparator()
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
mitem->SetMenuItem(menuItem); mitem->SetMenuItem(menuItem);
m_items.Append( mitem ); m_items.Append( mitem );
}; }
void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable ) void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool checkable )
{ {
@@ -253,7 +268,7 @@ void wxMenu::Append( int id, const wxString &item, const wxString &helpStr, bool
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
m_items.Append( mitem ); m_items.Append( mitem );
}; }
void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr ) void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxString &helpStr )
{ {
@@ -270,7 +285,7 @@ void wxMenu::Append( int id, const wxString &text, wxMenu *subMenu, const wxStri
gtk_menu_append( GTK_MENU(m_menu), menuItem ); gtk_menu_append( GTK_MENU(m_menu), menuItem );
gtk_widget_show( menuItem ); gtk_widget_show( menuItem );
m_items.Append( mitem ); m_items.Append( mitem );
}; }
int wxMenu::FindItem( const wxString itemString ) const int wxMenu::FindItem( const wxString itemString ) const
{ {
@@ -289,17 +304,17 @@ int wxMenu::FindItem( const wxString itemString ) const
if (item->GetText() == s) if (item->GetText() == s)
return item->GetId(); return item->GetId();
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
void wxMenu::Enable( int id, bool enable ) void wxMenu::Enable( int id, bool enable )
{ {
wxMenuItem *item = FindItem(id); wxMenuItem *item = FindItem(id);
if ( item ) if ( item )
item->Enable(enable); item->Enable(enable);
}; }
bool wxMenu::IsEnabled( int id ) const bool wxMenu::IsEnabled( int id ) const
{ {
@@ -308,14 +323,14 @@ bool wxMenu::IsEnabled( int id ) const
return item->IsEnabled(); return item->IsEnabled();
else else
return FALSE; return FALSE;
}; }
void wxMenu::Check( int id, bool enable ) void wxMenu::Check( int id, bool enable )
{ {
wxMenuItem *item = FindItem(id); wxMenuItem *item = FindItem(id);
if ( item ) if ( item )
item->Check(enable); item->Check(enable);
}; }
bool wxMenu::IsChecked( int id ) const bool wxMenu::IsChecked( int id ) const
{ {
@@ -324,14 +339,14 @@ bool wxMenu::IsChecked( int id ) const
return item->IsChecked(); return item->IsChecked();
else else
return FALSE; return FALSE;
}; }
void wxMenu::SetLabel( int id, const wxString &label ) void wxMenu::SetLabel( int id, const wxString &label )
{ {
wxMenuItem *item = FindItem(id); wxMenuItem *item = FindItem(id);
if ( item ) if ( item )
item->SetText(label); item->SetText(label);
}; }
int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
{ {
@@ -342,10 +357,10 @@ int wxMenu::FindMenuIdByMenuItem( GtkWidget *menuItem ) const
if (item->GetMenuItem() == menuItem) if (item->GetMenuItem() == menuItem)
return item->GetId(); return item->GetId();
node = node->Next(); node = node->Next();
}; }
return -1; return -1;
}; }
wxMenuItem *wxMenu::FindItem(int id) const wxMenuItem *wxMenu::FindItem(int id) const
{ {
@@ -355,7 +370,7 @@ wxMenuItem *wxMenu::FindItem(int id) const
if ( item->GetId() == id ) if ( item->GetId() == id )
return item; return item;
node = node->Next(); node = node->Next();
}; }
wxLogDebug(_("wxMenu::FindItem: item %d not found."), id); wxLogDebug(_("wxMenu::FindItem: item %d not found."), id);
@@ -365,11 +380,11 @@ wxMenuItem *wxMenu::FindItem(int id) const
void wxMenu::SetInvokingWindow( wxWindow *win ) void wxMenu::SetInvokingWindow( wxWindow *win )
{ {
m_invokingWindow = win; m_invokingWindow = win;
}; }
wxWindow *wxMenu::GetInvokingWindow() wxWindow *wxMenu::GetInvokingWindow()
{ {
return m_invokingWindow; return m_invokingWindow;
}; }

View File

@@ -47,7 +47,7 @@ static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRad
event.SetString( WXSTRINGCAST(tmp) ); event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject( rb ); event.SetEventObject( rb );
rb->GetEventHandler()->ProcessEvent(event); rb->GetEventHandler()->ProcessEvent(event);
}; }
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@@ -55,28 +55,20 @@ IMPLEMENT_DYNAMIC_CLASS(wxRadioBox,wxControl)
wxRadioBox::wxRadioBox(void) wxRadioBox::wxRadioBox(void)
{ {
}; }
wxRadioBox::wxRadioBox( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
int majorDim, long style,
const wxString &name )
{
Create( parent, id, title, pos, size, n, choices, majorDim, style, name );
};
bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title, bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int n, const wxString choices[], int n, const wxString choices[], int WXUNUSED(majorDim),
int WXUNUSED(majorDim), long style, long style, const wxValidator& validator, const wxString &name )
const wxString &name )
{ {
m_alreadySent = FALSE; m_alreadySent = FALSE;
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_frame_new( title ); m_widget = gtk_frame_new( title );
int x = m_x+5; int x = m_x+5;
@@ -111,8 +103,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
y += 20; y += 20;
height += 20; height += 20;
}; }
}; }
wxSize newSize = size; wxSize newSize = size;
if (newSize.x == -1) newSize.x = maxLen+10; if (newSize.x == -1) newSize.x = maxLen+10;
@@ -124,7 +116,7 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
bool wxRadioBox::Show( bool show ) bool wxRadioBox::Show( bool show )
{ {
@@ -136,10 +128,10 @@ bool wxRadioBox::Show( bool show )
GtkWidget *w = GTK_WIDGET( item->data ); GtkWidget *w = GTK_WIDGET( item->data );
if (show) gtk_widget_show( w ); else gtk_widget_hide( w ); if (show) gtk_widget_show( w ); else gtk_widget_hide( w );
item = item->next; item = item->next;
}; }
return TRUE; return TRUE;
}; }
int wxRadioBox::FindString( const wxString &s ) const int wxRadioBox::FindString( const wxString &s ) const
{ {
@@ -154,10 +146,10 @@ int wxRadioBox::FindString( const wxString &s ) const
if (s == l->label) return count; if (s == l->label) return count;
count--; count--;
item = item->next; item = item->next;
}; }
return -1; return -1;
}; }
void wxRadioBox::SetSelection( int n ) void wxRadioBox::SetSelection( int n )
{ {
@@ -168,7 +160,7 @@ void wxRadioBox::SetSelection( int n )
GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data ); GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
gtk_toggle_button_set_state( button, 1 ); gtk_toggle_button_set_state( button, 1 );
}; }
int wxRadioBox::GetSelection(void) const int wxRadioBox::GetSelection(void) const
{ {
@@ -180,9 +172,9 @@ int wxRadioBox::GetSelection(void) const
if (GTK_TOGGLE_BUTTON(button)->active) return count; if (GTK_TOGGLE_BUTTON(button)->active) return count;
count++; count++;
item = item->next; item = item->next;
}; }
return -1; return -1;
}; }
wxString wxRadioBox::GetString( int n ) const wxString wxRadioBox::GetString( int n ) const
{ {
@@ -196,48 +188,48 @@ wxString wxRadioBox::GetString( int n ) const
GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child ); GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
return wxString( label->label ); return wxString( label->label );
}; }
wxString wxRadioBox::GetLabel(void) const wxString wxRadioBox::GetLabel(void) const
{ {
return wxControl::GetLabel(); return wxControl::GetLabel();
}; }
void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented."); wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; }
void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) ) void wxRadioBox::SetLabel( int WXUNUSED(item), const wxString& WXUNUSED(label) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented."); wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; }
void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) ) void wxRadioBox::SetLabel( int WXUNUSED(item), wxBitmap *WXUNUSED(bitmap) )
{ {
wxFAIL_MSG("wxRadioBox::SetLabel not implemented."); wxFAIL_MSG("wxRadioBox::SetLabel not implemented.");
}; }
wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const wxString wxRadioBox::GetLabel( int WXUNUSED(item) ) const
{ {
wxFAIL_MSG("wxRadioBox::GetLabel not implemented."); wxFAIL_MSG("wxRadioBox::GetLabel not implemented.");
return ""; return "";
}; }
void wxRadioBox::Enable( bool WXUNUSED(enable) ) void wxRadioBox::Enable( bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented."); wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; }
void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) ) void wxRadioBox::Enable( int WXUNUSED(item), bool WXUNUSED(enable) )
{ {
wxFAIL_MSG("wxRadioBox::Enable not implemented."); wxFAIL_MSG("wxRadioBox::Enable not implemented.");
}; }
void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) ) void wxRadioBox::Show( int WXUNUSED(item), bool WXUNUSED(show) )
{ {
wxFAIL_MSG("wxRadioBox::Show not implemented."); wxFAIL_MSG("wxRadioBox::Show not implemented.");
}; }
wxString wxRadioBox::GetStringSelection(void) const wxString wxRadioBox::GetStringSelection(void) const
{ {
@@ -249,11 +241,11 @@ wxString wxRadioBox::GetStringSelection(void) const
{ {
GtkLabel *label = GTK_LABEL( button->child ); GtkLabel *label = GTK_LABEL( button->child );
return label->label; return label->label;
}; }
item = item->next; item = item->next;
}; }
return ""; return "";
}; }
bool wxRadioBox::SetStringSelection( const wxString&s ) bool wxRadioBox::SetStringSelection( const wxString&s )
{ {
@@ -261,7 +253,7 @@ bool wxRadioBox::SetStringSelection( const wxString&s )
if (res == -1) return FALSE; if (res == -1) return FALSE;
SetSelection( res ); SetSelection( res );
return TRUE; return TRUE;
}; }
int wxRadioBox::Number(void) const int wxRadioBox::Number(void) const
{ {
@@ -271,17 +263,17 @@ int wxRadioBox::Number(void) const
{ {
item = item->next; item = item->next;
count++; count++;
}; }
return count; return count;
}; }
int wxRadioBox::GetNumberOfRowsOrCols(void) const int wxRadioBox::GetNumberOfRowsOrCols(void) const
{ {
return 1; return 1;
}; }
void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) ) void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
{ {
wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented."); wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
}; }

View File

@@ -15,3 +15,75 @@
#include "wx/radiobut.h" #include "wx/radiobut.h"
//-----------------------------------------------------------------------------
// data
//-----------------------------------------------------------------------------
extern bool g_blockEventsOnDrag;
//-----------------------------------------------------------------------------
// wxRadioButton
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxRadioButton,wxControl)
static void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioButton *rb )
{
if (!rb->HasVMT()) return;
if (g_blockEventsOnDrag) return;
wxCommandEvent event( wxEVT_COMMAND_RADIOBUTTON_SELECTED, rb->GetId());
event.SetInt( rb->GetValue() );
event.SetEventObject( rb );
rb->GetEventHandler()->ProcessEvent( event );
}
bool wxRadioButton::Create( wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos, const wxSize& size, long style,
const wxValidator& validator, const wxString& name )
{
m_needParent = TRUE;
wxSize newSize = size;
PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_widget = gtk_radio_button_new_with_label( NULL, label );
SetLabel(label);
if (newSize.x == -1) newSize.x = 22+gdk_string_measure( m_widget->style->font, label );
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
gtk_signal_connect( GTK_OBJECT(m_widget), "clicked",
GTK_SIGNAL_FUNC(gtk_radiobutton_clicked_callback), (gpointer*)this );
PostCreation();
Show( TRUE );
return TRUE;
}
void wxRadioButton::SetLabel( const wxString& label )
{
wxControl::SetLabel( label );
GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child );
gtk_label_set( g_label, GetLabel() );
}
void wxRadioButton::SetValue( bool val )
{
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), val );
}
bool wxRadioButton::GetValue(void) const
{
return GTK_TOGGLE_BUTTON(m_widget)->active;
}

View File

@@ -59,29 +59,24 @@ static void gtk_scrollbar_callback( GtkWidget *WXUNUSED(widget), wxScrollBar *wi
cevent.SetEventObject( win ); cevent.SetEventObject( win );
win->ProcessEvent( cevent ); win->ProcessEvent( cevent );
*/ */
}; }
IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxScrollBar,wxControl)
wxScrollBar::wxScrollBar(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
{
Create( parent, id, pos, size, style, name );
};
wxScrollBar::~wxScrollBar(void) wxScrollBar::~wxScrollBar(void)
{ {
}; }
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id, bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, const wxString& name ) long style, const wxValidator& validator, const wxString& name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0; m_oldPos = 0.0;
if (style & wxSB_VERTICAL == wxSB_VERTICAL) if (style & wxSB_VERTICAL == wxSB_VERTICAL)
@@ -99,27 +94,27 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
int wxScrollBar::GetPosition(void) const int wxScrollBar::GetPosition(void) const
{ {
return (int)(m_adjust->value+0.5); return (int)(m_adjust->value+0.5);
}; }
int wxScrollBar::GetThumbSize() const int wxScrollBar::GetThumbSize() const
{ {
return (int)(m_adjust->page_size+0.5); return (int)(m_adjust->page_size+0.5);
}; }
int wxScrollBar::GetPageSize() const int wxScrollBar::GetPageSize() const
{ {
return (int)(m_adjust->page_increment+0.5); return (int)(m_adjust->page_increment+0.5);
}; }
int wxScrollBar::GetRange() const int wxScrollBar::GetRange() const
{ {
return (int)(m_adjust->upper+0.5); return (int)(m_adjust->upper+0.5);
}; }
void wxScrollBar::SetPosition( int viewStart ) void wxScrollBar::SetPosition( int viewStart )
{ {
@@ -129,7 +124,7 @@ void wxScrollBar::SetPosition( int viewStart )
m_adjust->value = fpos; m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}; }
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize, void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) ) bool WXUNUSED(refresh) )
@@ -154,18 +149,18 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page
m_adjust->page_size = fthumb; m_adjust->page_size = fthumb;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
// Backward compatibility // Backward compatibility
int wxScrollBar::GetValue(void) const int wxScrollBar::GetValue(void) const
{ {
return GetPosition(); return GetPosition();
}; }
void wxScrollBar::SetValue( int viewStart ) void wxScrollBar::SetValue( int viewStart )
{ {
SetPosition( viewStart ); SetPosition( viewStart );
}; }
void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength, int *pageLength ) const
{ {
@@ -178,17 +173,17 @@ void wxScrollBar::GetValues( int *viewStart, int *viewLength, int *objectLength,
*viewLength = range; *viewLength = range;
*objectLength = thumb; *objectLength = thumb;
*pageLength = page; *pageLength = page;
}; }
int wxScrollBar::GetViewLength() const int wxScrollBar::GetViewLength() const
{ {
return (int)(m_adjust->upper+0.5); return (int)(m_adjust->upper+0.5);
}; }
int wxScrollBar::GetObjectLength() const int wxScrollBar::GetObjectLength() const
{ {
return (int)(m_adjust->page_size+0.5); return (int)(m_adjust->page_size+0.5);
}; }
void wxScrollBar::SetPageSize( int pageLength ) void wxScrollBar::SetPageSize( int pageLength )
{ {
@@ -196,7 +191,7 @@ void wxScrollBar::SetPageSize( int pageLength )
int thumb = (int)(m_adjust->page_size+0.5); int thumb = (int)(m_adjust->page_size+0.5);
int range = (int)(m_adjust->upper+0.5); int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, thumb, range, pageLength ); SetScrollbar( pos, thumb, range, pageLength );
}; }
void wxScrollBar::SetObjectLength( int objectLength ) void wxScrollBar::SetObjectLength( int objectLength )
{ {
@@ -204,7 +199,7 @@ void wxScrollBar::SetObjectLength( int objectLength )
int page = (int)(m_adjust->page_increment+0.5); int page = (int)(m_adjust->page_increment+0.5);
int range = (int)(m_adjust->upper+0.5); int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, objectLength, range, page ); SetScrollbar( pos, objectLength, range, page );
}; }
void wxScrollBar::SetViewLength( int viewLength ) void wxScrollBar::SetViewLength( int viewLength )
{ {
@@ -212,5 +207,5 @@ void wxScrollBar::SetViewLength( int viewLength )
int thumb = (int)(m_adjust->page_size+0.5); int thumb = (int)(m_adjust->page_size+0.5);
int page = (int)(m_adjust->page_increment+0.5); int page = (int)(m_adjust->page_increment+0.5);
SetScrollbar( pos, thumb, viewLength, page ); SetScrollbar( pos, thumb, viewLength, page );
}; }

View File

@@ -57,40 +57,29 @@ static void gtk_slider_callback( GtkWidget *WXUNUSED(widget), wxSlider *win )
wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() ); wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, win->GetId() );
cevent.SetEventObject( win ); cevent.SetEventObject( win );
win->ProcessEvent( cevent ); win->ProcessEvent( cevent );
}; }
IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl)
wxSlider::wxSlider(void) wxSlider::wxSlider(void)
{ {
}; }
wxSlider::wxSlider( wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue,
const wxPoint& pos, const wxSize& size,
long style,
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{
Create( parent, id, value, minValue, maxValue,
pos, size, style, name );
};
wxSlider::~wxSlider(void) wxSlider::~wxSlider(void)
{ {
}; }
bool wxSlider::Create(wxWindow *parent, wxWindowID id, bool wxSlider::Create(wxWindow *parent, wxWindowID id,
int value, int minValue, int maxValue, int value, int minValue, int maxValue,
const wxPoint& pos, const wxSize& size, const wxPoint& pos, const wxSize& size,
long style, long style, const wxValidator& validator, const wxString& name )
/* const wxValidator& validator = wxDefaultValidator, */
const wxString& name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0; m_oldPos = 0.0;
if (style & wxSL_VERTICAL == wxSL_VERTICAL) if (style & wxSL_VERTICAL == wxSL_VERTICAL)
@@ -110,12 +99,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
int wxSlider::GetValue(void) const int wxSlider::GetValue(void) const
{ {
return (int)(m_adjust->value+0.5); return (int)(m_adjust->value+0.5);
}; }
void wxSlider::SetValue( int value ) void wxSlider::SetValue( int value )
{ {
@@ -125,7 +114,7 @@ void wxSlider::SetValue( int value )
m_adjust->value = fpos; m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
}; }
void wxSlider::SetRange( int minValue, int maxValue ) void wxSlider::SetRange( int minValue, int maxValue )
{ {
@@ -140,17 +129,17 @@ void wxSlider::SetRange( int minValue, int maxValue )
m_adjust->upper = fmax; m_adjust->upper = fmax;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
int wxSlider::GetMin(void) const int wxSlider::GetMin(void) const
{ {
return (int)(m_adjust->lower+0.5); return (int)(m_adjust->lower+0.5);
}; }
int wxSlider::GetMax(void) const int wxSlider::GetMax(void) const
{ {
return (int)(m_adjust->upper+0.5); return (int)(m_adjust->upper+0.5);
}; }
void wxSlider::SetPageSize( int pageSize ) void wxSlider::SetPageSize( int pageSize )
{ {
@@ -161,12 +150,12 @@ void wxSlider::SetPageSize( int pageSize )
m_adjust->page_increment = fpage; m_adjust->page_increment = fpage;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
int wxSlider::GetPageSize(void) const int wxSlider::GetPageSize(void) const
{ {
return (int)(m_adjust->page_increment+0.5); return (int)(m_adjust->page_increment+0.5);
}; }
void wxSlider::SetThumbLength( int len ) void wxSlider::SetThumbLength( int len )
{ {
@@ -177,71 +166,71 @@ void wxSlider::SetThumbLength( int len )
m_adjust->page_size = flen; m_adjust->page_size = flen;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" ); gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
}; }
int wxSlider::GetThumbLength(void) const int wxSlider::GetThumbLength(void) const
{ {
return (int)(m_adjust->page_size+0.5); return (int)(m_adjust->page_size+0.5);
}; }
void wxSlider::SetLineSize( int WXUNUSED(lineSize) ) void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
{ {
}; }
int wxSlider::GetLineSize(void) const int wxSlider::GetLineSize(void) const
{ {
return 0; return 0;
}; }
// not supported in wxGTK (and GTK) // not supported in wxGTK (and GTK)
void wxSlider::GetSize( int *x, int *y ) const void wxSlider::GetSize( int *x, int *y ) const
{ {
wxWindow::GetSize( x, y ); wxWindow::GetSize( x, y );
}; }
void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags ) void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags )
{ {
wxWindow::SetSize( x, y, width, height, sizeFlags ); wxWindow::SetSize( x, y, width, height, sizeFlags );
}; }
void wxSlider::GetPosition( int *x, int *y ) const void wxSlider::GetPosition( int *x, int *y ) const
{ {
wxWindow::GetPosition( x, y ); wxWindow::GetPosition( x, y );
}; }
void wxSlider::SetTick( int WXUNUSED(tickPos) ) void wxSlider::SetTick( int WXUNUSED(tickPos) )
{ {
}; }
void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) ) void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
{ {
}; }
int wxSlider::GetTickFreq(void) const int wxSlider::GetTickFreq(void) const
{ {
return 0; return 0;
}; }
void wxSlider::ClearTicks(void) void wxSlider::ClearTicks(void)
{ {
}; }
void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) ) void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
{ {
}; }
int wxSlider::GetSelEnd(void) const int wxSlider::GetSelEnd(void) const
{ {
return 0; return 0;
}; }
int wxSlider::GetSelStart(void) const int wxSlider::GetSelStart(void) const
{ {
return 0; return 0;
}; }
void wxSlider::ClearSel(void) void wxSlider::ClearSel(void)
{ {
}; }

View File

@@ -22,10 +22,10 @@
IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl) IMPLEMENT_DYNAMIC_CLASS(wxTextCtrl,wxControl)
void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win ) static void gtk_text_changed_callback( GtkWidget *WXUNUSED(widget), wxTextCtrl *win )
{ {
win->SetModified(); win->SetModified();
}; }
BEGIN_EVENT_TABLE(wxTextCtrl, wxControl) BEGIN_EVENT_TABLE(wxTextCtrl, wxControl)
@@ -34,31 +34,31 @@ END_EVENT_TABLE()
wxTextCtrl::wxTextCtrl(void) : streambuf() wxTextCtrl::wxTextCtrl(void) : streambuf()
{ {
if( allocate() ) if (allocate()) setp(base(),ebuf());
setp(base(),ebuf());
m_modified = FALSE; m_modified = FALSE;
}; }
wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value, wxTextCtrl::wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) : streambuf() int style, const wxValidator& validator, const wxString &name ) : streambuf()
{ {
if( allocate() ) if (allocate()) setp(base(),ebuf());
setp(base(),ebuf());
m_modified = FALSE; m_modified = FALSE;
Create( parent, id, value, pos, size, style, name ); Create( parent, id, value, pos, size, style, validator, name );
}; }
bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value, bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
int style, const wxString &name ) int style, const wxValidator& validator, const wxString &name )
{ {
m_needParent = TRUE; m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
bool bMultiLine = (style & wxTE_MULTILINE) != 0; bool bMultiLine = (style & wxTE_MULTILINE) != 0;
if ( bMultiLine ) if ( bMultiLine )
{ {
@@ -121,7 +121,7 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
{ {
gint tmp = 0; gint tmp = 0;
gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp ); gtk_editable_insert_text( GTK_EDITABLE(m_text), value, value.Length(), &tmp );
}; }
if (style & wxTE_READONLY) if (style & wxTE_READONLY)
{ {
@@ -130,12 +130,12 @@ bool wxTextCtrl::Create( wxWindow *parent, wxWindowID id, const wxString &value,
{ {
if ( bMultiLine ) if ( bMultiLine )
gtk_text_set_editable( GTK_TEXT(m_text), 1 ); gtk_text_set_editable( GTK_TEXT(m_text), 1 );
}; }
Show( TRUE ); Show( TRUE );
return TRUE; return TRUE;
}; }
wxString wxTextCtrl::GetValue(void) const wxString wxTextCtrl::GetValue(void) const
{ {
@@ -148,9 +148,9 @@ wxString wxTextCtrl::GetValue(void) const
else else
{ {
tmp = gtk_entry_get_text( GTK_ENTRY(m_text) ); tmp = gtk_entry_get_text( GTK_ENTRY(m_text) );
}; }
return tmp; return tmp;
}; }
void wxTextCtrl::SetValue( const wxString &value ) void wxTextCtrl::SetValue( const wxString &value )
{ {
@@ -166,8 +166,8 @@ void wxTextCtrl::SetValue( const wxString &value )
else else
{ {
gtk_entry_set_text( GTK_ENTRY(m_text), tmp ); gtk_entry_set_text( GTK_ENTRY(m_text), tmp );
}; }
}; }
void wxTextCtrl::WriteText( const wxString &text ) void wxTextCtrl::WriteText( const wxString &text )
{ {
@@ -181,44 +181,44 @@ void wxTextCtrl::WriteText( const wxString &text )
else else
{ {
gtk_entry_append_text( GTK_ENTRY(m_text), text ); gtk_entry_append_text( GTK_ENTRY(m_text), text );
}; }
}; }
bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) ) bool wxTextCtrl::LoadFile( const wxString &WXUNUSED(file) )
{ {
wxFAIL_MSG(_("wxTextCtrl::LoadFile not implemented")); wxFAIL_MSG( "wxTextCtrl::LoadFile not implemented" );
return FALSE; return FALSE;
}; }
bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) ) bool wxTextCtrl::SaveFile( const wxString &WXUNUSED(file) )
{ {
wxFAIL_MSG(_("wxTextCtrl::SaveFile not implemented")); wxFAIL_MSG( "wxTextCtrl::SaveFile not implemented" );
return FALSE; return FALSE;
}; }
/* /*
wxString wxTextCtrl::GetLineText( long lineNo ) const wxString wxTextCtrl::GetLineText( long lineNo ) const
{ {
}; }
void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event ) void wxTextCtrl::OnDropFiles( wxDropFilesEvent &event )
{ {
}; }
long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const long wxTextCtrl::PositionToXY( long pos, long *x, long *y ) const
{ {
}; }
long wxTextCtrl::XYToPosition( long x, long y ) long wxTextCtrl::XYToPosition( long x, long y )
{ {
}; }
int wxTextCtrl::GetNumberOfLines(void) int wxTextCtrl::GetNumberOfLines(void)
{ {
}; }
*/ */
void wxTextCtrl::SetInsertionPoint( long pos ) void wxTextCtrl::SetInsertionPoint( long pos )
@@ -228,7 +228,7 @@ void wxTextCtrl::SetInsertionPoint( long pos )
gtk_text_set_point( GTK_TEXT(m_text), tmp ); gtk_text_set_point( GTK_TEXT(m_text), tmp );
else else
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(void)
{ {
@@ -238,7 +238,7 @@ void wxTextCtrl::SetInsertionPointEnd(void)
else else
pos = GTK_ENTRY(m_text)->text_length; pos = GTK_ENTRY(m_text)->text_length;
SetInsertionPoint( pos-1 ); SetInsertionPoint( pos-1 );
}; }
void wxTextCtrl::SetEditable( bool editable ) void wxTextCtrl::SetEditable( bool editable )
{ {
@@ -246,22 +246,22 @@ void wxTextCtrl::SetEditable( bool editable )
gtk_text_set_editable( GTK_TEXT(m_text), editable ); gtk_text_set_editable( GTK_TEXT(m_text), editable );
else else
gtk_entry_set_editable( GTK_ENTRY(m_text), editable ); gtk_entry_set_editable( GTK_ENTRY(m_text), editable );
}; }
void wxTextCtrl::SetSelection( long from, long to ) void wxTextCtrl::SetSelection( long from, long to )
{ {
gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_select_region( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}; }
void wxTextCtrl::ShowPosition( long WXUNUSED(pos) ) 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(void) 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(void) const
{ {
@@ -271,12 +271,12 @@ long wxTextCtrl::GetLastPosition(void) const
else else
pos = GTK_ENTRY(m_text)->text_length; pos = GTK_ENTRY(m_text)->text_length;
return (long)pos-1; return (long)pos-1;
}; }
void wxTextCtrl::Remove( long from, long to ) void wxTextCtrl::Remove( long from, long to )
{ {
gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to ); gtk_editable_delete_text( GTK_EDITABLE(m_text), (gint)from, (gint)to );
}; }
void wxTextCtrl::Replace( long from, long to, const wxString &value ) void wxTextCtrl::Replace( long from, long to, const wxString &value )
{ {
@@ -284,31 +284,31 @@ void wxTextCtrl::Replace( long from, long to, const wxString &value )
if (value.IsNull()) return; if (value.IsNull()) return;
gint pos = (gint)to; gint pos = (gint)to;
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(void)
{ {
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(void)
{ {
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(void)
{ {
gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 ); gtk_editable_paste_clipboard( GTK_EDITABLE(m_text), 0 );
}; }
void wxTextCtrl::Delete(void) void wxTextCtrl::Delete(void)
{ {
SetValue( "" ); SetValue( "" );
}; }
void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) ) void wxTextCtrl::OnChar( wxKeyEvent &WXUNUSED(event) )
{ {
}; }
int wxTextCtrl::overflow( int WXUNUSED(c) ) int wxTextCtrl::overflow( int WXUNUSED(c) )
{ {
@@ -320,7 +320,7 @@ int wxTextCtrl::overflow( int WXUNUSED(c) )
setp(pbase(), epptr()); setp(pbase(), epptr());
delete[] txt; delete[] txt;
return EOF; return EOF;
}; }
int wxTextCtrl::sync(void) int wxTextCtrl::sync(void)
{ {
@@ -332,12 +332,12 @@ int wxTextCtrl::sync(void)
setp(pbase(), epptr()); setp(pbase(), epptr());
delete[] txt; delete[] txt;
return 0; return 0;
}; }
int wxTextCtrl::underflow(void) int wxTextCtrl::underflow(void)
{ {
return EOF; return EOF;
}; }
wxTextCtrl& wxTextCtrl::operator<<(const wxString& s) wxTextCtrl& wxTextCtrl::operator<<(const wxString& s)
{ {
@@ -390,7 +390,7 @@ wxTextCtrl& wxTextCtrl::operator<<(const char c)
GtkWidget* wxTextCtrl::GetConnectWidget(void) GtkWidget* wxTextCtrl::GetConnectWidget(void)
{ {
return GTK_WIDGET(m_text); return GTK_WIDGET(m_text);
}; }

View File

@@ -57,6 +57,25 @@ void wxDisplaySize( int *width, int *height )
if (height) *height = gdk_screen_height(); if (height) *height = gdk_screen_height();
} }
void wxGetMousePosition( int* x, int* y )
{
wxFAIL_MSG( "GetMousePosition not yet implemented" );
if (x) *x = 0;
if (y) *y = 0;
};
bool wxColourDisplay(void)
{
wxFAIL_MSG( "wxColourDisplay always returns TRUE" );
return TRUE;
}
int wxDisplayDepth(void)
{
wxFAIL_MSG( "wxDisplayDepth always returns 8" );
return 8;
}
//------------------------------------------------------------------------ //------------------------------------------------------------------------
// user and home routines // user and home routines
//------------------------------------------------------------------------ //------------------------------------------------------------------------

View File

@@ -754,22 +754,16 @@ wxWindow::wxWindow()
m_resizing = FALSE; m_resizing = FALSE;
} }
wxWindow::wxWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
{
m_cursor = NULL;
Create( parent, id, pos, size, style, name );
}
bool wxWindow::Create( wxWindow *parent, wxWindowID id, bool wxWindow::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size, const wxPoint &pos, const wxSize &size,
long style, const wxString &name ) long style, const wxString &name )
{ {
m_isShown = FALSE; m_isShown = FALSE;
m_isEnabled = TRUE; m_isEnabled = TRUE;
m_needParent = TRUE; m_needParent = TRUE;
m_cursor = NULL;
PreCreation( parent, id, pos, size, style, name ); PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_scrolled_window_new( NULL, NULL ); m_widget = gtk_scrolled_window_new( NULL, NULL );
@@ -887,8 +881,7 @@ wxWindow::~wxWindow(void)
m_windowSizer = NULL; m_windowSizer = NULL;
} }
// If this is a child of a sizer, remove self from parent // If this is a child of a sizer, remove self from parent
if (m_sizerParent) if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
m_sizerParent->RemoveChild((wxWindow *)this);
// Just in case the window has been Closed, but // Just in case the window has been Closed, but
// we're then deleting immediately: don't leave // we're then deleting immediately: don't leave
@@ -900,6 +893,7 @@ wxWindow::~wxWindow(void)
// class // class
wxTopLevelWindows.DeleteObject(this); wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
} }
void wxWindow::PreCreation( wxWindow *parent, wxWindowID id, void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
@@ -921,7 +915,6 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
if (m_height == -1) m_height = 20; if (m_height == -1) m_height = 20;
m_retCode = 0; m_retCode = 0;
m_eventHandler = this; m_eventHandler = this;
m_windowValidator = NULL;
m_windowId = id; m_windowId = id;
m_sizeSet = FALSE; m_sizeSet = FALSE;
if (m_cursor == NULL) if (m_cursor == NULL)
@@ -940,6 +933,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_drawingOffsetY = 0; m_drawingOffsetY = 0;
m_pDropTarget = NULL; m_pDropTarget = NULL;
m_resizing = FALSE; m_resizing = FALSE;
m_windowValidator = NULL;
} }
void wxWindow::PostCreation(void) void wxWindow::PostCreation(void)
@@ -1580,9 +1574,11 @@ wxValidator *wxWindow::GetValidator(void)
return m_windowValidator; return m_windowValidator;
} }
void wxWindow::SetValidator( wxValidator *validator ) void wxWindow::SetValidator( const wxValidator& validator )
{ {
m_windowValidator = validator; if (m_windowValidator) delete m_windowValidator;
m_windowValidator = validator.Clone();
if (m_windowValidator) m_windowValidator->SetWindow(this);
} }
bool wxWindow::IsBeingDeleted(void) bool wxWindow::IsBeingDeleted(void)
@@ -1696,6 +1692,16 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
// do something ? // do something ?
} }
wxColour wxWindow::GetForegroundColour(void) const
{
return m_foregroundColour;
}
void wxWindow::SetForegroundColour( const wxColour &colour )
{
m_foregroundColour = colour;
}
bool wxWindow::Validate(void) bool wxWindow::Validate(void)
{ {
wxNode *node = GetChildren()->First(); wxNode *node = GetChildren()->First();

View File

@@ -1 +1 @@
include ../src/gtk/setup/general/makedirs include ../install/unix/setup/general/makedirs

View File

@@ -1 +1 @@
include ../src/gtk/setup/general/makedirs include ../install/unix/setup/general/makedirs

View File

@@ -21,6 +21,7 @@
#include <wx/utils.h> #include <wx/utils.h>
#include <wx/frame.h> #include <wx/frame.h>
#include <wx/panel.h> #include <wx/panel.h>
#include <wx/menu.h>
#include <wx/serbase.h> #include <wx/serbase.h>
#include "serwnd.h" #include "serwnd.h"