]> git.saurik.com Git - wxWidgets.git/commitdiff
Added SetFont to most controls and controls sample
authorRobert Roebling <robert@roebling.de>
Sun, 6 Sep 1998 13:46:50 +0000 (13:46 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 6 Sep 1998 13:46:50 +0000 (13:46 +0000)
    (recompile)
  Added tiny bit of documentation to window.cpp

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@676 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

39 files changed:
include/wx/gtk/button.h
include/wx/gtk/checkbox.h
include/wx/gtk/choice.h
include/wx/gtk/combobox.h
include/wx/gtk/font.h
include/wx/gtk/listbox.h
include/wx/gtk/radiobox.h
include/wx/gtk/radiobut.h
include/wx/gtk/textctrl.h
include/wx/gtk/window.h
include/wx/gtk1/button.h
include/wx/gtk1/checkbox.h
include/wx/gtk1/choice.h
include/wx/gtk1/combobox.h
include/wx/gtk1/font.h
include/wx/gtk1/listbox.h
include/wx/gtk1/radiobox.h
include/wx/gtk1/radiobut.h
include/wx/gtk1/textctrl.h
include/wx/gtk1/window.h
samples/controls/controls.cpp
src/gtk/button.cpp
src/gtk/checkbox.cpp
src/gtk/choice.cpp
src/gtk/combobox.cpp
src/gtk/listbox.cpp
src/gtk/radiobox.cpp
src/gtk/radiobut.cpp
src/gtk/textctrl.cpp
src/gtk/window.cpp
src/gtk1/button.cpp
src/gtk1/checkbox.cpp
src/gtk1/choice.cpp
src/gtk1/combobox.cpp
src/gtk1/listbox.cpp
src/gtk1/radiobox.cpp
src/gtk1/radiobut.cpp
src/gtk1/textctrl.cpp
src/gtk1/window.cpp

index 0d5bf16b5cc6fda265f1350b928142ef4e1249c1..bbc5f130e2eb6d248b8ffbb7b4ffa9964f23d547 100644 (file)
@@ -60,6 +60,7 @@ class wxButton: public wxControl
     void SetDefault(void);
     void SetLabel( const wxString &label );
     void Enable( bool enable );
     void SetDefault(void);
     void SetLabel( const wxString &label );
     void Enable( bool enable );
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKBUTTONH__
 };
 
 #endif // __GTKBUTTONH__
index d949234568c5420ed05e255efec165276bfff07f..43327e3f26ec60d6b004a255a376eae7a89257d6 100644 (file)
@@ -59,6 +59,7 @@ class wxCheckBox: public wxControl
            const wxString& name = wxCheckBoxNameStr );
     void SetValue( bool state );
     bool GetValue(void) const;
            const wxString& name = wxCheckBoxNameStr );
     void SetValue( bool state );
     bool GetValue(void) const;
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKCHECKBOXH__
 };
 
 #endif // __GTKCHECKBOXH__
index 36f403bb7414c214b2ea511f00a6627c05ae489f..6849cec905da2b8cd57c863ca3a5659999249b96 100644 (file)
@@ -73,6 +73,7 @@ class wxChoice: public wxControl
     void SetColumns( int n = 1 );
     void SetSelection( int n );
     void SetStringSelection( const wxString &string );
     void SetColumns( int n = 1 );
     void SetSelection( int n );
     void SetStringSelection( const wxString &string );
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKCHOICEH__
 };
 
 #endif // __GTKCHOICEH__
index a0d3c360833a453a751bd0f2daf218c7e0a91cfb..654ae70bfe3424d33211b11599912bde1cda4479 100644 (file)
@@ -64,7 +64,6 @@ class wxComboBox: public wxControl
            const wxValidator& validator = wxDefaultValidator,
            const wxString& name = wxComboBoxNameStr);
 
            const wxValidator& validator = wxDefaultValidator,
            const wxString& name = wxComboBoxNameStr);
 
-  // List functions
   void Clear(void);
   void Append( const wxString &item );
   void Append( const wxString &item, char* clientData );
   void Clear(void);
   void Append( const wxString &item );
   void Append( const wxString &item, char* clientData );
@@ -79,11 +78,9 @@ class wxComboBox: public wxControl
   void SetSelection( int n );
   void SetStringSelection( const wxString &string );
 
   void SetSelection( int n );
   void SetStringSelection( const wxString &string );
 
-  // Text field functions
   wxString GetValue(void) const ;
   void SetValue(const wxString& value);
 
   wxString GetValue(void) const ;
   void SetValue(const wxString& value);
 
-  // Clipboard operations
   void Copy(void);
   void Cut(void);
   void Paste(void);
   void Copy(void);
   void Cut(void);
   void Paste(void);
@@ -95,14 +92,17 @@ class wxComboBox: public wxControl
   void Remove(long from, long to);
   void SetSelection(long from, long to);
   void SetEditable(bool editable);
   void Remove(long from, long to);
   void SetSelection(long from, long to);
   void SetEditable(bool editable);
+  
+  void SetFont( const wxFont &font );
+  
+  // implementation
 
 
+    bool     m_alreadySent;
+    
   private:
   
     wxList   m_clientData;
   
   private:
   
     wxList   m_clientData;
   
-  public:
-  
-    bool     m_alreadySent;
 };
 
 #endif // __GTKCOMBOBOXH__
 };
 
 #endif // __GTKCOMBOBOXH__
index a1ce86dfe03f9f5653d6e75f60e51b76e27a0d04..4e9a085d73e614f8bf28be7a69cd7181d16a81d1 100644 (file)
@@ -74,12 +74,8 @@ class wxFont: public wxGDIObject
     bool GetUnderlined(void) const;
 
     wxFont( char *xFontName );
     bool GetUnderlined(void) const;
 
     wxFont( char *xFontName );
-    
-  private:
-  
-    friend wxDC;
-    friend wxPaintDC;
-    friend wxWindow;
+
+  // implementation        
     
     GdkFont* GetInternalFont(float scale = 1.0) const;
 
     
     GdkFont* GetInternalFont(float scale = 1.0) const;
 
index 22cbe344a9d9b2dff0b0f078c67118239d4f11be..44f4d5aa19480a942af60fd3c3ab2a09c517eccb 100644 (file)
@@ -82,6 +82,7 @@ class wxListBox: public wxControl
     void SetSelection( int n, bool select = TRUE );
     void SetString( int n, const wxString &string );
     void SetStringSelection( const wxString &string, bool select = TRUE );
     void SetSelection( int n, bool select = TRUE );
     void SetString( int n, const wxString &string );
     void SetStringSelection( const wxString &string, bool select = TRUE );
+    void SetFont( const wxFont &font );
 
     virtual GtkWidget *GetConnectWidget(void);
   
 
     virtual GtkWidget *GetConnectWidget(void);
   
index 04d5ea8879f9aff33e0fe649c2cce865e761e4dc..443ea706ecb10da4618e91d32cc78f6673b7af1f 100644 (file)
@@ -79,14 +79,16 @@ class wxRadioBox: public wxControl
     virtual int Number(void) const;
     int GetNumberOfRowsOrCols(void) const;
     void SetNumberOfRowsOrCols( int n );
     virtual int Number(void) const;
     int GetNumberOfRowsOrCols(void) const;
     void SetNumberOfRowsOrCols( int n );
