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
bin
.gdb_history
Test

View File

@ -598,7 +598,7 @@ class wxListCtrl: public wxControl
void SetSingleStyle( long style, bool add = TRUE ) ;
void SetWindowStyleFlag(long style);
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);
void SetImageList(wxImageList *imageList, int which) ;
bool Arrange( int flag = wxLIST_ALIGN_DEFAULT ); // always wxLIST_ALIGN_LEFT in wxGLC

View File

@ -44,12 +44,19 @@ class wxBitmapButton: public wxControl
public:
wxBitmapButton(void);
wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
inline wxBitmapButton(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)
{
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 SetLabel( const wxString &label );
wxString GetLabel(void) const;

View File

@ -44,12 +44,19 @@ class wxButton: public wxControl
public:
wxButton(void);
wxButton( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
inline wxButton(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)
{
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 SetLabel( const wxString &label );
};

View File

@ -44,12 +44,19 @@ class wxCheckBox: public wxControl
public:
wxCheckBox(void);
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxCheckBoxNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxCheckBoxNameStr );
inline wxCheckBox( 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)
{
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 );
bool GetValue(void) const;
};

View File

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

View File

@ -50,17 +50,18 @@ class wxComboBox: public wxControl
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
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,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
// List functions

View File

@ -88,6 +88,8 @@ public:
virtual wxString GetTitle() const { return m_title; }
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 OnSize( wxSizeEvent &event );

View File

@ -44,34 +44,34 @@ class wxGauge: public wxControl
public:
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,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxString& name = wxGaugeNameStr)
{
Create(parent, id, range, pos, size, style, name);
};
bool Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxGaugeNameStr )
{
Create(parent, id, range, pos, size, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
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) ) {};
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;
// Are we a Win95/GTK progress bar, or a normal gauge?
inline bool GetProgressBar(void) const { return m_useProgressBar; }
// Are we a Win95/GTK progress bar, or a normal gauge?
inline bool GetProgressBar(void) const { return m_useProgressBar; }
protected:

View File

@ -45,14 +45,23 @@ class wxListBox: public wxControl
public:
wxListBox(void);
wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0, const wxString &name = wxListBoxNameStr );
inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
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,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0, const wxString &name = wxListBoxNameStr );
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
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, char *clientData );
void Clear(void);

View File

@ -123,7 +123,7 @@ DECLARE_DYNAMIC_CLASS(wxMenu)
public:
// construction
wxMenu( const wxString &title = "" );
wxMenu( const wxString& title = wxEmptyString, const wxFunction func = NULL );
// operations
// menu creation
@ -149,16 +149,23 @@ public:
// accessors
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:
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
void SetInvokingWindow( wxWindow *win );
wxWindow *GetInvokingWindow();
wxString m_title;
wxList m_items;
wxWindow *m_invokingWindow;
wxString m_title;
wxList m_items;
wxWindow *m_invokingWindow;
wxFunction m_callback;
wxEvtHandler *m_eventHandler;
GtkWidget *m_menu; // GtkMenu
GtkWidget *m_menu; // GtkMenu
};
#endif // __GTKMENUH__

View File

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

View File

@ -27,5 +27,40 @@
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__

View File

@ -43,17 +43,22 @@ class wxScrollBar: public wxControl
public:
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 wxSize& size = wxDefaultSize,
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 );
~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 GetThumbSize() const;
int GetPageSize() const;

View File

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

View File

@ -52,10 +52,12 @@ public:
wxTextCtrl();
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
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 = "",
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;
void SetValue( const wxString &value );
void WriteText( const wxString &text );

View File

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

View File

@ -44,12 +44,19 @@ class wxBitmapButton: public wxControl
public:
wxBitmapButton(void);
wxBitmapButton( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxBitmap &bitmap,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
inline wxBitmapButton(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)
{
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 SetLabel( const wxString &label );
wxString GetLabel(void) const;

View File

@ -44,12 +44,19 @@ class wxButton: public wxControl
public:
wxButton(void);
wxButton( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxButtonNameStr );
inline wxButton(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)
{
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 SetLabel( const wxString &label );
};

View File

@ -44,12 +44,19 @@ class wxCheckBox: public wxControl
public:
wxCheckBox(void);
wxCheckBox( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxCheckBoxNameStr );
bool Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxCheckBoxNameStr );
inline wxCheckBox( 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)
{
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 );
bool GetValue(void) const;
};

View File

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

View File

@ -50,17 +50,18 @@ class wxComboBox: public wxControl
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
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,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
// List functions

View File

@ -88,6 +88,8 @@ public:
virtual wxString GetTitle() const { return m_title; }
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 OnSize( wxSizeEvent &event );

View File

@ -44,34 +44,34 @@ class wxGauge: public wxControl
public:
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,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxString& name = wxGaugeNameStr)
{
Create(parent, id, range, pos, size, style, name);
};
bool Create(wxWindow *parent, wxWindowID id,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxGaugeNameStr )
{
Create(parent, id, range, pos, size, style, validator, name);
}
bool Create( wxWindow *parent, wxWindowID id,
int range,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = wxGA_HORIZONTAL,
const wxValidator& validator = wxDefaultValidator,
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) ) {};
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;
// Are we a Win95/GTK progress bar, or a normal gauge?
inline bool GetProgressBar(void) const { return m_useProgressBar; }
// Are we a Win95/GTK progress bar, or a normal gauge?
inline bool GetProgressBar(void) const { return m_useProgressBar; }
protected:

