SetEventData for a few widgets

Re-installed wxBitmaps::LoafFile


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@964 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
1998-11-06 08:50:52 +00:00
parent 3572173c01
commit fd0eed647d
32 changed files with 3663 additions and 2706 deletions
+3 -3
View File
@@ -309,8 +309,8 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent
*/
// Set/Get listbox/choice client data
inline void SetClientData(char* clientData) { m_clientData = clientData; }
inline char *GetClientData() const { return m_clientData; }
inline void SetClientData(void* clientData) { m_clientData = clientData; }
inline void *GetClientData() const { return m_clientData; }
// Get listbox selection if single-choice
inline int GetSelection() const { return m_commandInt; }
@@ -335,7 +335,7 @@ class WXDLLEXPORT wxCommandEvent: public wxEvent
char* m_commandString; // String event argument
int m_commandInt;
long m_extraLong; // Additional information (e.g. select/deselect)
char* m_clientData; // Arbitrary client data
void* m_clientData; // Arbitrary client data
};
// Scroll event class
+1 -6
View File
@@ -69,7 +69,7 @@ public:
// Because the objects of this class are deleted by the tree, they should
// always be allocated on the heap!
// ----------------------------------------------------------------------------
class WXDLLEXPORT wxTreeItemData
class WXDLLEXPORT wxTreeItemData: public wxClientData
{
friend class wxTreeCtrl;
public:
@@ -80,11 +80,6 @@ public:
// default copy ctor/assignment operator are ok
// dtor is virtual and all the items are deleted by the tree control
// when it's deleted, so you normally don't have to care about freeing
// memory allocated in your wxTreeItemData-derived class
virtual ~wxTreeItemData() { }
// accessor: get the item associated with us
const wxTreeItemId& GetId() const { return m_pItem; }
void SetId(const wxTreeItemId& id) { m_pItem = id; }
+40 -48
View File
@@ -36,24 +36,17 @@ class wxMask: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxMask)
public:
public:
wxMask();
wxMask( const wxBitmap& bitmap, const wxColour& colour );
wxMask( const wxBitmap& bitmap, int paletteIndex );
wxMask( const wxBitmap& bitmap );
~wxMask();
wxMask();
wxMask( const wxBitmap& bitmap, const wxColour& colour );
wxMask( const wxBitmap& bitmap, int paletteIndex );
wxMask( const wxBitmap& bitmap );
~wxMask();
// implementation
// implementation
GdkBitmap *GetBitmap() const;
protected:
friend wxBitmap;
GdkBitmap *m_bitmap;
GdkBitmap *m_bitmap;
GdkBitmap *GetBitmap() const;
};
//-----------------------------------------------------------------------------
@@ -64,45 +57,44 @@ class wxBitmap: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxBitmap)
public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image );
wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp );
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM);
~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image );
wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp );
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
wxImage ConvertToImage() const;
wxImage ConvertToImage() const;
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
wxMask *GetMask() const;
void SetMask( wxMask *mask );
wxMask *GetMask() const;
void SetMask( wxMask *mask );
bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM);
bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM );
wxPalette *GetPalette() const;
wxPalette *GetColourMap() const
{ return GetPalette(); };
wxPalette *GetPalette() const;
wxPalette *GetColourMap() const
{ return GetPalette(); };
// implementation
// implementation
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;
// no data :-)
};
+4 -4
View File
@@ -42,7 +42,7 @@ class wxButton: public wxControl
public:
wxButton(void);
wxButton();
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
@@ -51,19 +51,19 @@ class wxButton: public wxControl
{
Create(parent, id, label, pos, size, style, validator, name);
}
~wxButton();
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
void SetDefault(void);
void SetDefault();
void SetLabel( const wxString &label );
void Enable( bool enable );
// implementation
void ApplyWidgetStyle();
};
#endif // __GTKBUTTONH__
+46 -32
View File
@@ -40,42 +40,56 @@ class wxChoice: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxChoice)
public:
public:
wxChoice(void);
inline wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr )
{
wxChoice();
inline wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) 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[] = (wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr );
void Append( const wxString &item );
void Clear(void);
void Delete(int n);
int FindString( const wxString &string ) const;
int GetColumns(void) const;
int GetSelection(void);
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number(void) const;
void SetColumns( int n = 1 );
void SetSelection( int n );
void SetStringSelection( const wxString &string );
}
~wxChoice();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr );
void Append( const wxString &item );
void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete(int n);
int FindString( const wxString &string ) const;
int GetColumns() const;
int GetSelection();
wxString GetString( int n ) const;
wxString GetStringSelection() const;
int Number() const;
void SetColumns( int n = 1 );
void SetSelection( int n );
void SetStringSelection( const wxString &string );
// implementation
// implementation
void ApplyWidgetStyle();
wxList m_clientDataList;
void AppendCommon( const wxString &item );
void ApplyWidgetStyle();
};
#endif // __GTKCHOICEH__
+36 -28
View File
@@ -37,13 +37,13 @@ extern const char* wxEmptyString;
// wxComboBox
//-----------------------------------------------------------------------------
class wxComboBox: public wxControl
class wxComboBox : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxComboBox)
public:
inline wxComboBox(void) {}
public:
inline wxComboBox() {}
inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
@@ -55,6 +55,7 @@ class wxComboBox: public wxControl
{
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
~wxComboBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
@@ -64,45 +65,52 @@ class wxComboBox: public wxControl
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
void Clear(void);
void Append( const wxString &item );
void Append( const wxString &item, char* clientData );
void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete( int n );
int FindString( const wxString &item );
char* GetClientData( int n );
void SetClientData( int n, char * clientData );
int GetSelection(void) const;
int GetSelection() const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number(void) const;
wxString GetStringSelection() const;
int Number() const;
void SetSelection( int n );
void SetStringSelection( const wxString &string );
wxString GetValue(void) const ;
wxString GetValue() const;
void SetValue(const wxString& value);
void Copy(void);
void Cut(void);
void Paste(void);
void SetInsertionPoint(long pos);
void SetInsertionPointEnd(void);
long GetInsertionPoint(void) const ;
long GetLastPosition(void) const ;
void Replace(long from, long to, const wxString& value);
void Remove(long from, long to);
void SetSelection(long from, long to);
void SetEditable(bool editable);
void Copy();
void Cut();
void Paste();
void SetInsertionPoint( long pos );
void SetInsertionPointEnd();
long GetInsertionPoint() const;
long GetLastPosition() const;
void Replace( long from, long to, const wxString& value );
void Remove( long from, long to );
void SetSelection( long from, long to );
void SetEditable( bool editable );
void OnSize( wxSizeEvent &event );
// implementation
// implementation
bool m_alreadySent;
wxList m_clientData;
bool m_alreadySent;
wxList m_clientDataList;
GtkWidget* GetConnectWidget(void);
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
void AppendCommon( const wxString &item );
GtkWidget* GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
DECLARE_EVENT_TABLE()
};
+56 -48
View File
@@ -37,63 +37,71 @@ extern const char *wxListBoxNameStr;
// wxListBox
//-----------------------------------------------------------------------------
class wxListBox: public wxControl
class wxListBox : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListBox)
public:
public:
wxListBox(void);
inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
wxListBox();
inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) 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[] = (const wxString *) 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);
void Delete( int n );
void Deselect( int n );
int FindString( const wxString &item ) const;
char *GetClientData( int n ) const;
int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number(void);
bool Selected( int n );
void Set( int n, const wxString *choices );
void SetClientData( int n, char *clientData );
void SetFirstItem( int n );
void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE );
}
~wxListBox();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr );
void Append( const wxString &item );
void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete( int n );
void Deselect( int n );
int FindString( const wxString &item ) const;
int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number();
bool Selected( int n );
void Set( int n, const wxString *choices );
void SetFirstItem( int n );
void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE );
void SetDropTarget( wxDropTarget *dropTarget );
void SetDropTarget( wxDropTarget *dropTarget );
// implementation
// implementation
int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget(void);
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
GtkList *m_list;
wxList m_clientData;
void AppendCommon( const wxString &item );
int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
GtkList *m_list;
wxList m_clientDataList;
};
#endif // __GTKLISTBOXH__
+73 -14
View File
@@ -43,11 +43,12 @@ class wxSizer;
class wxResourceTable;
class wxItemResource;
class wxClientData;
class wxVoidClientData;
class wxWindow;
class wxCanvas;
//-----------------------------------------------------------------------------
// callback definition for inserting a window
// callback definition for inserting a window (internal)
//-----------------------------------------------------------------------------
typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
@@ -60,6 +61,49 @@ extern const char *wxPanelNameStr;
extern const wxSize wxDefaultSize;
extern const wxPoint wxDefaultPosition;
//-----------------------------------------------------------------------------
// wxClientData
//-----------------------------------------------------------------------------
class wxClientData
{
public:
wxClientData() { }
virtual ~wxClientData() { }
};
//-----------------------------------------------------------------------------
// wxVoidClientData
//-----------------------------------------------------------------------------
class wxVoidClientData : public wxClientData
{
public:
wxVoidClientData() { m_data = NULL; }
wxVoidClientData( void *data ) { m_data = data; }
void SetData( void* data ) { m_data = data; }
void *GetData() const { return m_data; }
private:
void *m_data;
};
//-----------------------------------------------------------------------------
// wxStringClientData
//-----------------------------------------------------------------------------
class wxStringClientData: public wxClientData
{
public:
wxStringClientData() { }
wxStringClientData( wxString &data ) { m_data = data; }
void SetData( wxString &data ) { m_data = data; }
wxString GetData() const { return m_data; }
private:
wxString m_data;
};
//-----------------------------------------------------------------------------
// wxWindow
//-----------------------------------------------------------------------------
@@ -122,7 +166,7 @@ public:
virtual void Enable( bool enable );
virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled(void) const { return IsEnabled(); }
inline bool Enabled() const { return IsEnabled(); }
virtual void SetFocus();
virtual bool OnClose();
@@ -133,7 +177,7 @@ public:
int GetReturnCode();
wxWindow *GetParent() const
{ return m_parent; }
wxWindow *GetGrandParent(void) const
wxWindow *GetGrandParent() const
{ return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
void SetParent( wxWindow *p )
{ m_parent = p; }
@@ -146,6 +190,13 @@ public:
virtual wxValidator *GetValidator();
virtual void SetValidator( const wxValidator &validator );
virtual void SetClientObject( wxClientData *data );
virtual wxClientData *GetClientObject();
virtual void SetClientData( void *data );
virtual void *GetClientData();
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
@@ -170,8 +221,8 @@ public:
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
virtual int GetCharHeight(void) const;
virtual int GetCharWidth(void) const;
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
virtual void GetTextExtent( const wxString& string, int *x, int *y,
int *descent = (int *) NULL,
int *externalLeading = (int *) NULL,
@@ -179,15 +230,19 @@ public:
virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont();
// For backward compatibility
// For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont *GetLabelFont() { return GetFont(); };
inline virtual wxFont *GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const;
virtual void CaptureMouse();
virtual void ReleaseMouse();
virtual void SetTitle( const wxString &title );
virtual wxString GetTitle() const;
virtual void SetName( const wxString &name );
@@ -198,14 +253,16 @@ public:
virtual bool IsShown() const;
virtual void Raise(void);
virtual void Lower(void);
virtual void Raise();
virtual void Lower();
virtual bool IsRetained();
virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {};
void SetDoubleClick( bool WXUNUSED(allow) ) {};
virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y );
@@ -229,19 +286,20 @@ public:
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL );
virtual bool AcceptsFocus() const;
void UpdateWindowUI();
// implementation
virtual GtkWidget *GetConnectWidget(void);
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
virtual GtkWidget *GetConnectWidget();
virtual bool IsOwnGtkWindow( GdkWindow *window );
void ConnectWidget( GtkWidget *widget );
void ConnectDnDWidget( GtkWidget *widget );
void DisconnectDnDWidget( GtkWidget *widget );
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
bool HasVMT();
virtual void ImplementSetSize();
@@ -264,7 +322,7 @@ public:
int m_retCode;
wxEvtHandler *m_eventHandler;
wxValidator *m_windowValidator;
wxDropTarget *m_pDropTarget;
wxDropTarget *m_dropTarget;
wxWindowID m_windowId;
wxCursor *m_cursor;
wxFont m_font;
@@ -276,6 +334,7 @@ public:
bool m_isEnabled;
wxString m_windowName;
wxAcceleratorTable m_acceleratorTable;
wxClientData *m_clientData;
GtkWidget *m_widget;
GtkWidget *m_wxwindow;
+40 -48
View File
@@ -36,24 +36,17 @@ class wxMask: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxMask)
public:
public:
wxMask();
wxMask( const wxBitmap& bitmap, const wxColour& colour );
wxMask( const wxBitmap& bitmap, int paletteIndex );
wxMask( const wxBitmap& bitmap );
~wxMask();
wxMask();
wxMask( const wxBitmap& bitmap, const wxColour& colour );
wxMask( const wxBitmap& bitmap, int paletteIndex );
wxMask( const wxBitmap& bitmap );
~wxMask();
// implementation
// implementation
GdkBitmap *GetBitmap() const;
protected:
friend wxBitmap;
GdkBitmap *m_bitmap;
GdkBitmap *m_bitmap;
GdkBitmap *GetBitmap() const;
};
//-----------------------------------------------------------------------------
@@ -64,45 +57,44 @@ class wxBitmap: public wxObject
{
DECLARE_DYNAMIC_CLASS(wxBitmap)
public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image );
wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp );
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM);
~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
public:
wxBitmap();
wxBitmap( int width, int height, int depth = -1 );
wxBitmap( const char bits[], int width, int height, int depth = 1 );
wxBitmap( const wxImage &image );
wxBitmap( char **bits );
wxBitmap( const wxBitmap& bmp );
wxBitmap( const wxBitmap* bmp );
wxBitmap( const wxString &filename, int type = wxBITMAP_TYPE_XPM );
~wxBitmap();
wxBitmap& operator = ( const wxBitmap& bmp );
bool operator == ( const wxBitmap& bmp );
bool operator != ( const wxBitmap& bmp );
bool Ok() const;
wxImage ConvertToImage() const;
wxImage ConvertToImage() const;
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
int GetHeight() const;
int GetWidth() const;
int GetDepth() const;
void SetHeight( int height );
void SetWidth( int width );
void SetDepth( int depth );
wxMask *GetMask() const;
void SetMask( wxMask *mask );
wxMask *GetMask() const;
void SetMask( wxMask *mask );
bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM);
bool SaveFile( const wxString &name, int type, wxPalette *palette = (wxPalette *) NULL );
bool LoadFile( const wxString &name, int type = wxBITMAP_TYPE_XPM );
wxPalette *GetPalette() const;
wxPalette *GetColourMap() const
{ return GetPalette(); };
wxPalette *GetPalette() const;
wxPalette *GetColourMap() const
{ return GetPalette(); };
// implementation
// implementation
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;
GdkPixmap *GetPixmap() const;
GdkBitmap *GetBitmap() const;
// no data :-)
};
+4 -4
View File
@@ -42,7 +42,7 @@ class wxButton: public wxControl
public:
wxButton(void);
wxButton();
inline wxButton(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
@@ -51,19 +51,19 @@ class wxButton: public wxControl
{
Create(parent, id, label, pos, size, style, validator, name);
}
~wxButton();
bool Create(wxWindow *parent, wxWindowID id, const wxString& label,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize, long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxButtonNameStr);
void SetDefault(void);
void SetDefault();
void SetLabel( const wxString &label );
void Enable( bool enable );
// implementation
void ApplyWidgetStyle();
};
#endif // __GTKBUTTONH__
+46 -32
View File
@@ -40,42 +40,56 @@ class wxChoice: public wxControl
{
DECLARE_DYNAMIC_CLASS(wxChoice)
public:
public:
wxChoice(void);
inline wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr )
{
wxChoice();
inline wxChoice( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) 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[] = (wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr );
void Append( const wxString &item );
void Clear(void);
void Delete(int n);
int FindString( const wxString &string ) const;
int GetColumns(void) const;
int GetSelection(void);
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number(void) const;
void SetColumns( int n = 1 );
void SetSelection( int n );
void SetStringSelection( const wxString &string );
}
~wxChoice();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxChoiceNameStr );
void Append( const wxString &item );
void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete(int n);
int FindString( const wxString &string ) const;
int GetColumns() const;
int GetSelection();
wxString GetString( int n ) const;
wxString GetStringSelection() const;
int Number() const;
void SetColumns( int n = 1 );
void SetSelection( int n );
void SetStringSelection( const wxString &string );
// implementation
// implementation
void ApplyWidgetStyle();
wxList m_clientDataList;
void AppendCommon( const wxString &item );
void ApplyWidgetStyle();
};
#endif // __GTKCHOICEH__
+36 -28
View File
@@ -37,13 +37,13 @@ extern const char* wxEmptyString;
// wxComboBox
//-----------------------------------------------------------------------------
class wxComboBox: public wxControl
class wxComboBox : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxComboBox)
public:
inline wxComboBox(void) {}
public:
inline wxComboBox() {}
inline wxComboBox(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
@@ -55,6 +55,7 @@ class wxComboBox: public wxControl
{
Create(parent, id, value, pos, size, n, choices, style, validator, name);
}
~wxComboBox();
bool Create(wxWindow *parent, wxWindowID id,
const wxString& value = wxEmptyString,
const wxPoint& pos = wxDefaultPosition,
@@ -64,45 +65,52 @@ class wxComboBox: public wxControl
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxComboBoxNameStr);
void Clear(void);
void Append( const wxString &item );
void Append( const wxString &item, char* clientData );
void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete( int n );
int FindString( const wxString &item );
char* GetClientData( int n );
void SetClientData( int n, char * clientData );
int GetSelection(void) const;
int GetSelection() const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number(void) const;
wxString GetStringSelection() const;
int Number() const;
void SetSelection( int n );
void SetStringSelection( const wxString &string );
wxString GetValue(void) const ;
wxString GetValue() const;
void SetValue(const wxString& value);
void Copy(void);
void Cut(void);
void Paste(void);
void SetInsertionPoint(long pos);
void SetInsertionPointEnd(void);
long GetInsertionPoint(void) const ;
long GetLastPosition(void) const ;
void Replace(long from, long to, const wxString& value);
void Remove(long from, long to);
void SetSelection(long from, long to);
void SetEditable(bool editable);
void Copy();
void Cut();
void Paste();
void SetInsertionPoint( long pos );
void SetInsertionPointEnd();
long GetInsertionPoint() const;
long GetLastPosition() const;
void Replace( long from, long to, const wxString& value );
void Remove( long from, long to );
void SetSelection( long from, long to );
void SetEditable( bool editable );
void OnSize( wxSizeEvent &event );
// implementation
// implementation
bool m_alreadySent;
wxList m_clientData;
bool m_alreadySent;
wxList m_clientDataList;
GtkWidget* GetConnectWidget(void);
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
void AppendCommon( const wxString &item );
GtkWidget* GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
DECLARE_EVENT_TABLE()
};
+56 -48
View File
@@ -37,63 +37,71 @@ extern const char *wxListBoxNameStr;
// wxListBox
//-----------------------------------------------------------------------------
class wxListBox: public wxControl
class wxListBox : public wxControl
{
DECLARE_DYNAMIC_CLASS(wxListBox)
public:
public:
wxListBox(void);
inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr )
{
wxListBox();
inline wxListBox( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) 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[] = (const wxString *) 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);
void Delete( int n );
void Deselect( int n );
int FindString( const wxString &item ) const;
char *GetClientData( int n ) const;
int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number(void);
bool Selected( int n );
void Set( int n, const wxString *choices );
void SetClientData( int n, char *clientData );
void SetFirstItem( int n );
void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE );
}
~wxListBox();
bool Create( wxWindow *parent, wxWindowID id,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
int n = 0, const wxString choices[] = (const wxString *) NULL,
long style = 0,
const wxValidator& validator = wxDefaultValidator,
const wxString& name = wxListBoxNameStr );
void Append( const wxString &item );
void Append( const wxString &item, void* clientData );
void Append( const wxString &item, wxClientData* clientData );
void SetClientData( int n, void* clientData );
void* GetClientData( int n );
void SetClientObject( int n, wxClientData* clientData );
wxClientData* GetClientObject( int n );
void Clear();
void Delete( int n );
void Deselect( int n );
int FindString( const wxString &item ) const;
int GetSelection(void) const;
int GetSelections( class wxArrayInt &) const;
wxString GetString( int n ) const;
wxString GetStringSelection(void) const;
int Number();
bool Selected( int n );
void Set( int n, const wxString *choices );
void SetFirstItem( int n );
void SetFirstItem( const wxString &item );
void SetSelection( int n, bool select = TRUE );
void SetString( int n, const wxString &string );
void SetStringSelection( const wxString &string, bool select = TRUE );
void SetDropTarget( wxDropTarget *dropTarget );
void SetDropTarget( wxDropTarget *dropTarget );
// implementation
// implementation
int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget(void);
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
GtkList *m_list;
wxList m_clientData;
void AppendCommon( const wxString &item );
int GetIndex( GtkWidget *item ) const;
GtkWidget *GetConnectWidget();
bool IsOwnGtkWindow( GdkWindow *window );
void ApplyWidgetStyle();
GtkList *m_list;
wxList m_clientDataList;
};
#endif // __GTKLISTBOXH__
+73 -14
View File
@@ -43,11 +43,12 @@ class wxSizer;
class wxResourceTable;
class wxItemResource;
class wxClientData;
class wxVoidClientData;
class wxWindow;
class wxCanvas;
//-----------------------------------------------------------------------------
// callback definition for inserting a window
// callback definition for inserting a window (internal)
//-----------------------------------------------------------------------------
typedef void (*wxInsertChildFunction)( wxWindow*, wxWindow* );
@@ -60,6 +61,49 @@ extern const char *wxPanelNameStr;
extern const wxSize wxDefaultSize;
extern const wxPoint wxDefaultPosition;
//-----------------------------------------------------------------------------
// wxClientData
//-----------------------------------------------------------------------------
class wxClientData
{
public:
wxClientData() { }
virtual ~wxClientData() { }
};
//-----------------------------------------------------------------------------
// wxVoidClientData
//-----------------------------------------------------------------------------
class wxVoidClientData : public wxClientData
{
public:
wxVoidClientData() { m_data = NULL; }
wxVoidClientData( void *data ) { m_data = data; }
void SetData( void* data ) { m_data = data; }
void *GetData() const { return m_data; }
private:
void *m_data;
};
//-----------------------------------------------------------------------------
// wxStringClientData
//-----------------------------------------------------------------------------
class wxStringClientData: public wxClientData
{
public:
wxStringClientData() { }
wxStringClientData( wxString &data ) { m_data = data; }
void SetData( wxString &data ) { m_data = data; }
wxString GetData() const { return m_data; }
private:
wxString m_data;
};
//-----------------------------------------------------------------------------
// wxWindow
//-----------------------------------------------------------------------------
@@ -122,7 +166,7 @@ public:
virtual void Enable( bool enable );
virtual void MakeModal( bool modal );
virtual bool IsEnabled() const { return m_isEnabled; }
inline bool Enabled(void) const { return IsEnabled(); }
inline bool Enabled() const { return IsEnabled(); }
virtual void SetFocus();
virtual bool OnClose();
@@ -133,7 +177,7 @@ public:
int GetReturnCode();
wxWindow *GetParent() const
{ return m_parent; }
wxWindow *GetGrandParent(void) const
wxWindow *GetGrandParent() const
{ return (m_parent ? m_parent->m_parent : (wxWindow*)NULL); }
void SetParent( wxWindow *p )
{ m_parent = p; }
@@ -146,6 +190,13 @@ public:
virtual wxValidator *GetValidator();
virtual void SetValidator( const wxValidator &validator );
virtual void SetClientObject( wxClientData *data );
virtual wxClientData *GetClientObject();
virtual void SetClientData( void *data );
virtual void *GetClientData();
virtual void SetAcceleratorTable( const wxAcceleratorTable& accel );
virtual wxAcceleratorTable *GetAcceleratorTable() { return &m_acceleratorTable; }
@@ -170,8 +221,8 @@ public:
virtual wxColour GetForegroundColour() const;
virtual void SetForegroundColour( const wxColour &colour );
virtual int GetCharHeight(void) const;
virtual int GetCharWidth(void) const;
virtual int GetCharHeight() const;
virtual int GetCharWidth() const;
virtual void GetTextExtent( const wxString& string, int *x, int *y,
int *descent = (int *) NULL,
int *externalLeading = (int *) NULL,
@@ -179,15 +230,19 @@ public:
virtual void SetFont( const wxFont &font );
virtual wxFont *GetFont();
// For backward compatibility
// For backward compatibility
inline virtual void SetButtonFont(const wxFont& font) { SetFont(font); }
inline virtual void SetLabelFont(const wxFont& font) { SetFont(font); }
inline virtual wxFont *GetLabelFont() { return GetFont(); };
inline virtual wxFont *GetButtonFont() { return GetFont(); };
virtual void SetWindowStyleFlag( long flag );
virtual long GetWindowStyleFlag() const;
virtual void CaptureMouse();
virtual void ReleaseMouse();
virtual void SetTitle( const wxString &title );
virtual wxString GetTitle() const;
virtual void SetName( const wxString &name );
@@ -198,14 +253,16 @@ public:
virtual bool IsShown() const;
virtual void Raise(void);
virtual void Lower(void);
virtual void Raise();
virtual void Lower();
virtual bool IsRetained();
virtual wxWindow *FindWindow( long id );
virtual wxWindow *FindWindow( const wxString& name );
void AllowDoubleClick( bool WXUNUSED(allow) ) {};
void SetDoubleClick( bool WXUNUSED(allow) ) {};
virtual void ClientToScreen( int *x, int *y );
virtual void ScreenToClient( int *x, int *y );
@@ -229,19 +286,20 @@ public:
virtual void ScrollWindow( int dx, int dy, const wxRect* rect = (wxRect *) NULL );
virtual bool AcceptsFocus() const;
void UpdateWindowUI();
// implementation
virtual GtkWidget *GetConnectWidget(void);
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
virtual GtkWidget *GetConnectWidget();
virtual bool IsOwnGtkWindow( GdkWindow *window );
void ConnectWidget( GtkWidget *widget );
void ConnectDnDWidget( GtkWidget *widget );
void DisconnectDnDWidget( GtkWidget *widget );
void PreCreation( wxWindow *parent, wxWindowID id, const wxPoint &pos,
const wxSize &size, long style, const wxString &name );
void PostCreation();
bool HasVMT();
virtual void ImplementSetSize();
@@ -264,7 +322,7 @@ public:
int m_retCode;
wxEvtHandler *m_eventHandler;
wxValidator *m_windowValidator;
wxDropTarget *m_pDropTarget;
wxDropTarget *m_dropTarget;
wxWindowID m_windowId;
wxCursor *m_cursor;
wxFont m_font;
@@ -276,6 +334,7 @@ public:
bool m_isEnabled;
wxString m_windowName;
wxAcceleratorTable m_acceleratorTable;
wxClientData *m_clientData;
GtkWidget *m_widget;
GtkWidget *m_wxwindow;
+17 -15
View File
@@ -66,15 +66,15 @@ class WXDLLEXPORT wxPNGHandler: public wxImageHandler
public:
inline wxPNGHandler()
{
m_name = "PNG file";
m_extension = "png";
m_type = wxBITMAP_TYPE_PNG;
};
inline wxPNGHandler()
{
m_name = "PNG file";
m_extension = "png";
m_type = wxBITMAP_TYPE_PNG;
};
virtual bool LoadFile( wxImage *image, const wxString& name );
virtual bool SaveFile( wxImage *image, const wxString& name );
virtual bool LoadFile( wxImage *image, const wxString& name );
virtual bool SaveFile( wxImage *image, const wxString& name );
};
//-----------------------------------------------------------------------------
@@ -87,15 +87,16 @@ class WXDLLEXPORT wxBMPHandler: public wxImageHandler
public:
inline wxBMPHandler()
{
m_name = "BMP file";
m_extension = "bmp";
m_type = wxBITMAP_TYPE_BMP;
};
inline wxBMPHandler()
{
m_name = "BMP file";
m_extension = "bmp";
m_type = wxBITMAP_TYPE_BMP;
};
virtual bool LoadFile( wxImage *image, const wxString& name );
virtual bool LoadFile( wxImage *image, const wxString& name );
};
//-----------------------------------------------------------------------------
// wxImage
//-----------------------------------------------------------------------------
@@ -151,6 +152,7 @@ public:
static wxImageHandler *FindHandler( long imageType );
static void CleanUpHandlers();
static void InitStandardHandlers();
protected:
+130 -124
View File
@@ -30,34 +30,34 @@
class wxImageRefData: public wxObjectRefData
{
public:
public:
wxImageRefData(void);
~wxImageRefData(void);
wxImageRefData(void);
~wxImageRefData(void);
int m_width;
int m_height;
unsigned char *m_data;
bool m_hasMask;
unsigned char m_maskRed,m_maskGreen,m_maskBlue;
bool m_ok;
int m_width;
int m_height;
unsigned char *m_data;
bool m_hasMask;
unsigned char m_maskRed,m_maskGreen,m_maskBlue;
bool m_ok;
};
wxImageRefData::wxImageRefData(void)
{
m_width = 0;
m_height = 0;
m_data = (unsigned char*) NULL;
m_ok = FALSE;
m_maskRed = 0;
m_maskGreen = 0;
m_maskBlue = 0;
m_hasMask = FALSE;
m_width = 0;
m_height = 0;
m_data = (unsigned char*) NULL;
m_ok = FALSE;
m_maskRed = 0;
m_maskGreen = 0;
m_maskBlue = 0;
m_hasMask = FALSE;
}
wxImageRefData::~wxImageRefData(void)
{
if (m_data) free( m_data );
if (m_data) free( m_data );
}
wxList wxImage::sm_handlers;
@@ -76,58 +76,58 @@ wxImage::wxImage()
wxImage::wxImage( int width, int height )
{
Create( width, height );
Create( width, height );
}
wxImage::wxImage( const wxString& name, long type )
{
LoadFile( name, type );
LoadFile( name, type );
}
wxImage::wxImage( const wxImage& image )
{
Ref(image);
Ref(image);
}
wxImage::wxImage( const wxImage* image )
{
if (image) Ref(*image);
if (image) Ref(*image);
}
void wxImage::Create( int width, int height )
{
m_refData = new wxImageRefData();
m_refData = new wxImageRefData();
M_IMGDATA->m_data = (unsigned char *) malloc( width*height*3 );
if (M_IMGDATA->m_data)
{
for (int l = 0; l < width*height*3; l++) M_IMGDATA->m_data[l] = 0;
M_IMGDATA->m_data = (unsigned char *) malloc( width*height*3 );
if (M_IMGDATA->m_data)
{
for (int l = 0; l < width*height*3; l++) M_IMGDATA->m_data[l] = 0;
M_IMGDATA->m_width = width;
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = TRUE;
}
else
{
UnRef();
}
M_IMGDATA->m_width = width;
M_IMGDATA->m_height = height;
M_IMGDATA->m_ok = TRUE;
}
else
{
UnRef();
}
}
void wxImage::Destroy()
{
UnRef();
UnRef();
}
bool wxImage::Ok() const
{
return (M_IMGDATA && M_IMGDATA->m_ok);
return (M_IMGDATA && M_IMGDATA->m_ok);
}
char unsigned *wxImage::GetData() const
{
if (!Ok()) return (char unsigned *)NULL;
if (!Ok()) return (char unsigned *)NULL;
return M_IMGDATA->m_data;
return M_IMGDATA->m_data;
}
void wxImage::SetData( char unsigned *WXUNUSED(data) )
@@ -136,96 +136,96 @@ void wxImage::SetData( char unsigned *WXUNUSED(data) )
void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b )
{
if (!Ok()) return;
if (!Ok()) return;
M_IMGDATA->m_maskRed = r;
M_IMGDATA->m_maskGreen = g;
M_IMGDATA->m_maskBlue = b;
M_IMGDATA->m_hasMask = TRUE;
M_IMGDATA->m_maskRed = r;
M_IMGDATA->m_maskGreen = g;
M_IMGDATA->m_maskBlue = b;
M_IMGDATA->m_hasMask = TRUE;
}
unsigned char wxImage::GetMaskRed() const
{
if (!Ok()) return 0;
if (!Ok()) return 0;
return M_IMGDATA->m_maskRed;
return M_IMGDATA->m_maskRed;
}
unsigned char wxImage::GetMaskGreen() const
{
if (!Ok()) return 0;
return M_IMGDATA->m_maskGreen;
if (!Ok()) return 0;
return M_IMGDATA->m_maskGreen;
}
unsigned char wxImage::GetMaskBlue() const
{
if (!Ok()) return 0;
if (!Ok()) return 0;
return M_IMGDATA->m_maskBlue;
return M_IMGDATA->m_maskBlue;
}
void wxImage::SetMask( bool mask )
{
if (!Ok()) return;
if (!Ok()) return;
M_IMGDATA->m_hasMask = mask;
M_IMGDATA->m_hasMask = mask;
}
bool wxImage::HasMask() const
{
if (!Ok()) return FALSE;
if (!Ok()) return FALSE;
return M_IMGDATA->m_hasMask;
return M_IMGDATA->m_hasMask;
}
int wxImage::GetWidth() const
{
return (M_IMGDATA ? M_IMGDATA->m_width : 0);
return (M_IMGDATA ? M_IMGDATA->m_width : 0);
}
int wxImage::GetHeight() const
{
return (M_IMGDATA ? M_IMGDATA->m_height : 0);
return (M_IMGDATA ? M_IMGDATA->m_height : 0);
}
bool wxImage::LoadFile( const wxString& filename, long type )
{
UnRef();
UnRef();
if (!wxFileExists(filename))
{
wxLogWarning( "Image file does not exist." );
if (!wxFileExists(filename))
{
wxLogWarning( "Image file does not exist." );
return FALSE;
}
return FALSE;
}
m_refData = new wxImageRefData;
m_refData = new wxImageRefData;
wxImageHandler *handler = FindHandler(type);
wxImageHandler *handler = FindHandler(type);
if (handler == NULL)
{
wxLogWarning( "No image handler for type %d defined.", type );
if (handler == NULL)
{
wxLogWarning( "No image handler for type %d defined.", type );
return FALSE;
}
return FALSE;
}
return handler->LoadFile( this, filename );
return handler->LoadFile( this, filename );
}
bool wxImage::SaveFile( const wxString& filename, int type )
{
wxImageHandler *handler = FindHandler(type);
wxImageHandler *handler = FindHandler(type);
if (handler == NULL)
{
wxLogWarning( "No image handler for type %d defined.", type );
if (handler == NULL)
{
wxLogWarning( "No image handler for type %d defined.", type );
return FALSE;
}
return FALSE;
}
return handler->SaveFile( this, filename );
return handler->SaveFile( this, filename );
}
void wxImage::AddHandler( wxImageHandler *handler )
@@ -240,65 +240,71 @@ void wxImage::InsertHandler( wxImageHandler *handler )
bool wxImage::RemoveHandler( const wxString& name )
{
wxImageHandler *handler = FindHandler(name);
if (handler)
{
sm_handlers.DeleteObject(handler);
return TRUE;
}
else
return FALSE;
wxImageHandler *handler = FindHandler(name);
if (handler)
{
sm_handlers.DeleteObject(handler);
return TRUE;
}
else
return FALSE;
}
wxImageHandler *wxImage::FindHandler( const wxString& name )
{
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->Data();
if (handler->GetName() == name) return handler;
node = node->Next();
}
return (wxImageHandler *)NULL;
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->Data();
if (handler->GetName() == name) return handler;
node = node->Next();
}
return (wxImageHandler *)NULL;
}
wxImageHandler *wxImage::FindHandler( const wxString& extension, long bitmapType )
{
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->Data();
if ( handler->GetExtension() == extension &&
(bitmapType == -1 || handler->GetType() == bitmapType) )
return handler;
node = node->Next();
}
return (wxImageHandler*)NULL;
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler*)node->Data();
if ( handler->GetExtension() == extension &&
(bitmapType == -1 || handler->GetType() == bitmapType) )
return handler;
node = node->Next();
}
return (wxImageHandler*)NULL;
}
wxImageHandler *wxImage::FindHandler( long bitmapType )
{
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->Data();
if (handler->GetType() == bitmapType) return handler;
node = node->Next();
}
return NULL;
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->Data();
if (handler->GetType() == bitmapType) return handler;
node = node->Next();
}
return NULL;
}
void wxImage::InitStandardHandlers()
{
AddHandler( new wxBMPHandler );
AddHandler( new wxPNGHandler );
}
void wxImage::CleanUpHandlers()
{
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->Data();
wxNode *next = node->Next();
delete handler;
delete node;
node = next;
}
wxNode *node = sm_handlers.First();
while (node)
{
wxImageHandler *handler = (wxImageHandler *)node->Data();
wxNode *next = node->Next();
delete handler;
delete node;
node = next;
}
}
//-----------------------------------------------------------------------------
@@ -311,12 +317,12 @@ IMPLEMENT_DYNAMIC_CLASS(wxImageHandler,wxObject)
bool wxImageHandler::LoadFile( wxImage *WXUNUSED(image), const wxString& WXUNUSED(name) )
{
return FALSE;
return FALSE;
}
bool wxImageHandler::SaveFile( wxImage *WXUNUSED(image), const wxString& WXUNUSED(name) )
{
return FALSE;
return FALSE;
}
//-----------------------------------------------------------------------------
+5 -19
View File
@@ -323,30 +323,14 @@ void wxApp::CommonInit(void)
wxInitializeResourceSystem();
// For PostScript printing
#if wxUSE_POSTSCRIPT
/* Now done in wxPostScriptModule
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
*/
#endif
/*
wxBitmap::InitStandardHandlers();
g_globalCursor = new wxCursor;
*/
wxImage::InitStandardHandlers();
// g_globalCursor = new wxCursor;
}
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
/* Now done in wxPostScriptModule
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
*/
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();
@@ -357,6 +341,8 @@ void wxApp::CommonCleanUp(void)
wxDeleteStockLists();
wxCleanUpResourceSystem();
wxImage::CleanUpHandlers();
wxSystemSettings::Done();
}
+352 -316
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -45,14 +45,20 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
wxButton::wxButton(void)
wxButton::wxButton()
{
}
wxButton::~wxButton()
{
if (m_clientData) delete m_clientData;
}
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxValidator& validator, const wxString &name )
{
m_clientData = (wxClientData*) NULL;
m_needParent = TRUE;
wxSize newSize = size;
@@ -118,3 +124,4 @@ void wxButton::ApplyWidgetStyle()
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
}
+246 -145
View File
@@ -43,200 +43,301 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void)
wxChoice::wxChoice()
{
}
bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name )
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
SetValidator( validator );
m_widget = gtk_option_menu_new();
m_widget = gtk_option_menu_new();
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
GtkWidget *menu = gtk_menu_new();
GtkWidget *menu = gtk_menu_new();
for (int i = 0; i < n; i++)
{
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_menu_append( GTK_MENU(menu), item );
for (int i = 0; i < n; i++)
{
m_clientDataList.Append( (wxObject*) NULL );
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item );
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
gtk_widget_show( item );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
m_parent->AddChild( this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
(m_parent->m_insertCallback)( m_parent, this );
PostCreation();
PostCreation();
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
Show( TRUE );
return TRUE;
return TRUE;
}
wxChoice::~wxChoice()
{
wxNode *node = m_clientDataList.First();
while (node)
{
wxClientData *cd = (wxClientData*)node->Data();
if (cd) delete cd;
node = node->Next();
}
m_clientDataList.Clear();
}
void wxChoice::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_widget_show( menu_item );
}
void wxChoice::Append( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
m_clientDataList.Append( (wxObject*)NULL );
gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_widget_show( menu_item );
AppendCommon( item );
}
void wxChoice::Clear(void)
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
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 );
void wxChoice::Append( const wxString &item, void *clientData )
{
if (clientData)
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
else
m_clientDataList.Append( (wxObject*)NULL );
AppendCommon( item );
}
void wxChoice::Append( const wxString &item, wxClientData *clientData )
{
m_clientDataList.Append( (wxObject*) clientData );
AppendCommon( item );
}
void wxChoice::SetClientData( int n, void* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return;
wxClientData *cd = (wxClientData*) node->Data();
if (cd) delete cd;
if (clientData)
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
else
node->SetData( (wxObject*) NULL );
}
void* wxChoice::GetClientData( int n )
{
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return NULL;
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
if (cd)
return cd->GetData();
else
return (void*) NULL;
}
void wxChoice::SetClientObject( int n, wxClientData* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return;
wxClientData *cd = (wxClientData*) node->Data();
if (cd) delete cd;
node->SetData( (wxObject*) clientData );
}
wxClientData* wxChoice::GetClientObject( int n )
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return (wxClientData*) NULL;
return (wxClientData*) node->Data();
}
void wxChoice::Clear()
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
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 );
wxNode *node = m_clientDataList.First();
while (node)
{
wxClientData *cd = (wxClientData*)node->Data();
if (cd) delete cd;
node = node->Next();
}
m_clientDataList.Clear();
}
void wxChoice::Delete( int WXUNUSED(n) )
{
wxFAIL_MSG( "wxChoice:Delete not implemented" );
wxFAIL_MSG( "wxChoice:Delete not implemented" );
}
int wxChoice::FindString( const wxString &string ) const
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
if (string == label->label) return count;
child = child->next;
count++;
}
if (string == label->label) return count;
child = child->next;
count++;
}
wxFAIL_MSG( "wxChoice: string not found" );
wxFAIL_MSG( "wxChoice: string not found" );
return -1;
return -1;
}
int wxChoice::GetColumns(void) const
int wxChoice::GetColumns() const
{
return 1;
return 1;
}
int wxChoice::GetSelection(void)
int wxChoice::GetSelection()
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (!bin->child) return count;
child = child->next;
count++;
}
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (!bin->child) return count;
child = child->next;
count++;
}
wxFAIL_MSG( "wxChoice: no selection" );
wxFAIL_MSG( "wxChoice: no selection" );
return -1;
return -1;
}
wxString wxChoice::GetString( int n ) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label;
return label->label;
}
child = child->next;
count++;
}
child = child->next;
count++;
}
wxFAIL_MSG( "wxChoice: string not found" );
wxFAIL_MSG( "wxChoice: string not found" );
return "";
return "";
}
wxString wxChoice::GetStringSelection(void) const
wxString wxChoice::GetStringSelection() const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label;
return label->label;
}
int wxChoice::Number(void) const
int wxChoice::Number() const
{
wxCHECK_MSG( m_widget != NULL, 0, "invalid choice" );
wxCHECK_MSG( m_widget != NULL, 0, "invalid choice" );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
count++;
child = child->next;
}
return count;
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
count++;
child = child->next;
}
return count;
}
void wxChoice::SetColumns( int WXUNUSED(n) )
@@ -245,44 +346,44 @@ void wxChoice::SetColumns( int WXUNUSED(n) )
void wxChoice::SetSelection( int n )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
wxCHECK_RET( m_widget != NULL, "invalid choice" );
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
}
void wxChoice::SetStringSelection( const wxString &string )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
wxCHECK_RET( m_widget != NULL, "invalid choice" );
int n = FindString( string );
if (n != -1) SetSelection( n );
int n = FindString( string );
if (n != -1) SetSelection( n );
}
void wxChoice::ApplyWidgetStyle()
{
SetWidgetStyle();
SetWidgetStyle();
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
gtk_widget_set_style( m_widget, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
gtk_widget_set_style( m_widget, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
GList *child = menu_shell->children;
while (child)
{
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
GList *child = menu_shell->children;
while (child)
{
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (bin->child) label = bin->child;
if (!label) label = GTK_BUTTON(m_widget)->child;
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (bin->child) label = bin->child;
if (!label) label = GTK_BUTTON(m_widget)->child;
gtk_widget_set_style( label, m_widgetStyle );
gtk_widget_set_style( label, m_widgetStyle );
child = child->next;
}
child = child->next;
}
}
+103 -5
View File
@@ -19,6 +19,9 @@
wxClipboard *wxTheClipboard = (wxClipboard*) NULL;
GdkAtom g_textAtom = 0;
GdkAtom g_clipboardAtom = 0;
//-----------------------------------------------------------------------------
// functions
//-----------------------------------------------------------------------------
@@ -39,11 +42,59 @@ void wxDoneClipboard()
// "selection_received"
//-----------------------------------------------------------------------------
/*
static void selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
static void
selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
{
}
*/
//-----------------------------------------------------------------------------
// "selection_clear"
//-----------------------------------------------------------------------------
static gint
selection_clear( GtkWidget *widget, GdkEventSelection *event )
{
/* The clipboard is no longer in our hands. We can delete the
* clipboard data. I hope I got that one right... */
if (!wxTheClipboard) return TRUE;
wxTheClipboard->SetData( (wxDataObject*) NULL );
return TRUE;
}
//-----------------------------------------------------------------------------
// selection handler for supplying data
//-----------------------------------------------------------------------------
static void
selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, gpointer WXUNUSED(data) )
{
if (!wxTheClipboard) return;
wxDataObject *data_object = wxTheClipboard->m_data;
if (!data_object) return;
if (data_object->GetDataSize() == 0) return;
gint len = data_object->GetDataSize();
guchar *bin_data = (guchar*) malloc( len );
data_object->GetDataHere( (void*)bin_data );
if (selection_data->target == GDK_SELECTION_TYPE_STRING)
{
gtk_selection_data_set(
selection_data, GDK_SELECTION_TYPE_STRING, 8*sizeof(gchar), bin_data, len );
}
else if (selection_data->target == g_textAtom)
{
gtk_selection_data_set(
selection_data, g_textAtom, 8*sizeof(gchar), bin_data, len );
}
free( bin_data );
}
//-----------------------------------------------------------------------------
// wxClipboard
@@ -53,14 +104,29 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
wxClipboard::wxClipboard()
{
m_data = (wxDataObject*)NULL;
m_data = (wxDataObject*) NULL;
m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
gtk_widget_realize( m_clipboardWidget );
gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
"selection_clear_event",
GTK_SIGNAL_FUNC( selection_clear ),
(gpointer) NULL );
if (!g_clipboardAtom) g_clipboardAtom = gdk_atom_intern( "CLIPBOARD", FALSE );
if (!g_textAtom) g_textAtom = gdk_atom_intern( "TEXT", FALSE );
}
wxClipboard::~wxClipboard()
{
if (m_data) delete m_data;
/* As we have data we also own the clipboard. Once we no longer own
it, clear_selection is called which will set m_data to zero */
if (m_data)
{
delete m_data;
gtk_selection_owner_set( (GtkWidget*) NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME );
}
if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
}
@@ -68,6 +134,38 @@ void wxClipboard::SetData( wxDataObject *data )
{
if (m_data) delete m_data;
m_data = data;
if (!m_data) return;
if (!gtk_selection_owner_set( m_clipboardWidget,
g_clipboardAtom,
GDK_CURRENT_TIME))
{
delete m_data;
m_data = (wxDataObject*) NULL;
return;
}
switch (m_data->GetPreferredFormat())
{
/*
case wxDF_STRING:
gtk_selection_add_handler( m_clipboardWidget,
g_clipboardAtom,
GDK_TARGET_STRING,
selection_handler,
NULL );
break;
*/
case wxDF_TEXT:
gtk_selection_add_handler( m_clipboardWidget,
g_clipboardAtom,
g_textAtom,
selection_handler,
NULL );
break;
default:
break;
}
}
void *wxClipboard::GetData( wxDataFormat format, size_t *length )
+322 -253
View File
File diff suppressed because it is too large Load Diff
+417 -354
View File
File diff suppressed because it is too large Load Diff
+48 -12
View File
@@ -933,7 +933,7 @@ wxWindow::wxWindow()
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_pDropTarget = (wxDropTarget *) NULL;
m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE;
m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
@@ -1059,7 +1059,7 @@ wxWindow::~wxWindow()
{
m_hasVMT = FALSE;
if (m_pDropTarget) delete m_pDropTarget;
if (m_dropTarget) delete m_dropTarget;
if (m_parent) m_parent->RemoveChild( this );
if (m_widget) Show( FALSE );
@@ -1114,6 +1114,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget *) NULL;
m_wxwindow = (GtkWidget *) NULL;
m_hasVMT = FALSE;
m_parent = parent;
m_children.DeleteContents( FALSE );
@@ -1148,8 +1149,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_eventHandler = this;
m_windowId = id;
m_sizeSet = FALSE;
if (m_cursor == NULL)
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE;
// m_foregroundColour = wxBLACK;
@@ -1162,7 +1162,13 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_autoLayout = FALSE;
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
m_pDropTarget = (wxDropTarget *) NULL;
m_hAdjust = (GtkAdjustment *) NULL;
m_vAdjust = (GtkAdjustment *) NULL;
m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL;
m_scrollGC = (GdkGC*) NULL;
@@ -1839,6 +1845,36 @@ void wxWindow::SetValidator( const wxValidator& validator )
if (m_windowValidator) m_windowValidator->SetWindow(this);
}
void wxWindow::SetClientObject( wxClientData *data )
{
if (m_clientData) delete m_clientData;
m_clientData = data;
}
wxClientData *wxWindow::GetClientObject()
{
return m_clientData;
}
void wxWindow::SetClientData( void *data )
{
if (m_clientData) delete m_clientData;
if (data)
m_clientData = new wxVoidClientData( data );
else
m_clientData = (wxClientData*) NULL;
}
void *wxWindow::GetClientData()
{
if (!m_clientData) return NULL;
wxVoidClientData *vd = (wxVoidClientData*) m_clientData;
return vd->GetData();
}
bool wxWindow::IsBeingDeleted()
{
return FALSE;
@@ -2149,22 +2185,22 @@ void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
DisconnectDnDWidget( dnd_widget );
if (m_pDropTarget) delete m_pDropTarget;
m_pDropTarget = dropTarget;
if (m_dropTarget) delete m_dropTarget;
m_dropTarget = dropTarget;
ConnectDnDWidget( dnd_widget );
}
wxDropTarget *wxWindow::GetDropTarget() const
{
return m_pDropTarget;
return m_dropTarget;
}
void wxWindow::ConnectDnDWidget( GtkWidget *widget )
{
if (!m_pDropTarget) return;
if (!m_dropTarget) return;
m_pDropTarget->RegisterWidget( widget );
m_dropTarget->RegisterWidget( widget );
gtk_signal_connect( GTK_OBJECT(widget), "drop_data_available_event",
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
@@ -2172,12 +2208,12 @@ void wxWindow::ConnectDnDWidget( GtkWidget *widget )
void wxWindow::DisconnectDnDWidget( GtkWidget *widget )
{
if (!m_pDropTarget) return;
if (!m_dropTarget) return;
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
m_pDropTarget->UnregisterWidget( widget );
m_dropTarget->UnregisterWidget( widget );
}
GtkWidget* wxWindow::GetConnectWidget()
+5 -19
View File
@@ -323,30 +323,14 @@ void wxApp::CommonInit(void)
wxInitializeResourceSystem();
// For PostScript printing
#if wxUSE_POSTSCRIPT
/* Now done in wxPostScriptModule
wxInitializePrintSetupData();
wxThePrintPaperDatabase = new wxPrintPaperDatabase;
wxThePrintPaperDatabase->CreateDatabase();
*/
#endif
/*
wxBitmap::InitStandardHandlers();
g_globalCursor = new wxCursor;
*/
wxImage::InitStandardHandlers();
// g_globalCursor = new wxCursor;
}
void wxApp::CommonCleanUp(void)
{
wxDELETE(wxTheColourDatabase);
/* Now done in wxPostScriptModule
wxDELETE(wxThePrintPaperDatabase);
wxDELETE(wxThePrintSetupData);
*/
wxDELETE(wxTheFontNameDirectory);
wxDeleteStockObjects();
@@ -357,6 +341,8 @@ void wxApp::CommonCleanUp(void)
wxDeleteStockLists();
wxCleanUpResourceSystem();
wxImage::CleanUpHandlers();
wxSystemSettings::Done();
}
+352 -316
View File
File diff suppressed because it is too large Load Diff
+8 -1
View File
@@ -45,14 +45,20 @@ static void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
wxButton::wxButton(void)
wxButton::wxButton()
{
}
wxButton::~wxButton()
{
if (m_clientData) delete m_clientData;
}
bool wxButton::Create( wxWindow *parent, wxWindowID id, const wxString &label,
const wxPoint &pos, const wxSize &size,
long style, const wxValidator& validator, const wxString &name )
{
m_clientData = (wxClientData*) NULL;
m_needParent = TRUE;
wxSize newSize = size;
@@ -118,3 +124,4 @@ void wxButton::ApplyWidgetStyle()
gtk_widget_set_style( GTK_BUTTON(m_widget)->child, m_widgetStyle );
}
+246 -145
View File
@@ -43,200 +43,301 @@ static void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *
IMPLEMENT_DYNAMIC_CLASS(wxChoice,wxControl)
wxChoice::wxChoice(void)
wxChoice::wxChoice()
{
}
bool wxChoice::Create( wxWindow *parent, wxWindowID id,
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name )
const wxPoint &pos, const wxSize &size,
int n, const wxString choices[],
long style, const wxValidator& validator, const wxString &name )
{
m_needParent = TRUE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
PreCreation( parent, id, pos, size, style, name );
SetValidator( validator );
SetValidator( validator );
m_widget = gtk_option_menu_new();
m_widget = gtk_option_menu_new();
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
wxSize newSize = size;
if (newSize.x == -1) newSize.x = 80;
if (newSize.y == -1) newSize.y = 26;
SetSize( newSize.x, newSize.y );
GtkWidget *menu = gtk_menu_new();
GtkWidget *menu = gtk_menu_new();
for (int i = 0; i < n; i++)
{
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_menu_append( GTK_MENU(menu), item );
for (int i = 0; i < n; i++)
{
m_clientDataList.Append( (wxObject*) NULL );
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
GtkWidget *item = gtk_menu_item_new_with_label( choices[i] );
gtk_menu_append( GTK_MENU(menu), item );
gtk_widget_show( item );
gtk_widget_realize( item );
gtk_widget_realize( GTK_BIN(item)->child );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
gtk_widget_show( item );
gtk_signal_connect( GTK_OBJECT( item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
}
gtk_option_menu_set_menu( GTK_OPTION_MENU(m_widget), menu );
m_parent->AddChild( this );
m_parent->AddChild( this );
(m_parent->m_insertCallback)( m_parent, this );
(m_parent->m_insertCallback)( m_parent, this );
PostCreation();
PostCreation();
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
SetBackgroundColour( parent->GetBackgroundColour() );
SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
Show( TRUE );
return TRUE;
return TRUE;
}
wxChoice::~wxChoice()
{
wxNode *node = m_clientDataList.First();
while (node)
{
wxClientData *cd = (wxClientData*)node->Data();
if (cd) delete cd;
node = node->Next();
}
m_clientDataList.Clear();
}
void wxChoice::AppendCommon( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_widget_show( menu_item );
}
void wxChoice::Append( const wxString &item )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
GtkWidget *menu_item = gtk_menu_item_new_with_label( item );
m_clientDataList.Append( (wxObject*)NULL );
gtk_menu_append( GTK_MENU(menu), menu_item );
gtk_widget_realize( menu_item );
gtk_widget_realize( GTK_BIN(menu_item)->child );
if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT( menu_item ), "activate",
GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
gtk_widget_show( menu_item );
AppendCommon( item );
}
void wxChoice::Clear(void)
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
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 );
void wxChoice::Append( const wxString &item, void *clientData )
{
if (clientData)
m_clientDataList.Append( (wxObject*) new wxVoidClientData( clientData ) );
else
m_clientDataList.Append( (wxObject*)NULL );
AppendCommon( item );
}
void wxChoice::Append( const wxString &item, wxClientData *clientData )
{
m_clientDataList.Append( (wxObject*) clientData );
AppendCommon( item );
}
void wxChoice::SetClientData( int n, void* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return;
wxClientData *cd = (wxClientData*) node->Data();
if (cd) delete cd;
if (clientData)
node->SetData( (wxObject*) new wxVoidClientData(clientData) );
else
node->SetData( (wxObject*) NULL );
}
void* wxChoice::GetClientData( int n )
{
wxCHECK_MSG( m_widget != NULL, NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return NULL;
wxVoidClientData *cd = (wxVoidClientData*) node->Data();
if (cd)
return cd->GetData();
else
return (void*) NULL;
}
void wxChoice::SetClientObject( int n, wxClientData* clientData )
{
wxCHECK_RET( m_widget != NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return;
wxClientData *cd = (wxClientData*) node->Data();
if (cd) delete cd;
node->SetData( (wxObject*) clientData );
}
wxClientData* wxChoice::GetClientObject( int n )
{
wxCHECK_MSG( m_widget != NULL, (wxClientData*)NULL, "invalid combobox" );
wxNode *node = m_clientDataList.Nth( n );
if (!node) return (wxClientData*) NULL;
return (wxClientData*) node->Data();
}
void wxChoice::Clear()
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
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 );
wxNode *node = m_clientDataList.First();
while (node)
{
wxClientData *cd = (wxClientData*)node->Data();
if (cd) delete cd;
node = node->Next();
}
m_clientDataList.Clear();
}
void wxChoice::Delete( int WXUNUSED(n) )
{
wxFAIL_MSG( "wxChoice:Delete not implemented" );
wxFAIL_MSG( "wxChoice:Delete not implemented" );
}
int wxChoice::FindString( const wxString &string ) const
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
// If you read this code once and you think you understand
// it, then you are very wrong. Robert Roebling.
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
if (string == label->label) return count;
child = child->next;
count++;
}
if (string == label->label) return count;
child = child->next;
count++;
}
wxFAIL_MSG( "wxChoice: string not found" );
wxFAIL_MSG( "wxChoice: string not found" );
return -1;
return -1;
}
int wxChoice::GetColumns(void) const
int wxChoice::GetColumns() const
{
return 1;
return 1;
}
int wxChoice::GetSelection(void)
int wxChoice::GetSelection()
{
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
wxCHECK_MSG( m_widget != NULL, -1, "invalid choice" );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (!bin->child) return count;
child = child->next;
count++;
}
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (!bin->child) return count;
child = child->next;
count++;
}
wxFAIL_MSG( "wxChoice: no selection" );
wxFAIL_MSG( "wxChoice: no selection" );
return -1;
return -1;
}
wxString wxChoice::GetString( int n ) const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
GtkLabel *label = (GtkLabel *) NULL;
if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label;
return label->label;
}
child = child->next;
count++;
}
child = child->next;
count++;
}
wxFAIL_MSG( "wxChoice: string not found" );
wxFAIL_MSG( "wxChoice: string not found" );
return "";
return "";
}
wxString wxChoice::GetStringSelection(void) const
wxString wxChoice::GetStringSelection() const
{
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
wxCHECK_MSG( m_widget != NULL, "", "invalid choice" );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
GtkLabel *label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
wxASSERT_MSG( label != NULL , "wxChoice: invalid label" );
return label->label;
return label->label;
}
int wxChoice::Number(void) const
int wxChoice::Number() const
{
wxCHECK_MSG( m_widget != NULL, 0, "invalid choice" );
wxCHECK_MSG( m_widget != NULL, 0, "invalid choice" );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
count++;
child = child->next;
}
return count;
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
int count = 0;
GList *child = menu_shell->children;
while (child)
{
count++;
child = child->next;
}
return count;
}
void wxChoice::SetColumns( int WXUNUSED(n) )
@@ -245,44 +346,44 @@ void wxChoice::SetColumns( int WXUNUSED(n) )
void wxChoice::SetSelection( int n )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
wxCHECK_RET( m_widget != NULL, "invalid choice" );
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
gtk_choice_clicked_callback( (GtkWidget *) NULL, this );
}
void wxChoice::SetStringSelection( const wxString &string )
{
wxCHECK_RET( m_widget != NULL, "invalid choice" );
wxCHECK_RET( m_widget != NULL, "invalid choice" );
int n = FindString( string );
if (n != -1) SetSelection( n );
int n = FindString( string );
if (n != -1) SetSelection( n );
}
void wxChoice::ApplyWidgetStyle()
{
SetWidgetStyle();
SetWidgetStyle();
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
gtk_widget_set_style( m_widget, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
gtk_widget_set_style( m_widget, m_widgetStyle );
gtk_widget_set_style( GTK_WIDGET( menu_shell ), m_widgetStyle );
GList *child = menu_shell->children;
while (child)
{
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
GList *child = menu_shell->children;
while (child)
{
gtk_widget_set_style( GTK_WIDGET( child->data ), m_widgetStyle );
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (bin->child) label = bin->child;
if (!label) label = GTK_BUTTON(m_widget)->child;
GtkBin *bin = GTK_BIN( child->data );
GtkWidget *label = (GtkWidget *) NULL;
if (bin->child) label = bin->child;
if (!label) label = GTK_BUTTON(m_widget)->child;
gtk_widget_set_style( label, m_widgetStyle );
gtk_widget_set_style( label, m_widgetStyle );
child = child->next;
}
child = child->next;
}
}
+103 -5
View File
@@ -19,6 +19,9 @@
wxClipboard *wxTheClipboard = (wxClipboard*) NULL;
GdkAtom g_textAtom = 0;
GdkAtom g_clipboardAtom = 0;
//-----------------------------------------------------------------------------
// functions
//-----------------------------------------------------------------------------
@@ -39,11 +42,59 @@ void wxDoneClipboard()
// "selection_received"
//-----------------------------------------------------------------------------
/*
static void selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
static void
selection_received( GtkWidget *widget, GtkSelectionData *selection_data, gpointer data )
{
}
*/
//-----------------------------------------------------------------------------
// "selection_clear"
//-----------------------------------------------------------------------------
static gint
selection_clear( GtkWidget *widget, GdkEventSelection *event )
{
/* The clipboard is no longer in our hands. We can delete the
* clipboard data. I hope I got that one right... */
if (!wxTheClipboard) return TRUE;
wxTheClipboard->SetData( (wxDataObject*) NULL );
return TRUE;
}
//-----------------------------------------------------------------------------
// selection handler for supplying data
//-----------------------------------------------------------------------------
static void
selection_handler( GtkWidget *WXUNUSED(widget), GtkSelectionData *selection_data, gpointer WXUNUSED(data) )
{
if (!wxTheClipboard) return;
wxDataObject *data_object = wxTheClipboard->m_data;
if (!data_object) return;
if (data_object->GetDataSize() == 0) return;
gint len = data_object->GetDataSize();
guchar *bin_data = (guchar*) malloc( len );
data_object->GetDataHere( (void*)bin_data );
if (selection_data->target == GDK_SELECTION_TYPE_STRING)
{
gtk_selection_data_set(
selection_data, GDK_SELECTION_TYPE_STRING, 8*sizeof(gchar), bin_data, len );
}
else if (selection_data->target == g_textAtom)
{
gtk_selection_data_set(
selection_data, g_textAtom, 8*sizeof(gchar), bin_data, len );
}
free( bin_data );
}
//-----------------------------------------------------------------------------
// wxClipboard
@@ -53,14 +104,29 @@ IMPLEMENT_DYNAMIC_CLASS(wxClipboard,wxObject)
wxClipboard::wxClipboard()
{
m_data = (wxDataObject*)NULL;
m_data = (wxDataObject*) NULL;
m_clipboardWidget = gtk_window_new( GTK_WINDOW_POPUP );
gtk_widget_realize( m_clipboardWidget );
gtk_signal_connect( GTK_OBJECT(m_clipboardWidget),
"selection_clear_event",
GTK_SIGNAL_FUNC( selection_clear ),
(gpointer) NULL );
if (!g_clipboardAtom) g_clipboardAtom = gdk_atom_intern( "CLIPBOARD", FALSE );
if (!g_textAtom) g_textAtom = gdk_atom_intern( "TEXT", FALSE );
}
wxClipboard::~wxClipboard()
{
if (m_data) delete m_data;
/* As we have data we also own the clipboard. Once we no longer own
it, clear_selection is called which will set m_data to zero */
if (m_data)
{
delete m_data;
gtk_selection_owner_set( (GtkWidget*) NULL, GDK_SELECTION_PRIMARY, GDK_CURRENT_TIME );
}
if (m_clipboardWidget) gtk_widget_destroy( m_clipboardWidget );
}
@@ -68,6 +134,38 @@ void wxClipboard::SetData( wxDataObject *data )
{
if (m_data) delete m_data;
m_data = data;
if (!m_data) return;
if (!gtk_selection_owner_set( m_clipboardWidget,
g_clipboardAtom,
GDK_CURRENT_TIME))
{
delete m_data;
m_data = (wxDataObject*) NULL;
return;
}
switch (m_data->GetPreferredFormat())
{
/*
case wxDF_STRING:
gtk_selection_add_handler( m_clipboardWidget,
g_clipboardAtom,
GDK_TARGET_STRING,
selection_handler,
NULL );
break;
*/
case wxDF_TEXT:
gtk_selection_add_handler( m_clipboardWidget,
g_clipboardAtom,
g_textAtom,
selection_handler,
NULL );
break;
default:
break;
}
}
void *wxClipboard::GetData( wxDataFormat format, size_t *length )
+322 -253
View File
File diff suppressed because it is too large Load Diff
+417 -354
View File
File diff suppressed because it is too large Load Diff
+48 -12
View File
@@ -933,7 +933,7 @@ wxWindow::wxWindow()
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_pDropTarget = (wxDropTarget *) NULL;
m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE;
m_scrollGC = (GdkGC*) NULL;
m_widgetStyle = (GtkStyle*) NULL;
@@ -1059,7 +1059,7 @@ wxWindow::~wxWindow()
{
m_hasVMT = FALSE;
if (m_pDropTarget) delete m_pDropTarget;
if (m_dropTarget) delete m_dropTarget;
if (m_parent) m_parent->RemoveChild( this );
if (m_widget) Show( FALSE );
@@ -1114,6 +1114,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
wxFatalError( "Need complete parent.", name );
m_widget = (GtkWidget *) NULL;
m_wxwindow = (GtkWidget *) NULL;
m_hasVMT = FALSE;
m_parent = parent;
m_children.DeleteContents( FALSE );
@@ -1148,8 +1149,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_eventHandler = this;
m_windowId = id;
m_sizeSet = FALSE;
if (m_cursor == NULL)
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_cursor = new wxCursor( wxCURSOR_ARROW );
m_font = *wxSWISS_FONT;
// m_backgroundColour = wxWHITE;
// m_foregroundColour = wxBLACK;
@@ -1162,7 +1162,13 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
m_autoLayout = FALSE;
m_hasScrolling = FALSE;
m_isScrolling = FALSE;
m_pDropTarget = (wxDropTarget *) NULL;
m_hAdjust = (GtkAdjustment *) NULL;
m_vAdjust = (GtkAdjustment *) NULL;
m_oldHorizontalPos = 0.0;
m_oldVerticalPos = 0.0;
m_isShown = FALSE;
m_isEnabled = TRUE;
m_dropTarget = (wxDropTarget *) NULL;
m_resizing = FALSE;
m_windowValidator = (wxValidator *) NULL;
m_scrollGC = (GdkGC*) NULL;
@@ -1839,6 +1845,36 @@ void wxWindow::SetValidator( const wxValidator& validator )
if (m_windowValidator) m_windowValidator->SetWindow(this);
}
void wxWindow::SetClientObject( wxClientData *data )
{
if (m_clientData) delete m_clientData;
m_clientData = data;
}
wxClientData *wxWindow::GetClientObject()
{
return m_clientData;
}
void wxWindow::SetClientData( void *data )
{
if (m_clientData) delete m_clientData;
if (data)
m_clientData = new wxVoidClientData( data );
else
m_clientData = (wxClientData*) NULL;
}
void *wxWindow::GetClientData()
{
if (!m_clientData) return NULL;
wxVoidClientData *vd = (wxVoidClientData*) m_clientData;
return vd->GetData();
}
bool wxWindow::IsBeingDeleted()
{
return FALSE;
@@ -2149,22 +2185,22 @@ void wxWindow::SetDropTarget( wxDropTarget *dropTarget )
DisconnectDnDWidget( dnd_widget );
if (m_pDropTarget) delete m_pDropTarget;
m_pDropTarget = dropTarget;
if (m_dropTarget) delete m_dropTarget;
m_dropTarget = dropTarget;
ConnectDnDWidget( dnd_widget );
}
wxDropTarget *wxWindow::GetDropTarget() const
{
return m_pDropTarget;
return m_dropTarget;
}
void wxWindow::ConnectDnDWidget( GtkWidget *widget )
{
if (!m_pDropTarget) return;
if (!m_dropTarget) return;
m_pDropTarget->RegisterWidget( widget );
m_dropTarget->RegisterWidget( widget );
gtk_signal_connect( GTK_OBJECT(widget), "drop_data_available_event",
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
@@ -2172,12 +2208,12 @@ void wxWindow::ConnectDnDWidget( GtkWidget *widget )
void wxWindow::DisconnectDnDWidget( GtkWidget *widget )
{
if (!m_pDropTarget) return;
if (!m_dropTarget) return;
gtk_signal_disconnect_by_func( GTK_OBJECT(widget),
GTK_SIGNAL_FUNC(gtk_window_drop_callback), (gpointer)this );
m_pDropTarget->UnregisterWidget( widget );
m_dropTarget->UnregisterWidget( widget );
}
GtkWidget* wxWindow::GetConnectWidget()