+    void SetFont( const wxFont &font );
 
 
+  // implementation    
+    
+    bool            m_alreadySent;
+    
   private:
   
     GtkRadioButton *m_radio;
     
   private:
   
     GtkRadioButton *m_radio;
     
-  public:
-  
-    bool            m_alreadySent;
 };
 
 #endif // __GTKRADIOBOXH__
 };
 
 #endif // __GTKRADIOBOXH__
index 61e7130035bb45c5a4f4d6f2a9cd1ee6ac873f65..3e0705a7a8c45952dd6ee5a6a3707a29f41590fa 100644 (file)
@@ -61,6 +61,7 @@ class wxRadioButton: public wxControl
     virtual void SetLabel(const wxString& label);
     virtual void SetValue(bool val);
     virtual bool GetValue(void) const;
     virtual void SetLabel(const wxString& label);
     virtual void SetValue(bool val);
     virtual bool GetValue(void) const;
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKRADIOBUTTONH__
 };
 
 #endif // __GTKRADIOBUTTONH__
index 034f218b7b78e528e2532b27c4875e4a86e0fae4..e477a54675d87fd5b07b3de81e30e9f666116a96 100644 (file)
@@ -101,6 +101,10 @@ class wxTextCtrl: public wxControl, public streambuf
     wxTextCtrl& operator<<(double d);
     wxTextCtrl& operator<<(const char c);
 
     wxTextCtrl& operator<<(double d);
     wxTextCtrl& operator<<(const char c);
 
+    void SetFont( const wxFont &font );
+    
+  // implementation    
+    
     virtual GtkWidget* GetConnectWidget(void);
     virtual bool IsOwnGtkWindow( GdkWindow *window );
     
     virtual GtkWidget* GetConnectWidget(void);
     virtual bool IsOwnGtkWindow( GdkWindow *window );
     
index 665c3ee0c7dfcd8a157e66a9f8309b8202a99db6..a029a5dc16aff5cbc37cc23d15e68743311c4fc0 100644 (file)
@@ -271,6 +271,7 @@ public:         // cannot get private going yet
   float                m_oldVerticalPos;
   bool                 m_needParent;
   bool                 m_hasScrolling;
   float                m_oldVerticalPos;
   bool                 m_needParent;
   bool                 m_hasScrolling;
+  bool                 m_hasOwnStyle;
   bool                 m_hasVMT;
   bool                 m_sizeSet;
   bool                 m_resizing;
   bool                 m_hasVMT;
   bool                 m_sizeSet;
   bool                 m_resizing;
index 0d5bf16b5cc6fda265f1350b928142ef4e1249c1..bbc5f130e2eb6d248b8ffbb7b4ffa9964f23d547 100644 (file)
@@ -60,6 +60,7 @@ class wxButton: public wxControl
     void SetDefault(void);
     void SetLabel( const wxString &label );
     void Enable( bool enable );
     void SetDefault(void);
     void SetLabel( const wxString &label );
     void Enable( bool enable );
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKBUTTONH__
 };
 
 #endif // __GTKBUTTONH__
index d949234568c5420ed05e255efec165276bfff07f..43327e3f26ec60d6b004a255a376eae7a89257d6 100644 (file)
@@ -59,6 +59,7 @@ class wxCheckBox: public wxControl
            const wxString& name = wxCheckBoxNameStr );
     void SetValue( bool state );
     bool GetValue(void) const;
            const wxString& name = wxCheckBoxNameStr );
     void SetValue( bool state );
     bool GetValue(void) const;
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKCHECKBOXH__
 };
 
 #endif // __GTKCHECKBOXH__
index 36f403bb7414c214b2ea511f00a6627c05ae489f..6849cec905da2b8cd57c863ca3a5659999249b96 100644 (file)
@@ -73,6 +73,7 @@ class wxChoice: public wxControl
     void SetColumns( int n = 1 );
     void SetSelection( int n );
     void SetStringSelection( const wxString &string );
     void SetColumns( int n = 1 );
     void SetSelection( int n );
     void SetStringSelection( const wxString &string );
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKCHOICEH__
 };
 
 #endif // __GTKCHOICEH__
index a0d3c360833a453a751bd0f2daf218c7e0a91cfb..654ae70bfe3424d33211b11599912bde1cda4479 100644 (file)
@@ -64,7 +64,6 @@ class wxComboBox: public wxControl
            const wxValidator& validator = wxDefaultValidator,
            const wxString& name = wxComboBoxNameStr);
 
            const wxValidator& validator = wxDefaultValidator,
            const wxString& name = wxComboBoxNameStr);
 
-  // List functions
   void Clear(void);
   void Append( const wxString &item );
   void Append( const wxString &item, char* clientData );
   void Clear(void);
   void Append( const wxString &item );
   void Append( const wxString &item, char* clientData );
@@ -79,11 +78,9 @@ class wxComboBox: public wxControl
   void SetSelection( int n );
   void SetStringSelection( const wxString &string );
 
   void SetSelection( int n );
   void SetStringSelection( const wxString &string );
 
-  // Text field functions
   wxString GetValue(void) const ;
   void SetValue(const wxString& value);
 
   wxString GetValue(void) const ;
   void SetValue(const wxString& value);
 
-  // Clipboard operations
   void Copy(void);
   void Cut(void);
   void Paste(void);
   void Copy(void);
   void Cut(void);
   void Paste(void);
@@ -95,14 +92,17 @@ class wxComboBox: public wxControl
   void Remove(long from, long to);
   void SetSelection(long from, long to);
   void SetEditable(bool editable);
   void Remove(long from, long to);
   void SetSelection(long from, long to);
   void SetEditable(bool editable);
+  
+  void SetFont( const wxFont &font );
+  
+  // implementation
 
 
+    bool     m_alreadySent;
+    
   private:
   
     wxList   m_clientData;
   
   private:
   
     wxList   m_clientData;
   
-  public:
-  
-    bool     m_alreadySent;
 };
 
 #endif // __GTKCOMBOBOXH__
 };
 
 #endif // __GTKCOMBOBOXH__
index a1ce86dfe03f9f5653d6e75f60e51b76e27a0d04..4e9a085d73e614f8bf28be7a69cd7181d16a81d1 100644 (file)
@@ -74,12 +74,8 @@ class wxFont: public wxGDIObject
     bool GetUnderlined(void) const;
 
     wxFont( char *xFontName );
     bool GetUnderlined(void) const;
 
     wxFont( char *xFontName );
-    
-  private:
-  
-    friend wxDC;
-    friend wxPaintDC;
-    friend wxWindow;
+
+  // implementation        
     
     GdkFont* GetInternalFont(float scale = 1.0) const;
 
     
     GdkFont* GetInternalFont(float scale = 1.0) const;
 
index 22cbe344a9d9b2dff0b0f078c67118239d4f11be..44f4d5aa19480a942af60fd3c3ab2a09c517eccb 100644 (file)
@@ -82,6 +82,7 @@ class wxListBox: public wxControl
     void SetSelection( int n, bool select = TRUE );
     void SetString( int n, const wxString &string );
     void SetStringSelection( const wxString &string, bool select = TRUE );
     void SetSelection( int n, bool select = TRUE );
     void SetString( int n, const wxString &string );
     void SetStringSelection( const wxString &string, bool select = TRUE );