View File

@ -45,14 +45,23 @@ class wxListBox: public wxControl
public:
wxListBox(void);
wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0, const wxString &name = wxListBoxNameStr );
inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
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,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
int n = 0, const wxString choices[] = NULL,
long style = 0, const wxString &name = wxListBoxNameStr );
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
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, char *clientData );
void Clear(void);

View File

@ -123,7 +123,7 @@ DECLARE_DYNAMIC_CLASS(wxMenu)
public:
// construction
wxMenu( const wxString &title = "" );
wxMenu( const wxString& title = wxEmptyString, const wxFunction func = NULL );
// operations
// menu creation
@ -149,16 +149,23 @@ public:
// accessors
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:
int FindMenuIdByMenuItem( GtkWidget *menuItem ) const;
void SetInvokingWindow( wxWindow *win );
wxWindow *GetInvokingWindow();
wxString m_title;
wxList m_items;
wxWindow *m_invokingWindow;
wxString m_title;
wxList m_items;
wxWindow *m_invokingWindow;
wxFunction m_callback;
wxEvtHandler *m_eventHandler;
GtkWidget *m_menu; // GtkMenu
GtkWidget *m_menu; // GtkMenu
};
#endif // __GTKMENUH__

View File

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

View File

@ -27,5 +27,40 @@
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__

View File

@ -43,17 +43,22 @@ class wxScrollBar: public wxControl
public:
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 wxSize& size = wxDefaultSize,
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 );
~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 GetThumbSize() const;
int GetPageSize() const;

View File

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

View File

@ -52,10 +52,12 @@ public:
wxTextCtrl();
wxTextCtrl( wxWindow *parent, wxWindowID id, const wxString &value = "",
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 = "",
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;
void SetValue( const wxString &value );
void WriteText( const wxString &text );

View File

@ -40,6 +40,8 @@ extern wxList wxTopLevelWindows;
class wxLayoutConstraints;
class wxSizer;
class wxResourceTable;
class wxItemResource;
class wxWindow;
class wxCanvas;
@ -60,13 +62,24 @@ class wxWindow: public wxEvtHandler
{
public:
wxWindow();
wxWindow( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxPanelNameStr );
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos = wxDefaultPosition, const wxSize &size = wxDefaultSize,
long style = 0, const wxString &name = wxPanelNameStr );
inline wxWindow(wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
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 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 );
virtual bool Destroy();
virtual bool DestroyChildren();
@ -107,7 +120,7 @@ public:
wxEvtHandler *PopEventHandler( bool deleteHandler = FALSE );
virtual wxValidator *GetValidator();
virtual void SetValidator( wxValidator *validator );
virtual void SetValidator( const wxValidator &validator );
bool IsBeingDeleted();
@ -123,6 +136,8 @@ public:
virtual wxColour GetBackgroundColour() const;
virtual void SetBackgroundColour( const wxColour &colour );
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
virtual void SetDefaultBackgroundColour( const wxColour& 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_C_ALL_SRC=$(LIB_C_SRC) parser.c
#define library objects
LIB_OBJ=\
$(LIB_CPP_ALL_SRC:.cpp=.o) \
$(LIB_C_SRC:.c=.o)
$(LIB_C_ALL_SRC:.c=.o)
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::
$(RM) -rf gtk
@ -38,6 +48,7 @@ clean::
$(RM) -rf zlib
$(RM) -rf gdk_imlib
$(RM) -rf iodbc
@$(RM) lexer.c parser.c
#additional things needed for compile
ADD_COMPILE= \
@ -45,3 +56,34 @@ ADD_COMPILE= \
# include the definitions now
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"
#endif
/*
void yyerror(s)

View File

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

View File

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

View File

@ -2326,7 +2326,7 @@ long wxListCtrl::GetTopItem(void)
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 );
};

View File

@ -36,6 +36,7 @@ LIB_CPP_SRC=\
common/odbc.cpp \
common/postscrp.cpp \
common/prntbase.cpp \
common/resource.cpp \
common/serbase.cpp \
common/string.cpp \
common/textfile.cpp \
@ -50,9 +51,12 @@ LIB_CPP_SRC=\
common/mstream.cpp \
common/zstream.cpp \
common/objstrm.cpp \
common/validate.cpp \
common/wxexpr.cpp \
\
gtk/app.cpp \
gtk/bitmap.cpp \
gtk/bmpbuttn.cpp \
gtk/brush.cpp \
gtk/button.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());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
@ -65,6 +58,8 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_bitmap = bitmap;
m_label = "";
@ -78,7 +73,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
gtk_widget_show( pixmap );
gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
};
}
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+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 );
return TRUE;
};
}
void wxBitmapButton::SetDefault(void)
{
};
gtk_widget_grab_default( m_widget );
}
void wxBitmapButton::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
};
}
wxString wxBitmapButton::GetLabel(void) const
{
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());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
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_button_new_with_label( m_label );
SetLabel(label);
@ -80,11 +75,12 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
Show( TRUE );
return TRUE;
};
}
void wxButton::SetDefault(void)
{
};
gtk_widget_grab_default( m_widget );
}
void wxButton::SetLabel( const wxString &label )
{
@ -92,5 +88,5 @@ void wxButton::SetLabel( const wxString &label )
GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child );
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.SetEventObject(cb);
cb->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
@ -42,23 +42,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
SetLabel( 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 );
return TRUE;
};
}
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 );
else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
};
}
bool wxCheckBox::GetValue(void) const
{
GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
return tb->active;
};
}

View File

@ -36,7 +36,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
@ -44,25 +44,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
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,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_option_menu_new();
wxSize newSize = size;
@ -81,7 +75,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item );
};
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation();
@ -89,7 +83,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
Show( TRUE );
return TRUE;
};
}
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_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item );
};
}
void wxChoice::Clear(void)
{
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
};
}
int wxChoice::FindString( const wxString &string ) const
{
@ -129,17 +123,17 @@ int wxChoice::FindString( const wxString &string ) const
if (string == label->label) return count;
child = child->next;
count++;
};
}
wxFAIL_MSG( "wxChoice: string not found" );
return -1;
};
}
int wxChoice::GetColumns(void) const
{
return 1;
};
}
int wxChoice::GetSelection(void)
{
@ -152,12 +146,12 @@ int wxChoice::GetSelection(void)
if (!bin->child) return count;
child = child->next;
count++;
};
}
wxFAIL_MSG( "wxChoice: no selection" );
return -1;
};
}
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 );
return label->label;
};
}
child = child->next;
count++;
};
}
wxFAIL_MSG( "wxChoice: string not found" );
return "";
};
}
wxString wxChoice::GetStringSelection(void) const
{
@ -193,7 +187,7 @@ wxString wxChoice::GetStringSelection(void) const
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label;
};
}
int wxChoice::Number(void) const
{
@ -204,13 +198,13 @@ int wxChoice::Number(void) const
{
count++;
child = child->next;
};
}
return count;
};
}
void wxChoice::SetColumns( int WXUNUSED(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_choice_clicked_callback( NULL, this );
};
}
void wxChoice::SetStringSelection( const wxString &string )
{
int n = FindString( string );
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.SetEventObject(combo);
combo->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
// size
@ -63,7 +63,7 @@ static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxC
alloc->width - widget->button->allocation.width;
return FALSE;
};
}
*/
//-----------------------------------------------------------------------------
@ -73,13 +73,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
long style, const wxString& name )
long style, const wxValidator& validator, const wxString& name )
{
m_alreadySent = FALSE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_combo_new();
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_FUNC(gtk_combo_clicked_callback), (gpointer)this );
};
}
PostCreation();
@ -116,7 +118,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
Show( TRUE );
return TRUE;
};
}
void wxComboBox::Clear(void)
{
@ -124,12 +126,12 @@ void wxComboBox::Clear(void)
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
m_clientData.Clear();
};
}
void wxComboBox::Append( const wxString &item )
{
Append( item, (char*)NULL );
};
}
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 );
m_clientData.Append( (wxObject*)clientData );
};
}
void wxComboBox::Delete( int n )
{
@ -160,7 +162,7 @@ void wxComboBox::Delete( int n )
}
else
m_clientData.DeleteNode( node );
};
}
int wxComboBox::FindString( const wxString &item )
{
@ -175,12 +177,12 @@ int wxComboBox::FindString( const wxString &item )
if (item == label->label) return count;
count++;
child = child->next;
};
}
wxFAIL_MSG( "wxComboBox: string not found" );
return -1;
};
}
char* wxComboBox::GetClientData( int n )
{
@ -190,7 +192,7 @@ char* wxComboBox::GetClientData( int n )
wxFAIL_MSG( "wxComboBox: wrong index" );
return NULL;
};
}
void wxComboBox::SetClientData( int n, char * clientData )
{
@ -198,7 +200,7 @@ void wxComboBox::SetClientData( int n, char * clientData )
if (node) node->SetData( (wxObject*) clientData );
wxFAIL_MSG( "wxComboBox: wrong index" );
};
}
int wxComboBox::GetSelection(void) const
{
@ -214,13 +216,13 @@ int wxComboBox::GetSelection(void) const
if (child->data == selection->data) return count;
count++;
child = child->next;
};
};
}
}
wxFAIL_MSG( "wxComboBox: no selection" );
return -1;
};
}
wxString wxComboBox::GetString( int n ) const
{
@ -232,12 +234,12 @@ wxString wxComboBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
return label->label;
};
}
wxFAIL_MSG( "wxComboBox: wrong index" );
return "";
};
}
wxString wxComboBox::GetStringSelection(void) const
{
@ -249,12 +251,12 @@ wxString wxComboBox::GetStringSelection(void) const
GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label;
return tmp;
};
}
wxFAIL_MSG( "wxComboBox: no selection" );
return "";
};
}
int wxComboBox::Number(void) const
{
@ -262,29 +264,29 @@ int wxComboBox::Number(void) const
GList *child = GTK_LIST(list)->children;
int count = 0;
while (child) { count++; child = child->next; };
while (child) { count++; child = child->next; }
return count;
};
}
void wxComboBox::SetSelection( int n )
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_select_item( GTK_LIST(list), n );
};
}
void wxComboBox::SetStringSelection( const wxString &string )
{
int res = FindString( string );
if (res == -1) return;
SetSelection( res );
};
}
wxString wxComboBox::GetValue(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) );
return tmp;
};
}
void wxComboBox::SetValue( const wxString& value )
{
@ -292,52 +294,52 @@ void wxComboBox::SetValue( const wxString& value )
wxString tmp = "";
if (!value.IsNull()) tmp = value;
gtk_entry_set_text( GTK_ENTRY(entry), tmp );
};
}
void wxComboBox::Copy(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
};
}
void wxComboBox::Cut(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
};
}
void wxComboBox::Paste(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
};
}
void wxComboBox::SetInsertionPoint( long pos )
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int tmp = (int) pos;
gtk_entry_set_position( GTK_ENTRY(entry), tmp );
};
}
void wxComboBox::SetInsertionPointEnd(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
SetInsertionPoint( pos-1 );
};
}
long wxComboBox::GetInsertionPoint(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
return (long) GTK_EDITABLE(entry)->current_pos;
};
}
long wxComboBox::GetLastPosition(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
return (long) pos-1;
};
}
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;
gint pos = (gint)to;
gtk_editable_insert_text( GTK_EDITABLE(entry), value, value.Length(), &pos );
};
}
void wxComboBox::Remove(long from, long to)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
};
}
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{
};
}
void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{
};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,3 +15,75 @@
#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 );
win->ProcessEvent( cevent );
*/
};
}
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)
{
};
}
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
long style, const wxValidator& validator, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0;
if (style & wxSB_VERTICAL == wxSB_VERTICAL)
@ -99,27 +94,27 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
Show( TRUE );
return TRUE;
};
}
int wxScrollBar::GetPosition(void) const
{
return (int)(m_adjust->value+0.5);
};
}
int wxScrollBar::GetThumbSize() const
{
return (int)(m_adjust->page_size+0.5);
};
}
int wxScrollBar::GetPageSize() const
{
return (int)(m_adjust->page_increment+0.5);
};
}
int wxScrollBar::GetRange() const
{
return (int)(m_adjust->upper+0.5);
};
}
void wxScrollBar::SetPosition( int viewStart )
{
@ -129,7 +124,7 @@ void wxScrollBar::SetPosition( int viewStart )
m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
};
}
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) )
@ -154,18 +149,18 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page
m_adjust->page_size = fthumb;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
// Backward compatibility
int wxScrollBar::GetValue(void) const
{
return GetPosition();
};
}
void wxScrollBar::SetValue( int viewStart )
{
SetPosition( viewStart );
};
}
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;
*objectLength = thumb;
*pageLength = page;
};
}
int wxScrollBar::GetViewLength() const
{
return (int)(m_adjust->upper+0.5);
};
}
int wxScrollBar::GetObjectLength() const
{
return (int)(m_adjust->page_size+0.5);
};
}
void wxScrollBar::SetPageSize( int pageLength )
{
@ -196,7 +191,7 @@ void wxScrollBar::SetPageSize( int pageLength )
int thumb = (int)(m_adjust->page_size+0.5);
int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, thumb, range, pageLength );
};
}
void wxScrollBar::SetObjectLength( int objectLength )
{
@ -204,7 +199,7 @@ void wxScrollBar::SetObjectLength( int objectLength )
int page = (int)(m_adjust->page_increment+0.5);
int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, objectLength, range, page );
};
}
void wxScrollBar::SetViewLength( int viewLength )
{
@ -212,5 +207,5 @@ void wxScrollBar::SetViewLength( int viewLength )
int thumb = (int)(m_adjust->page_size+0.5);
int page = (int)(m_adjust->page_increment+0.5);
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() );
cevent.SetEventObject( win );
win->ProcessEvent( cevent );
};
}
IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl)
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)
{
};
}
bool wxSlider::Create(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 )
long style, const wxValidator& validator, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0;
if (style & wxSL_VERTICAL == wxSL_VERTICAL)
@ -110,12 +99,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
Show( TRUE );
return TRUE;
};
}
int wxSlider::GetValue(void) const
{
return (int)(m_adjust->value+0.5);
};
}
void wxSlider::SetValue( int value )
{
@ -125,7 +114,7 @@ void wxSlider::SetValue( int value )
m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
};
}
void wxSlider::SetRange( int minValue, int maxValue )
{
@ -140,17 +129,17 @@ void wxSlider::SetRange( int minValue, int maxValue )
m_adjust->upper = fmax;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
int wxSlider::GetMin(void) const
{
return (int)(m_adjust->lower+0.5);
};
}
int wxSlider::GetMax(void) const
{
return (int)(m_adjust->upper+0.5);
};
}
void wxSlider::SetPageSize( int pageSize )
{
@ -161,12 +150,12 @@ void wxSlider::SetPageSize( int pageSize )
m_adjust->page_increment = fpage;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
int wxSlider::GetPageSize(void) const
{
return (int)(m_adjust->page_increment+0.5);
};
}
void wxSlider::SetThumbLength( int len )
{
@ -177,71 +166,71 @@ void wxSlider::SetThumbLength( int len )
m_adjust->page_size = flen;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
int wxSlider::GetThumbLength(void) const
{
return (int)(m_adjust->page_size+0.5);
};
}
void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
{
};
}
int wxSlider::GetLineSize(void) const
{
return 0;
};
}
// not supported in wxGTK (and GTK)
void wxSlider::GetSize( int *x, int *y ) const
{
wxWindow::GetSize( x, y );
};
}
void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags )
{
wxWindow::SetSize( x, y, width, height, sizeFlags );
};
}
void wxSlider::GetPosition( int *x, int *y ) const
{
wxWindow::GetPosition( x, y );
};
}
void wxSlider::SetTick( int WXUNUSED(tickPos) )
{
};
}
void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
{
};
}
int wxSlider::GetTickFreq(void) const
{
return 0;
};
}
void wxSlider::ClearTicks(void)
{
};
}
void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
{
};
}
int wxSlider::GetSelEnd(void) const
{
return 0;
};
}
int wxSlider::GetSelStart(void) const
{
return 0;
};
}
void wxSlider::ClearSel(void)
{
};
}