+    void SetFont( const wxFont &font );
 
     virtual GtkWidget *GetConnectWidget(void);
   
 
     virtual GtkWidget *GetConnectWidget(void);
   
index 04d5ea8879f9aff33e0fe649c2cce865e761e4dc..443ea706ecb10da4618e91d32cc78f6673b7af1f 100644 (file)
@@ -79,14 +79,16 @@ class wxRadioBox: public wxControl
     virtual int Number(void) const;
     int GetNumberOfRowsOrCols(void) const;
     void SetNumberOfRowsOrCols( int n );
     virtual int Number(void) const;
     int GetNumberOfRowsOrCols(void) const;
     void SetNumberOfRowsOrCols( int n );
+    void SetFont( const wxFont &font );
 
 
+  // implementation    
+    
+    bool            m_alreadySent;
+    
   private:
   
     GtkRadioButton *m_radio;
     
   private:
   
     GtkRadioButton *m_radio;
     
-  public:
-  
-    bool            m_alreadySent;
 };
 
 #endif // __GTKRADIOBOXH__
 };
 
 #endif // __GTKRADIOBOXH__
index 61e7130035bb45c5a4f4d6f2a9cd1ee6ac873f65..3e0705a7a8c45952dd6ee5a6a3707a29f41590fa 100644 (file)
@@ -61,6 +61,7 @@ class wxRadioButton: public wxControl
     virtual void SetLabel(const wxString& label);
     virtual void SetValue(bool val);
     virtual bool GetValue(void) const;
     virtual void SetLabel(const wxString& label);
     virtual void SetValue(bool val);
     virtual bool GetValue(void) const;
+    void SetFont( const wxFont &font );
 };
 
 #endif // __GTKRADIOBUTTONH__
 };
 
 #endif // __GTKRADIOBUTTONH__
index 034f218b7b78e528e2532b27c4875e4a86e0fae4..e477a54675d87fd5b07b3de81e30e9f666116a96 100644 (file)
@@ -101,6 +101,10 @@ class wxTextCtrl: public wxControl, public streambuf
     wxTextCtrl& operator<<(double d);
     wxTextCtrl& operator<<(const char c);
 
     wxTextCtrl& operator<<(double d);
     wxTextCtrl& operator<<(const char c);
 
+    void SetFont( const wxFont &font );
+    
+  // implementation    
+    
     virtual GtkWidget* GetConnectWidget(void);
     virtual bool IsOwnGtkWindow( GdkWindow *window );
     
     virtual GtkWidget* GetConnectWidget(void);
     virtual bool IsOwnGtkWindow( GdkWindow *window );
     
index 665c3ee0c7dfcd8a157e66a9f8309b8202a99db6..a029a5dc16aff5cbc37cc23d15e68743311c4fc0 100644 (file)
@@ -271,6 +271,7 @@ public:         // cannot get private going yet
   float                m_oldVerticalPos;
   bool                 m_needParent;
   bool                 m_hasScrolling;
   float                m_oldVerticalPos;
   bool                 m_needParent;
   bool                 m_hasScrolling;
+  bool                 m_hasOwnStyle;
   bool                 m_hasVMT;
   bool                 m_sizeSet;
   bool                 m_resizing;
   bool                 m_hasVMT;
   bool                 m_sizeSet;
   bool                 m_resizing;
index 6bb423f803dafb6fa2be35d8484180b03ba7dc2e..385a294f95e3fd44df84bb272e6f6eac1392fa47 100644 (file)
@@ -57,11 +57,13 @@ class MyPanel: public wxPanel
     void OnComboButtons( wxCommandEvent &event );
     void OnRadio( wxCommandEvent &event );
     void OnRadioButtons( wxCommandEvent &event );
     void OnComboButtons( wxCommandEvent &event );
     void OnRadio( wxCommandEvent &event );
     void OnRadioButtons( wxCommandEvent &event );
+    void OnSetFont( wxCommandEvent &event );
     
     wxListBox   *m_listbox;
     wxChoice    *m_choice;
     wxComboBox  *m_combo;
     wxRadioBox  *m_radio;
     
     wxListBox   *m_listbox;
     wxChoice    *m_choice;
     wxComboBox  *m_combo;
     wxRadioBox  *m_radio;
+    wxButton    *m_fontButton;
     
     wxTextCtrl  *m_text;
     wxNotebook  *m_notebook;    
     
     wxTextCtrl  *m_text;
     wxNotebook  *m_notebook;    
@@ -137,6 +139,7 @@ const  ID_LISTBOX_SEL_STR   = 132;
 const  ID_LISTBOX_CLEAR     = 133;
 const  ID_LISTBOX_APPEND    = 134;
 const  ID_LISTBOX_DELETE    = 135;
 const  ID_LISTBOX_CLEAR     = 133;
 const  ID_LISTBOX_APPEND    = 134;
 const  ID_LISTBOX_DELETE    = 135;
+const  ID_LISTBOX_FONT      = 136;
 
 const  ID_CHOICE            = 120;
 const  ID_CHOICE_SEL_NUM    = 121;
 
 const  ID_CHOICE            = 120;
 const  ID_CHOICE_SEL_NUM    = 121;
@@ -144,6 +147,7 @@ const  ID_CHOICE_SEL_STR    = 122;
 const  ID_CHOICE_CLEAR      = 123;
 const  ID_CHOICE_APPEND     = 124;
 const  ID_CHOICE_DELETE     = 125;
 const  ID_CHOICE_CLEAR      = 123;
 const  ID_CHOICE_APPEND     = 124;
 const  ID_CHOICE_DELETE     = 125;
+const  ID_CHOICE_FONT       = 126;
 
 const  ID_COMBO             = 140;
 const  ID_COMBO_SEL_NUM     = 141;
 
 const  ID_COMBO             = 140;
 const  ID_COMBO_SEL_NUM     = 141;
@@ -151,12 +155,16 @@ const  ID_COMBO_SEL_STR     = 142;
 const  ID_COMBO_CLEAR       = 143;
 const  ID_COMBO_APPEND      = 144;
 const  ID_COMBO_DELETE      = 145;
 const  ID_COMBO_CLEAR       = 143;
 const  ID_COMBO_APPEND      = 144;
 const  ID_COMBO_DELETE      = 145;
+const  ID_COMBO_FONT        = 146;
 
 const  ID_TEXT              = 150;
 
 const  ID_RADIOBOX          = 160;
 const  ID_RADIOBOX_SEL_NUM  = 161;
 const  ID_RADIOBOX_SEL_STR  = 162;
 
 const  ID_TEXT              = 150;
 
 const  ID_RADIOBOX          = 160;
 const  ID_RADIOBOX_SEL_NUM  = 161;
 const  ID_RADIOBOX_SEL_STR  = 162;
+const  ID_RADIOBOX_FONT     = 163;
+
+const  ID_SET_FONT          = 170;
 
 BEGIN_EVENT_TABLE(MyPanel, wxPanel)
   EVT_SIZE      (                       MyPanel::OnSize)
 
 BEGIN_EVENT_TABLE(MyPanel, wxPanel)
   EVT_SIZE      (                       MyPanel::OnSize)