View File

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

View File

@ -57,6 +57,25 @@ void wxDisplaySize( int *width, int *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
//------------------------------------------------------------------------

View File

@ -754,22 +754,16 @@ wxWindow::wxWindow()
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
long style, const wxString &name )
{
m_isShown = FALSE;
m_isEnabled = TRUE;
m_needParent = TRUE;
m_cursor = NULL;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_scrolled_window_new( NULL, NULL );
@ -887,8 +881,7 @@ wxWindow::~wxWindow(void)
m_windowSizer = NULL;
}
// If this is a child of a sizer, remove self from parent
if (m_sizerParent)
m_sizerParent->RemoveChild((wxWindow *)this);
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
// Just in case the window has been Closed, but
// we're then deleting immediately: don't leave
@ -900,6 +893,7 @@ wxWindow::~wxWindow(void)
// class
wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
}
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;
m_retCode = 0;
m_eventHandler = this;
m_windowValidator = NULL;
m_windowId = id;
m_sizeSet = FALSE;
if (m_cursor == NULL)
@ -940,6 +933,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_drawingOffsetY = 0;
m_pDropTarget = NULL;
m_resizing = FALSE;
m_windowValidator = NULL;
}
void wxWindow::PostCreation(void)
@ -1580,9 +1574,11 @@ wxValidator *wxWindow::GetValidator(void)
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)
@ -1696,6 +1692,16 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
// do something ?
}
wxColour wxWindow::GetForegroundColour(void) const
{
return m_foregroundColour;
}
void wxWindow::SetForegroundColour( const wxColour &colour )
{
m_foregroundColour = colour;
}
bool wxWindow::Validate(void)
{
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());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
@ -65,6 +58,8 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
PreCreation( parent, id, pos, newSize, style, name );
SetValidator( validator );
m_bitmap = bitmap;
m_label = "";
@ -78,7 +73,7 @@ bool wxBitmapButton::Create( wxWindow *parent, wxWindowID id, const wxBitmap &b
gtk_widget_show( pixmap );
gtk_container_add( GTK_CONTAINER(m_widget), pixmap );
};
}
if (newSize.x == -1) newSize.x = m_bitmap.GetHeight()+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 );
return TRUE;
};
}
void wxBitmapButton::SetDefault(void)
{
};
gtk_widget_grab_default( m_widget );
}
void wxBitmapButton::SetLabel( const wxString &label )
{
wxControl::SetLabel( label );
};
}
wxString wxBitmapButton::GetLabel(void) const
{
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());
event.SetEventObject(button);
button->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
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_button_new_with_label( m_label );
SetLabel(label);
@ -80,11 +75,12 @@ bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
Show( TRUE );
return TRUE;
};
}
void wxButton::SetDefault(void)
{
};
gtk_widget_grab_default( m_widget );
}
void wxButton::SetLabel( const wxString &label )
{
@ -92,5 +88,5 @@ void wxButton::SetLabel( const wxString &label )
GtkButton *bin = GTK_BUTTON( m_widget );
GtkLabel *g_label = GTK_LABEL( bin->child );
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.SetEventObject(cb);
cb->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
@ -42,23 +42,18 @@ IMPLEMENT_DYNAMIC_CLASS(wxCheckBox,wxControl)
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
SetLabel( 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 );
return TRUE;
};
}
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 );
else
gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_widget), GTK_STATE_NORMAL );
};
}
bool wxCheckBox::GetValue(void) const
{
GtkToggleButton *tb = GTK_TOGGLE_BUTTON(m_widget);
return tb->active;
};
}