@@ -166,21 +174,26 @@ BEGIN_EVENT_TABLE(MyPanel, wxPanel)
   EVT_BUTTON    (ID_LISTBOX_CLEAR,      MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_APPEND,     MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_DELETE,     MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_CLEAR,      MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_APPEND,     MyPanel::OnListBoxButtons)
   EVT_BUTTON    (ID_LISTBOX_DELETE,     MyPanel::OnListBoxButtons)
+  EVT_BUTTON    (ID_LISTBOX_FONT,       MyPanel::OnListBoxButtons)
   EVT_CHOICE    (ID_CHOICE,             MyPanel::OnChoice)
   EVT_BUTTON    (ID_CHOICE_SEL_NUM,     MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_SEL_STR,     MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_CLEAR,       MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_APPEND,      MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_DELETE,      MyPanel::OnChoiceButtons)
   EVT_CHOICE    (ID_CHOICE,             MyPanel::OnChoice)
   EVT_BUTTON    (ID_CHOICE_SEL_NUM,     MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_SEL_STR,     MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_CLEAR,       MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_APPEND,      MyPanel::OnChoiceButtons)
   EVT_BUTTON    (ID_CHOICE_DELETE,      MyPanel::OnChoiceButtons)
+  EVT_BUTTON    (ID_CHOICE_FONT,        MyPanel::OnChoiceButtons)
   EVT_CHOICE    (ID_COMBO,              MyPanel::OnCombo)
   EVT_BUTTON    (ID_COMBO_SEL_NUM,      MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_SEL_STR,      MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_CLEAR,        MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_APPEND,       MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_DELETE,       MyPanel::OnComboButtons)
   EVT_CHOICE    (ID_COMBO,              MyPanel::OnCombo)
   EVT_BUTTON    (ID_COMBO_SEL_NUM,      MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_SEL_STR,      MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_CLEAR,        MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_APPEND,       MyPanel::OnComboButtons)
   EVT_BUTTON    (ID_COMBO_DELETE,       MyPanel::OnComboButtons)
+  EVT_BUTTON    (ID_COMBO_FONT,         MyPanel::OnComboButtons)
   EVT_RADIOBOX  (ID_RADIOBOX,           MyPanel::OnRadio)
   EVT_BUTTON    (ID_RADIOBOX_SEL_NUM,   MyPanel::OnRadioButtons)
   EVT_BUTTON    (ID_RADIOBOX_SEL_STR,   MyPanel::OnRadioButtons)
   EVT_RADIOBOX  (ID_RADIOBOX,           MyPanel::OnRadio)
   EVT_BUTTON    (ID_RADIOBOX_SEL_NUM,   MyPanel::OnRadioButtons)
   EVT_BUTTON    (ID_RADIOBOX_SEL_STR,   MyPanel::OnRadioButtons)
+  EVT_BUTTON    (ID_RADIOBOX_FONT,      MyPanel::OnRadioButtons)
+  EVT_BUTTON    (ID_SET_FONT,           MyPanel::OnSetFont)
 END_EVENT_TABLE()
 
 MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
 END_EVENT_TABLE()
 
 MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
@@ -212,9 +225,15 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   wxASSERT( WXSIZEOF(aIconNames) == Image_Max ); // keep in sync
 
   // fill the image list
   wxASSERT( WXSIZEOF(aIconNames) == Image_Max ); // keep in sync
 
   // fill the image list
+#ifdef __WXMSW__
   wxString strIconDir = "icons/";
   wxString strIconDir = "icons/";
+#else
+  wxString strIconDir = "../icons/";
+#endif
+
   wxImageList *imagelist = new wxImageList(32, 32);
   wxImageList *imagelist = new wxImageList(32, 32);
-  for ( size_t n = 0; n < Image_Max; n++ ) {
+  for ( size_t n = 0; n < Image_Max; n++ ) 
+  {
     imagelist->Add(wxBitmap(strIconDir + aIconNames[n]));
   }
 
     imagelist->Add(wxBitmap(strIconDir + aIconNames[n]));
   }
 
@@ -227,6 +246,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
   (void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_LISTBOX_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
+  (void)new wxButton( panel, ID_LISTBOX_FONT, "Set Italic font", wxPoint(180,180), wxSize(140,30) );
   m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
   
   panel = new wxPanel(m_notebook);
   m_notebook->AddPage(panel, "wxList", FALSE, Image_List);
   
   panel = new wxPanel(m_notebook);
@@ -236,6 +256,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   (void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_CHOICE_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_CHOICE_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
   (void)new wxButton( panel, ID_CHOICE_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_CHOICE_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_CHOICE_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
+  (void)new wxButton( panel, ID_CHOICE_FONT, "Set Italic font", wxPoint(180,180), wxSize(140,30) );
   m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
   
   panel = new wxPanel(m_notebook);
   m_notebook->AddPage(panel, "wxChoice", FALSE, Image_Choice);
   
   panel = new wxPanel(m_notebook);
@@ -245,6 +266,7 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_COMBO_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_COMBO_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
   (void)new wxButton( panel, ID_COMBO_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_COMBO_APPEND, "Append 'Hi!'", wxPoint(300,80), wxSize(100,30) );
   (void)new wxButton( panel, ID_COMBO_DELETE, "Delete selected item", wxPoint(180,130), wxSize(140,30) );
+  (void)new wxButton( panel, ID_COMBO_FONT, "Set Italic font", wxPoint(180,180), wxSize(140,30) );
   m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo);
   
   wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE );
   m_notebook->AddPage(panel, "wxComboBox", FALSE, Image_Combo);
   
   wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE );
@@ -254,6 +276,8 @@ MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
   m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 4, choices );
   (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(200,30), wxSize(100,30) );
   (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(200,80), wxSize(100,30) );
   m_radio = new wxRadioBox( panel, ID_RADIOBOX, "This", wxPoint(10,10), wxSize(-1,-1), 4, choices );
   (void)new wxButton( panel, ID_RADIOBOX_SEL_NUM, "Select #2", wxPoint(200,30), wxSize(100,30) );
   (void)new wxButton( panel, ID_RADIOBOX_SEL_STR, "Select 'This'", wxPoint(200,80), wxSize(100,30) );
+  (void)new wxButton( panel, ID_RADIOBOX_FONT, "Set Italic font", wxPoint(200,130), wxSize(160,30) );
+  m_fontButton = new wxButton( panel, ID_SET_FONT, "Set more Italic font", wxPoint(200,180), wxSize(160,30) );
   m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio);
 }
 
   m_notebook->AddPage(panel, "wxRadioBox", FALSE, Image_Radio);
 }
 
@@ -304,6 +328,11 @@ void MyPanel::OnListBoxButtons( wxCommandEvent &event )
       m_listbox->Delete( idx );
       break;
     }
       m_listbox->Delete( idx );
       break;
     }
+    case ID_LISTBOX_FONT:
+    {
+      m_listbox->SetFont( *wxITALIC_FONT );
+      break;
+    }
   }
 }
 
   }
 }
 
@@ -344,6 +373,11 @@ void MyPanel::OnChoiceButtons( wxCommandEvent &event )
       m_choice->Delete( idx );
       break;
     }
       m_choice->Delete( idx );
       break;
     }
+    case ID_CHOICE_FONT:
+    {
+      m_choice->SetFont( *wxITALIC_FONT );
+      break;
+    }
   }
 }
 
   }
 }
 
@@ -384,6 +418,11 @@ void MyPanel::OnComboButtons( wxCommandEvent &event )
       m_combo->Delete( idx );
       break;
     }
       m_combo->Delete( idx );
       break;
     }
+    case ID_COMBO_FONT:
+    {
+      m_combo->SetFont( *wxITALIC_FONT );
+      break;
+    }
   }
 }
 
   }
 }
 
@@ -408,9 +447,20 @@ void MyPanel::OnRadioButtons( wxCommandEvent &event )
       m_radio->SetStringSelection( "This" );
       break;
     }
       m_radio->SetStringSelection( "This" );
       break;
     }
+    case ID_RADIOBOX_FONT:
+    {
+      m_radio->SetFont( *wxITALIC_FONT );
+      break;
+    }
   }
 }
 
   }
 }
 
+void MyPanel::OnSetFont( wxCommandEvent &WXUNUSED(event) )
+{
+  m_fontButton->SetFont( *wxITALIC_FONT );
+  m_text->SetFont( *wxITALIC_FONT );
+}
+
 MyPanel::~MyPanel()
 {
   delete m_notebook->GetImageList();
 MyPanel::~MyPanel()
 {
   delete m_notebook->GetImageList();
index 1bd096b08452609382bc97edca8b18e5d93847d1..f10b170beffa6bc9549f9a9868a7d6cd5c7a6b76 100644 (file)
@@ -103,3 +103,26 @@ void wxButton::Enable( bool enable )
   gtk_widget_set_sensitive( label, enable );
 }
 
   gtk_widget_set_sensitive( label, enable );
 }
 
+void wxButton::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkWidget *label = bin->child;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( label ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( label );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( label, style );
+}
index 43e7b354b04242aeeaa299764772fe676ca9db66..2604d6d360bf30ca0731abb153c6bff65057f638 100644 (file)
@@ -89,3 +89,26 @@ bool wxCheckBox::GetValue(void) const
   return tb->active;
 }
 
   return tb->active;
 }
 
+void wxCheckBox::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkWidget *label = bin->child;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( label ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( label );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( label, style );
+}
index c449debef2a2c86e219dab143e29bd5d4a638f52..edcf64f3e96fbae595f4b3cd0e63d15ee8995a7d 100644 (file)
@@ -92,8 +92,18 @@ void wxChoice::Append( const wxString &item )
   GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
   GtkWidget *menu_item;
   menu_item = gtk_menu_item_new_with_label( item );
   GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
   GtkWidget *menu_item;
   menu_item = gtk_menu_item_new_with_label( item );
+  
+  if (m_hasOwnStyle)
+  {
+    GtkBin *bin = GTK_BIN( menu_item );
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+  }
+  
   gtk_signal_connect( GTK_OBJECT( menu_item ), "activate", 
     GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
   gtk_signal_connect( GTK_OBJECT( menu_item ), "activate", 
     GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
+    
   gtk_menu_append( GTK_MENU(menu), menu_item );
   gtk_widget_show( menu_item );
 }
   gtk_menu_append( GTK_MENU(menu), menu_item );
   gtk_widget_show( menu_item );
 }
@@ -123,10 +133,10 @@ int wxChoice::FindString( const wxString &string ) const
     GtkBin *bin = GTK_BIN( child->data );
     GtkLabel *label = (GtkLabel *) NULL;
     if (bin->child) label = GTK_LABEL(bin->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 (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
     if (string == label->label) return count;
     child = child->next;
     count++;
     if (string == label->label) return count;
     child = child->next;
     count++;
@@ -172,10 +182,10 @@ wxString wxChoice::GetString( int n ) const
     {
       GtkLabel *label = (GtkLabel *) NULL;
       if (bin->child) label = GTK_LABEL(bin->child);
     {
       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 (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
       return label->label;
     }
     child = child->next;
       return label->label;
     }
     child = child->next;
@@ -227,3 +237,23 @@ void wxChoice::SetStringSelection( const wxString &string )
   if (n != -1) SetSelection( n );
 }
 
   if (n != -1) SetSelection( n );
 }
 
+void wxChoice::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
+  GList *child = menu_shell->children;
+  while (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,
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+       
+    child = child->next;
+  }
+}
index 196b32a371fda4dc4efba7d3a63a61214fdc6ec9..b6c401e8e102602d2e29e37b0d67599a1bbbc576 100644 (file)
@@ -136,8 +136,15 @@ void wxComboBox::Append( const wxString &item, char *clientData )
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   
-  GtkWidget *list_item;
-  list_item = gtk_list_item_new_with_label( item ); 
+  GtkWidget *list_item = gtk_list_item_new_with_label( item ); 
+  
+  if (m_hasOwnStyle)
+  {
+    GtkBin *bin = GTK_BIN( list_item );
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+  }
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
@@ -374,4 +381,27 @@ void wxComboBox::SetEditable( bool WXUNUSED(editable) )
 {
 }
 
 {
 }
 
+void wxComboBox::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GtkWidget *entry = GTK_COMBO(m_widget)->entry;
+  
+  gtk_widget_set_style( entry,
+    gtk_style_ref(
+      gtk_widget_get_style( m_widget ) ) ); 
+  
+  GtkWidget *list = GTK_COMBO(m_widget)->list;
+  
+  GList *child = GTK_LIST(list)->children;
+  while (child)
+  {
+    GtkBin *bin = (GtkBin*) child->data;
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+        
+    child = child->next;
+  }
+}
       
       
index 916d8490ada206c340b12d5d0ab9fbaa68eecdd5..b00f00aae13930fd0af3e32eed547ebb348b8268 100644 (file)
@@ -130,8 +130,15 @@ void wxListBox::Append( const wxString &item )
 
 void wxListBox::Append( const wxString &item, char *clientData )
 {
 
 void wxListBox::Append( const wxString &item, char *clientData )
 {
-  GtkWidget *list_item;
-  list_item = gtk_list_item_new_with_label( item ); 
+  GtkWidget *list_item = gtk_list_item_new_with_label( item ); 
+  
+  if (m_hasOwnStyle)
+  {
+    GtkBin *bin = GTK_BIN( list_item );
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+  }
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
@@ -230,7 +237,8 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
   // get the number of selected items first
   GList *child = m_list->children;
   int count = 0;
   // get the number of selected items first
   GList *child = m_list->children;
   int count = 0;
-  for ( child = m_list->children; child != NULL; child = child->next ) {
+  for ( child = m_list->children; child != NULL; child = child->next ) 
+  {
     if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
       count++;
   }
     if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
       count++;
   }
@@ -241,7 +249,8 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
     // now fill the list
     aSelections.Alloc(count); // optimization attempt
     int i = 0;
     // now fill the list
     aSelections.Alloc(count); // optimization attempt
     int i = 0;
-    for ( child = m_list->children; child != NULL; child = child->next, i++ ) {
+    for ( child = m_list->children; child != NULL; child = child->next, i++ ) 
+    {
       if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
         aSelections.Add(i);
     }
       if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
         aSelections.Add(i);
     }
@@ -377,5 +386,19 @@ GtkWidget *wxListBox::GetConnectWidget(void)
   return GTK_WIDGET(m_list);
 }
 
   return GTK_WIDGET(m_list);
 }
 