View File

@ -36,7 +36,7 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice);
choice->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
@ -44,25 +44,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
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,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxString &name )
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_option_menu_new();
wxSize newSize = size;
@ -81,7 +75,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item );
};
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
PostCreation();
@ -89,7 +83,7 @@ bool wxChoice::Create( wxWindow *parent, wxWindowID id,
Show( TRUE );
return TRUE;
};
}
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_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_show( menu_item );
};
}
void wxChoice::Clear(void)
{
gtk_option_menu_remove_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu = gtk_menu_new();
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
};
}
int wxChoice::FindString( const wxString &string ) const
{
@ -129,17 +123,17 @@ int wxChoice::FindString( const wxString &string ) const
if (string == label->label) return count;
child = child->next;
count++;
};
}
wxFAIL_MSG( "wxChoice: string not found" );
return -1;
};
}
int wxChoice::GetColumns(void) const
{
return 1;
};
}
int wxChoice::GetSelection(void)
{
@ -152,12 +146,12 @@ int wxChoice::GetSelection(void)
if (!bin->child) return count;
child = child->next;
count++;
};
}
wxFAIL_MSG( "wxChoice: no selection" );
return -1;
};
}
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 );
return label->label;
};
}
child = child->next;
count++;
};
}
wxFAIL_MSG( "wxChoice: string not found" );
return "";
};
}
wxString wxChoice::GetStringSelection(void) const
{
@ -193,7 +187,7 @@ wxString wxChoice::GetStringSelection(void) const
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label;
};
}
int wxChoice::Number(void) const
{
@ -204,13 +198,13 @@ int wxChoice::Number(void) const
{
count++;
child = child->next;
};
}
return count;
};
}
void wxChoice::SetColumns( int WXUNUSED(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_choice_clicked_callback( NULL, this );
};
}
void wxChoice::SetStringSelection( const wxString &string )
{
int n = FindString( string );
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.SetEventObject(combo);
combo->GetEventHandler()->ProcessEvent(event);
};
}
//-----------------------------------------------------------------------------
// size
@ -63,7 +63,7 @@ static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxC
alloc->width - widget->button->allocation.width;
return FALSE;
};
}
*/
//-----------------------------------------------------------------------------
@ -73,13 +73,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
const wxPoint& pos, const wxSize& size,
int n, const wxString choices[],
long style, const wxString& name )
long style, const wxValidator& validator, const wxString& name )
{
m_alreadySent = FALSE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_widget = gtk_combo_new();
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_FUNC(gtk_combo_clicked_callback), (gpointer)this );
};
}
PostCreation();
@ -116,7 +118,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value,
Show( TRUE );
return TRUE;
};
}
void wxComboBox::Clear(void)
{
@ -124,12 +126,12 @@ void wxComboBox::Clear(void)
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
m_clientData.Clear();
};
}
void wxComboBox::Append( const wxString &item )
{
Append( item, (char*)NULL );
};
}
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 );
m_clientData.Append( (wxObject*)clientData );
};
}
void wxComboBox::Delete( int n )
{
@ -160,7 +162,7 @@ void wxComboBox::Delete( int n )
}
else
m_clientData.DeleteNode( node );
};
}
int wxComboBox::FindString( const wxString &item )
{
@ -175,12 +177,12 @@ int wxComboBox::FindString( const wxString &item )
if (item == label->label) return count;
count++;
child = child->next;
};
}
wxFAIL_MSG( "wxComboBox: string not found" );
return -1;
};
}
char* wxComboBox::GetClientData( int n )
{
@ -190,7 +192,7 @@ char* wxComboBox::GetClientData( int n )
wxFAIL_MSG( "wxComboBox: wrong index" );
return NULL;
};
}
void wxComboBox::SetClientData( int n, char * clientData )
{
@ -198,7 +200,7 @@ void wxComboBox::SetClientData( int n, char * clientData )
if (node) node->SetData( (wxObject*) clientData );
wxFAIL_MSG( "wxComboBox: wrong index" );
};
}
int wxComboBox::GetSelection(void) const
{
@ -214,13 +216,13 @@ int wxComboBox::GetSelection(void) const
if (child->data == selection->data) return count;
count++;
child = child->next;
};
};
}
}
wxFAIL_MSG( "wxComboBox: no selection" );
return -1;
};
}
wxString wxComboBox::GetString( int n ) const
{
@ -232,12 +234,12 @@ wxString wxComboBox::GetString( int n ) const
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = GTK_LABEL( bin->child );
return label->label;
};
}
wxFAIL_MSG( "wxComboBox: wrong index" );
return "";
};
}
wxString wxComboBox::GetStringSelection(void) const
{
@ -249,12 +251,12 @@ wxString wxComboBox::GetStringSelection(void) const
GtkBin *bin = GTK_BIN( selection->data );
wxString tmp = GTK_LABEL( bin->child )->label;
return tmp;
};
}
wxFAIL_MSG( "wxComboBox: no selection" );
return "";
};
}
int wxComboBox::Number(void) const
{
@ -262,29 +264,29 @@ int wxComboBox::Number(void) const
GList *child = GTK_LIST(list)->children;
int count = 0;
while (child) { count++; child = child->next; };
while (child) { count++; child = child->next; }
return count;
};
}
void wxComboBox::SetSelection( int n )
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_select_item( GTK_LIST(list), n );
};
}
void wxComboBox::SetStringSelection( const wxString &string )
{
int res = FindString( string );
if (res == -1) return;
SetSelection( res );
};
}
wxString wxComboBox::GetValue(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
wxString tmp = gtk_entry_get_text( GTK_ENTRY(entry) );
return tmp;
};
}
void wxComboBox::SetValue( const wxString& value )
{
@ -292,52 +294,52 @@ void wxComboBox::SetValue( const wxString& value )
wxString tmp = "";
if (!value.IsNull()) tmp = value;
gtk_entry_set_text( GTK_ENTRY(entry), tmp );
};
}
void wxComboBox::Copy(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_copy_clipboard( GTK_EDITABLE(entry), 0 );
};
}
void wxComboBox::Cut(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_cut_clipboard( GTK_EDITABLE(entry), 0 );
};
}
void wxComboBox::Paste(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_paste_clipboard( GTK_EDITABLE(entry), 0 );
};
}
void wxComboBox::SetInsertionPoint( long pos )
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int tmp = (int) pos;
gtk_entry_set_position( GTK_ENTRY(entry), tmp );
};
}
void wxComboBox::SetInsertionPointEnd(void)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
SetInsertionPoint( pos-1 );
};
}
long wxComboBox::GetInsertionPoint(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
return (long) GTK_EDITABLE(entry)->current_pos;
};
}
long wxComboBox::GetLastPosition(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
int pos = GTK_ENTRY(entry)->text_length;
return (long) pos-1;
};
}
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;
gint pos = (gint)to;
gtk_editable_insert_text( GTK_EDITABLE(entry), value, value.Length(), &pos );
};
}
void wxComboBox::Remove(long from, long to)
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
gtk_editable_delete_text( GTK_EDITABLE(entry), (gint)from, (gint)to );
};
}
void wxComboBox::SetSelection( long WXUNUSED(from), long WXUNUSED(to) )
{
};
}
void wxComboBox::SetEditable( bool WXUNUSED(editable) )
{
};
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,3 +15,75 @@
#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 );
win->ProcessEvent( cevent );
*/
};
}
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)
{
};
}
bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
const wxPoint& pos, const wxSize& size,
long style, const wxString& name )
long style, const wxValidator& validator, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0;
if (style & wxSB_VERTICAL == wxSB_VERTICAL)
@ -99,27 +94,27 @@ bool wxScrollBar::Create(wxWindow *parent, wxWindowID id,
Show( TRUE );
return TRUE;
};
}
int wxScrollBar::GetPosition(void) const
{
return (int)(m_adjust->value+0.5);
};
}
int wxScrollBar::GetThumbSize() const
{
return (int)(m_adjust->page_size+0.5);
};
}
int wxScrollBar::GetPageSize() const
{
return (int)(m_adjust->page_increment+0.5);
};
}
int wxScrollBar::GetRange() const
{
return (int)(m_adjust->upper+0.5);
};
}
void wxScrollBar::SetPosition( int viewStart )
{
@ -129,7 +124,7 @@ void wxScrollBar::SetPosition( int viewStart )
m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
};
}
void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int pageSize,
bool WXUNUSED(refresh) )
@ -154,18 +149,18 @@ void wxScrollBar::SetScrollbar( int position, int thumbSize, int range, int page
m_adjust->page_size = fthumb;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
// Backward compatibility
int wxScrollBar::GetValue(void) const
{
return GetPosition();
};
}
void wxScrollBar::SetValue( int viewStart )
{
SetPosition( viewStart );
};
}
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;
*objectLength = thumb;
*pageLength = page;
};
}
int wxScrollBar::GetViewLength() const
{
return (int)(m_adjust->upper+0.5);
};
}
int wxScrollBar::GetObjectLength() const
{
return (int)(m_adjust->page_size+0.5);
};
}
void wxScrollBar::SetPageSize( int pageLength )
{
@ -196,7 +191,7 @@ void wxScrollBar::SetPageSize( int pageLength )
int thumb = (int)(m_adjust->page_size+0.5);
int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, thumb, range, pageLength );
};
}
void wxScrollBar::SetObjectLength( int objectLength )
{
@ -204,7 +199,7 @@ void wxScrollBar::SetObjectLength( int objectLength )
int page = (int)(m_adjust->page_increment+0.5);
int range = (int)(m_adjust->upper+0.5);
SetScrollbar( pos, objectLength, range, page );
};
}
void wxScrollBar::SetViewLength( int viewLength )
{
@ -212,5 +207,5 @@ void wxScrollBar::SetViewLength( int viewLength )
int thumb = (int)(m_adjust->page_size+0.5);
int page = (int)(m_adjust->page_increment+0.5);
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() );
cevent.SetEventObject( win );
win->ProcessEvent( cevent );
};
}
IMPLEMENT_DYNAMIC_CLASS(wxSlider,wxControl)
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)
{
};
}
bool wxSlider::Create(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 )
long style, const wxValidator& validator, const wxString& name )
{
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
m_oldPos = 0.0;
if (style & wxSL_VERTICAL == wxSL_VERTICAL)
@ -110,12 +99,12 @@ bool wxSlider::Create(wxWindow *parent, wxWindowID id,
Show( TRUE );
return TRUE;
};
}
int wxSlider::GetValue(void) const
{
return (int)(m_adjust->value+0.5);
};
}
void wxSlider::SetValue( int value )
{
@ -125,7 +114,7 @@ void wxSlider::SetValue( int value )
m_adjust->value = fpos;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "value_changed" );
};
}
void wxSlider::SetRange( int minValue, int maxValue )
{
@ -140,17 +129,17 @@ void wxSlider::SetRange( int minValue, int maxValue )
m_adjust->upper = fmax;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
int wxSlider::GetMin(void) const
{
return (int)(m_adjust->lower+0.5);
};
}
int wxSlider::GetMax(void) const
{
return (int)(m_adjust->upper+0.5);
};
}
void wxSlider::SetPageSize( int pageSize )
{
@ -161,12 +150,12 @@ void wxSlider::SetPageSize( int pageSize )
m_adjust->page_increment = fpage;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
int wxSlider::GetPageSize(void) const
{
return (int)(m_adjust->page_increment+0.5);
};
}
void wxSlider::SetThumbLength( int len )
{
@ -177,71 +166,71 @@ void wxSlider::SetThumbLength( int len )
m_adjust->page_size = flen;
gtk_signal_emit_by_name( GTK_OBJECT(m_adjust), "changed" );
};
}
int wxSlider::GetThumbLength(void) const
{
return (int)(m_adjust->page_size+0.5);
};
}
void wxSlider::SetLineSize( int WXUNUSED(lineSize) )
{
};
}
int wxSlider::GetLineSize(void) const
{
return 0;
};
}
// not supported in wxGTK (and GTK)
void wxSlider::GetSize( int *x, int *y ) const
{
wxWindow::GetSize( x, y );
};
}
void wxSlider::SetSize( int x, int y, int width, int height, int sizeFlags )
{
wxWindow::SetSize( x, y, width, height, sizeFlags );
};
}
void wxSlider::GetPosition( int *x, int *y ) const
{
wxWindow::GetPosition( x, y );
};
}
void wxSlider::SetTick( int WXUNUSED(tickPos) )
{
};
}
void wxSlider::SetTickFreq( int WXUNUSED(n), int WXUNUSED(pos) )
{
};
}
int wxSlider::GetTickFreq(void) const
{
return 0;
};
}
void wxSlider::ClearTicks(void)
{
};
}
void wxSlider::SetSelection( int WXUNUSED(minPos), int WXUNUSED(maxPos) )
{
};
}
int wxSlider::GetSelEnd(void) const
{
return 0;
};
}
int wxSlider::GetSelStart(void) const
{
return 0;
};
}
void wxSlider::ClearSel(void)
{
};
}