+void wxListBox::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GList *child = m_list->children;
+  while (child)
+  {
+    GtkBin *bin = (GtkBin*) child->data;
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+    child = child->next;
+  }
+}
 
 
 
 
index c8120af62416e6a9b2a5ebe05101ec56f9730120..b42b2e82e0dd259760fa62b37f66c0aa133e541e 100644 (file)
@@ -279,3 +279,19 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
   wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
 }
 
   wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
 }
 
+void wxRadioBox::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GSList *item = gtk_radio_button_group( m_radio );
+  while (item)
+  {
+    GtkButton *button = GTK_BUTTON( item->data );
+    
+    gtk_widget_set_style( button->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+    
+    item = item->next;
+  }
+}
index 321210ec3da6d40f00c5734d65965ec5cb31ebac..a0e789bcbd65814a3fedd275062779d76e430941 100644 (file)
@@ -86,4 +86,27 @@ bool wxRadioButton::GetValue(void) const
   return GTK_TOGGLE_BUTTON(m_widget)->active;
 }
 
   return GTK_TOGGLE_BUTTON(m_widget)->active;
 }
 
+void wxRadioButton::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkWidget *label = bin->child;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( label ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( label );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( label, style );
+}
 
 
index 5d5b5056b3d91add0c23a2dc502ed1adf03d0fbc..f5e26432872a40710706cc4c0cd03844bdad5978 100644 (file)
@@ -429,5 +429,25 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
     return (window == GTK_ENTRY(m_text)->text_area);
 }
 
     return (window == GTK_ENTRY(m_text)->text_area);
 }
 
+void wxTextCtrl::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( m_text ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( m_text );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( m_text, style );
+}
 
 
 
 
index 2ca9ce464edd47da294df82bc60f6646f38796d0..4a17f081c138bd57cb89810fad7ec0361b3d0290 100644 (file)
 #include "wx/gtk/win_gtk.h"
 #include "gdk/gdkprivate.h"
 
 #include "wx/gtk/win_gtk.h"
 #include "gdk/gdkprivate.h"
 
+//-----------------------------------------------------------------------------
+// documentation on internals
+//-----------------------------------------------------------------------------
+
+/*
+   I have been asked several times about writing some documentation about
+   the GTK port of wxWindows, especially its internal structures. Obviously,
+   you cannot understand wxGTK without knowing a little about the GTK, but
+   some more information about what the wxWindow, which is the base class 
+   for all other window classes, does seems required as well.
+   
+   What does wxWindow do? It contains the common interface for the following
+   jobs of its descentants:
+   
+   1) Define the rudimentary behaviour common to all window classes, such as
+   resizing, intercepting user input so as to make it possible to use these
+   events for special purposes in a derived class, window names etc.
+
+   2) Provide the possibility to contain and manage children, if the derived
+   class is allowed to contain children, which holds true for those window
+   classes, which do not display a native GTK widget. To name them, these
+   classes are wxPanel, wxScrolledWindow, wxDialog, wxFrame. The MDI frame-
+   work classes are a special case and are handled a bit differently from 
+   the rest.
+   
+   3) Provide the possibility to draw into a client area of a window. This,
+   too, only holds true for classes that do not display a native GTK widget
+   as above.
+   
+   4) Provide the entire mechanism for scrolling widgets. This actaul inter-
+   face for this is usually in wxScrolledWidget, but the GTK implementation
+   is in this class.
+   
+   5) A multitude of helper or extra methods for special purposes, such as
+   Drag'n'Drop, managing validators etc.
+   
+   Normally one might expect, that one wxWindows class would always contain
+   one GTK widget. Under GTK, there is no such allround widget that has all
+   the functionality. Moreover, the GTK defines a client area as a different
+   widget from the actual widget you are handling. Last but not least some
+   special classes (e.g. wxFrame) handle different categories of widgets and
+   still have the possibility to draw something in the client area.
+   It was therefore required to write a special purpose GTK widget, that would
+   represent a client area in the sense of wxWindows capable to do the jobs
+   2), 3) and 4). I have written this class and it resides in win_gtk.c of
+   this directory.
+   
+   All windows must have a widget, with which they interact with other under-
+   lying GTK widget. It is this widget, e.g. that has to be resized etc and
+   thw wxWindow class has a member variable called m_widget which holds a
+   pointer to this widget. When the window class displays a GTK native widget,
+   this is the only GTK widget the class manages. When the class has a client
+   area for drawing into and for containing children it must have at least
+   one more GTK widget to handle (of the type GtkMyFixed, defined in win_gtk.c),
+   but there can be any number of widgets, handled by a class (e.g. the frame
+   class handles three). The common rule for all windows is only, that the
+   widget that interacts with the rest of GTK must be referenced in m_widget
+   and all other widgets must be children of this widget on the GTK level.
+   The top-most widget, which also represents the client area, must be in
+   the m_wxwindow field and must be of the type GtkMyFixed.
+   
+   As I said, the window classes that display a GTK native widget only have
+   one widget, so in the case of e.g. the wxButton class m_widget holds a
+   pointer to a GtkButton widget. But windows with client areas (for drawing
+   and children) have a m_widget field that is a pointer to a GtkScrolled-
+   Window and a m_wxwindow field that is pointer to a GtkMyFixed and this
+   one is (in the GTK sense) a child of the GtkScrolledWindow.
+   
+   If the m_wxwindow field is set, then all input to this widget is inter-
+   cepted and sent to the wxWindows class. If not, all input to the widget
+   that gets pointed to by m_widget gets intercepted and sent to the class.
+
+*/
+
 //-----------------------------------------------------------------------------
 // data
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // data
 //-----------------------------------------------------------------------------
@@ -753,6 +827,7 @@ wxWindow::wxWindow()
   m_isEnabled = TRUE;
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
   m_isEnabled = TRUE;
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
+  m_hasOwnStyle = FALSE;
 }
 
 bool wxWindow::Create( wxWindow *parent, wxWindowID id,
 }
 
 bool wxWindow::Create( wxWindow *parent, wxWindowID id,
@@ -937,6 +1012,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
   m_windowValidator = (wxValidator *) NULL;
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
   m_windowValidator = (wxValidator *) NULL;
+  m_hasOwnStyle = FALSE;
 }
 
 void wxWindow::PostCreation(void)
 }
 
 void wxWindow::PostCreation(void)
@@ -1851,15 +1927,21 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
 void wxWindow::SetFont( const wxFont &font )
 {
   m_font = font;
 void wxWindow::SetFont( const wxFont &font )
 {
   m_font = font;
-/*
-  create new style
-  copy old style values to new one
-  set font in new style
-  -> takes to many resources
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( m_widget );
+  }
   
   
-  GtkStyle *style = gtk_style_new();
-  ...
-*/
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( m_widget, style );
 }
 
 wxFont *wxWindow::GetFont(void)
 }
 
 wxFont *wxWindow::GetFont(void)
index 1bd096b08452609382bc97edca8b18e5d93847d1..f10b170beffa6bc9549f9a9868a7d6cd5c7a6b76 100644 (file)
@@ -103,3 +103,26 @@ void wxButton::Enable( bool enable )
   gtk_widget_set_sensitive( label, enable );
 }
 
   gtk_widget_set_sensitive( label, enable );
 }
 
+void wxButton::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkWidget *label = bin->child;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( label ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( label );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( label, style );
+}
index 43e7b354b04242aeeaa299764772fe676ca9db66..2604d6d360bf30ca0731abb153c6bff65057f638 100644 (file)
@@ -89,3 +89,26 @@ bool wxCheckBox::GetValue(void) const
   return tb->active;
 }
 
   return tb->active;
 }
 
+void wxCheckBox::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkWidget *label = bin->child;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( label ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( label );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( label, style );
+}
index c449debef2a2c86e219dab143e29bd5d4a638f52..edcf64f3e96fbae595f4b3cd0e63d15ee8995a7d 100644 (file)
@@ -92,8 +92,18 @@ void wxChoice::Append( const wxString &item )
   GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
   GtkWidget *menu_item;
   menu_item = gtk_menu_item_new_with_label( item );
   GtkWidget *menu = gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) );
   GtkWidget *menu_item;
   menu_item = gtk_menu_item_new_with_label( item );
+  
+  if (m_hasOwnStyle)
+  {
+    GtkBin *bin = GTK_BIN( menu_item );
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+  }
+  
   gtk_signal_connect( GTK_OBJECT( menu_item ), "activate", 
     GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
   gtk_signal_connect( GTK_OBJECT( menu_item ), "activate", 
     GTK_SIGNAL_FUNC(gtk_choice_clicked_callback), (gpointer*)this );
+    
   gtk_menu_append( GTK_MENU(menu), menu_item );
   gtk_widget_show( menu_item );
 }
   gtk_menu_append( GTK_MENU(menu), menu_item );
   gtk_widget_show( menu_item );
 }
@@ -123,10 +133,10 @@ int wxChoice::FindString( const wxString &string ) const
     GtkBin *bin = GTK_BIN( child->data );
     GtkLabel *label = (GtkLabel *) NULL;
     if (bin->child) label = GTK_LABEL(bin->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 (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
     if (string == label->label) return count;
     child = child->next;
     count++;
     if (string == label->label) return count;
     child = child->next;
     count++;
@@ -172,10 +182,10 @@ wxString wxChoice::GetString( int n ) const
     {
       GtkLabel *label = (GtkLabel *) NULL;
       if (bin->child) label = GTK_LABEL(bin->child);
     {
       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 (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
       return label->label;
     }
     child = child->next;
       return label->label;
     }
     child = child->next;
@@ -227,3 +237,23 @@ void wxChoice::SetStringSelection( const wxString &string )
   if (n != -1) SetSelection( n );
 }
 
   if (n != -1) SetSelection( n );
 }
 
+void wxChoice::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GtkMenuShell *menu_shell = GTK_MENU_SHELL( gtk_option_menu_get_menu( GTK_OPTION_MENU(m_widget) ) );
+  GList *child = menu_shell->children;
+  while (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,
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+       
+    child = child->next;
+  }
+}
index 196b32a371fda4dc4efba7d3a63a61214fdc6ec9..b6c401e8e102602d2e29e37b0d67599a1bbbc576 100644 (file)
@@ -136,8 +136,15 @@ void wxComboBox::Append( const wxString &item, char *clientData )
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   
 {
   GtkWidget *list = GTK_COMBO(m_widget)->list;
   
-  GtkWidget *list_item;
-  list_item = gtk_list_item_new_with_label( item ); 
+  GtkWidget *list_item = gtk_list_item_new_with_label( item ); 
+  
+  if (m_hasOwnStyle)
+  {
+    GtkBin *bin = GTK_BIN( list_item );
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+  }
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
@@ -374,4 +381,27 @@ void wxComboBox::SetEditable( bool WXUNUSED(editable) )
 {
 }
 
 {
 }
 
+void wxComboBox::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GtkWidget *entry = GTK_COMBO(m_widget)->entry;
+  
+  gtk_widget_set_style( entry,
+    gtk_style_ref(
+      gtk_widget_get_style( m_widget ) ) ); 
+  
+  GtkWidget *list = GTK_COMBO(m_widget)->list;
+  
+  GList *child = GTK_LIST(list)->children;
+  while (child)
+  {
+    GtkBin *bin = (GtkBin*) child->data;
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+        
+    child = child->next;
+  }
+}
       
       
index 916d8490ada206c340b12d5d0ab9fbaa68eecdd5..b00f00aae13930fd0af3e32eed547ebb348b8268 100644 (file)
@@ -130,8 +130,15 @@ void wxListBox::Append( const wxString &item )
 
 void wxListBox::Append( const wxString &item, char *clientData )
 {
 
 void wxListBox::Append( const wxString &item, char *clientData )
 {
-  GtkWidget *list_item;
-  list_item = gtk_list_item_new_with_label( item ); 
+  GtkWidget *list_item = gtk_list_item_new_with_label( item ); 
+  
+  if (m_hasOwnStyle)
+  {
+    GtkBin *bin = GTK_BIN( list_item );
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+  }
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
   
   gtk_signal_connect( GTK_OBJECT(list_item), "select", 
     GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
@@ -230,7 +237,8 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
   // get the number of selected items first
   GList *child = m_list->children;
   int count = 0;
   // get the number of selected items first
   GList *child = m_list->children;
   int count = 0;
-  for ( child = m_list->children; child != NULL; child = child->next ) {
+  for ( child = m_list->children; child != NULL; child = child->next ) 
+  {
     if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
       count++;
   }
     if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
       count++;
   }
@@ -241,7 +249,8 @@ int wxListBox::GetSelections(wxArrayInt& aSelections) const
     // now fill the list
     aSelections.Alloc(count); // optimization attempt
     int i = 0;
     // now fill the list
     aSelections.Alloc(count); // optimization attempt
     int i = 0;
-    for ( child = m_list->children; child != NULL; child = child->next, i++ ) {
+    for ( child = m_list->children; child != NULL; child = child->next, i++ ) 
+    {
       if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
         aSelections.Add(i);
     }
       if ( GTK_WIDGET(child->data)->state == GTK_STATE_SELECTED ) 
         aSelections.Add(i);
     }
@@ -377,5 +386,19 @@ GtkWidget *wxListBox::GetConnectWidget(void)
   return GTK_WIDGET(m_list);
 }
 
   return GTK_WIDGET(m_list);
 }
 
+void wxListBox::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GList *child = m_list->children;
+  while (child)
+  {
+    GtkBin *bin = (GtkBin*) child->data;
+    gtk_widget_set_style( bin->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+    child = child->next;
+  }
+}
 
 
 
 
index c8120af62416e6a9b2a5ebe05101ec56f9730120..b42b2e82e0dd259760fa62b37f66c0aa133e541e 100644 (file)
@@ -279,3 +279,19 @@ void wxRadioBox::SetNumberOfRowsOrCols( int WXUNUSED(n) )
   wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
 }
 
   wxFAIL_MSG("wxRadioBox::SetNumberOfRowsOrCols not implemented.");
 }
 