View File

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

View File

@ -57,6 +57,25 @@ void wxDisplaySize( int *width, int *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
//------------------------------------------------------------------------

View File

@ -754,22 +754,16 @@ wxWindow::wxWindow()
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,
const wxPoint &pos, const wxSize &size,
long style, const wxString &name )
long style, const wxString &name )
{
m_isShown = FALSE;
m_isEnabled = TRUE;
m_needParent = TRUE;
m_cursor = NULL;
PreCreation( parent, id, pos, size, style, name );
m_widget = gtk_scrolled_window_new( NULL, NULL );
@ -887,8 +881,7 @@ wxWindow::~wxWindow(void)
m_windowSizer = NULL;
}
// If this is a child of a sizer, remove self from parent
if (m_sizerParent)
m_sizerParent->RemoveChild((wxWindow *)this);
if (m_sizerParent) m_sizerParent->RemoveChild((wxWindow *)this);
// Just in case the window has been Closed, but
// we're then deleting immediately: don't leave
@ -900,6 +893,7 @@ wxWindow::~wxWindow(void)
// class
wxTopLevelWindows.DeleteObject(this);
if (m_windowValidator) delete m_windowValidator;
}
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;
m_retCode = 0;
m_eventHandler = this;
m_windowValidator = NULL;
m_windowId = id;
m_sizeSet = FALSE;
if (m_cursor == NULL)
@ -940,6 +933,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_drawingOffsetY = 0;
m_pDropTarget = NULL;
m_resizing = FALSE;
m_windowValidator = NULL;
}
void wxWindow::PostCreation(void)
@ -1580,9 +1574,11 @@ wxValidator *wxWindow::GetValidator(void)
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)
@ -1696,6 +1692,16 @@ void wxWindow::SetBackgroundColour( const wxColour &colour )
// do something ?
}
wxColour wxWindow::GetForegroundColour(void) const
{
return m_foregroundColour;
}
void wxWindow::SetForegroundColour( const wxColour &colour )
{
m_foregroundColour = colour;
}
bool wxWindow::Validate(void)
{
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/frame.h>
#include <wx/panel.h>
#include <wx/menu.h>
#include <wx/serbase.h>
#include "serwnd.h"