+void wxRadioBox::SetFont( const wxFont &font )
+{
+  wxWindow::SetFont( font );
+   
+  GSList *item = gtk_radio_button_group( m_radio );
+  while (item)
+  {
+    GtkButton *button = GTK_BUTTON( item->data );
+    
+    gtk_widget_set_style( button->child, 
+      gtk_style_ref(
+        gtk_widget_get_style( m_widget ) ) ); 
+    
+    item = item->next;
+  }
+}
index 321210ec3da6d40f00c5734d65965ec5cb31ebac..a0e789bcbd65814a3fedd275062779d76e430941 100644 (file)
@@ -86,4 +86,27 @@ bool wxRadioButton::GetValue(void) const
   return GTK_TOGGLE_BUTTON(m_widget)->active;
 }
 
   return GTK_TOGGLE_BUTTON(m_widget)->active;
 }
 
+void wxRadioButton::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkButton *bin = GTK_BUTTON( m_widget );
+  GtkWidget *label = bin->child;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( label ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( label );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( label, style );
+}
 
 
index 5d5b5056b3d91add0c23a2dc502ed1adf03d0fbc..f5e26432872a40710706cc4c0cd03844bdad5978 100644 (file)
@@ -429,5 +429,25 @@ bool wxTextCtrl::IsOwnGtkWindow( GdkWindow *window )
     return (window == GTK_ENTRY(m_text)->text_area);
 }
 
     return (window == GTK_ENTRY(m_text)->text_area);
 }
 
+void wxTextCtrl::SetFont( const wxFont &font )
+{
+  m_font = font;
+  
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( m_text ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( m_text );
+  }
+  
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( m_text, style );
+}
 
 
 
 
index 2ca9ce464edd47da294df82bc60f6646f38796d0..4a17f081c138bd57cb89810fad7ec0361b3d0290 100644 (file)
 #include "wx/gtk/win_gtk.h"
 #include "gdk/gdkprivate.h"
 
 #include "wx/gtk/win_gtk.h"
 #include "gdk/gdkprivate.h"
 
+//-----------------------------------------------------------------------------
+// documentation on internals
+//-----------------------------------------------------------------------------
+
+/*
+   I have been asked several times about writing some documentation about
+   the GTK port of wxWindows, especially its internal structures. Obviously,
+   you cannot understand wxGTK without knowing a little about the GTK, but
+   some more information about what the wxWindow, which is the base class 
+   for all other window classes, does seems required as well.
+   
+   What does wxWindow do? It contains the common interface for the following
+   jobs of its descentants:
+   
+   1) Define the rudimentary behaviour common to all window classes, such as
+   resizing, intercepting user input so as to make it possible to use these
+   events for special purposes in a derived class, window names etc.
+
+   2) Provide the possibility to contain and manage children, if the derived
+   class is allowed to contain children, which holds true for those window
+   classes, which do not display a native GTK widget. To name them, these
+   classes are wxPanel, wxScrolledWindow, wxDialog, wxFrame. The MDI frame-
+   work classes are a special case and are handled a bit differently from 
+   the rest.
+   
+   3) Provide the possibility to draw into a client area of a window. This,
+   too, only holds true for classes that do not display a native GTK widget
+   as above.
+   
+   4) Provide the entire mechanism for scrolling widgets. This actaul inter-
+   face for this is usually in wxScrolledWidget, but the GTK implementation
+   is in this class.
+   
+   5) A multitude of helper or extra methods for special purposes, such as
+   Drag'n'Drop, managing validators etc.
+   
+   Normally one might expect, that one wxWindows class would always contain
+   one GTK widget. Under GTK, there is no such allround widget that has all
+   the functionality. Moreover, the GTK defines a client area as a different
+   widget from the actual widget you are handling. Last but not least some
+   special classes (e.g. wxFrame) handle different categories of widgets and
+   still have the possibility to draw something in the client area.
+   It was therefore required to write a special purpose GTK widget, that would
+   represent a client area in the sense of wxWindows capable to do the jobs
+   2), 3) and 4). I have written this class and it resides in win_gtk.c of
+   this directory.
+   
+   All windows must have a widget, with which they interact with other under-
+   lying GTK widget. It is this widget, e.g. that has to be resized etc and
+   thw wxWindow class has a member variable called m_widget which holds a
+   pointer to this widget. When the window class displays a GTK native widget,
+   this is the only GTK widget the class manages. When the class has a client
+   area for drawing into and for containing children it must have at least
+   one more GTK widget to handle (of the type GtkMyFixed, defined in win_gtk.c),
+   but there can be any number of widgets, handled by a class (e.g. the frame
+   class handles three). The common rule for all windows is only, that the
+   widget that interacts with the rest of GTK must be referenced in m_widget
+   and all other widgets must be children of this widget on the GTK level.
+   The top-most widget, which also represents the client area, must be in
+   the m_wxwindow field and must be of the type GtkMyFixed.
+   
+   As I said, the window classes that display a GTK native widget only have
+   one widget, so in the case of e.g. the wxButton class m_widget holds a
+   pointer to a GtkButton widget. But windows with client areas (for drawing
+   and children) have a m_widget field that is a pointer to a GtkScrolled-
+   Window and a m_wxwindow field that is pointer to a GtkMyFixed and this
+   one is (in the GTK sense) a child of the GtkScrolledWindow.
+   
+   If the m_wxwindow field is set, then all input to this widget is inter-
+   cepted and sent to the wxWindows class. If not, all input to the widget
+   that gets pointed to by m_widget gets intercepted and sent to the class.
+
+*/
+
 //-----------------------------------------------------------------------------
 // data
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // data
 //-----------------------------------------------------------------------------
@@ -753,6 +827,7 @@ wxWindow::wxWindow()
   m_isEnabled = TRUE;
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
   m_isEnabled = TRUE;
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
+  m_hasOwnStyle = FALSE;
 }
 
 bool wxWindow::Create( wxWindow *parent, wxWindowID id,
 }
 
 bool wxWindow::Create( wxWindow *parent, wxWindowID id,
@@ -937,6 +1012,7 @@ void wxWindow::PreCreation( wxWindow *parent, wxWindowID id,
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
   m_windowValidator = (wxValidator *) NULL;
   m_pDropTarget = (wxDropTarget *) NULL;
   m_resizing = FALSE;
   m_windowValidator = (wxValidator *) NULL;
+  m_hasOwnStyle = FALSE;
 }
 
 void wxWindow::PostCreation(void)
 }
 
 void wxWindow::PostCreation(void)
@@ -1851,15 +1927,21 @@ bool wxWindow::IsOwnGtkWindow( GdkWindow *window )
 void wxWindow::SetFont( const wxFont &font )
 {
   m_font = font;
 void wxWindow::SetFont( const wxFont &font )
 {
   m_font = font;
-/*
-  create new style
-  copy old style values to new one
-  set font in new style
-  -> takes to many resources
+  GtkStyle *style = (GtkStyle*) NULL;
+  if (!m_hasOwnStyle)
+  {
+    m_hasOwnStyle = TRUE;
+    style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
+  }
+  else
+  {
+    style = gtk_widget_get_style( m_widget );
+  }
   
   
-  GtkStyle *style = gtk_style_new();
-  ...
-*/
+  gdk_font_unref( style->font );
+  style->font = gdk_font_ref( m_font.GetInternalFont( 1.0 ) );
+  
+  gtk_widget_set_style( m_widget, style );
 }
 
 wxFont *wxWindow::GetFont(void)
 }
 
 wxFont *wxWindow::GetFont(void)