wxString GetStringSelection(void) const;
int Number(void) const;
void SetSelection( int n );
+ void SetStringSelection( const wxString &string );
// Text field functions
wxString GetValue(void) const ;
private:
- wxList m_clientData;
-
+ wxList m_clientData;
+
+ public:
+
+ bool m_alreadySent;
};
#endif // __GTKCOMBOBOXH__
GtkRadioButton *m_radio;
+ public:
+
+ bool m_alreadySent;
};
#endif // __GTKRADIOBOXH__
wxString GetStringSelection(void) const;
int Number(void) const;
void SetSelection( int n );
+ void SetStringSelection( const wxString &string );
// Text field functions
wxString GetValue(void) const ;
private:
- wxList m_clientData;
-
+ wxList m_clientData;
+
+ public:
+
+ bool m_alreadySent;
};
#endif // __GTKCOMBOBOXH__
GtkRadioButton *m_radio;
+ public:
+
+ bool m_alreadySent;
};
#endif // __GTKRADIOBOXH__
#include "wx/notebook.h"
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
//----------------------------------------------------------------------
// class definitions
//----------------------------------------------------------------------
void OnSize( wxSizeEvent& event );
void OnListBox( wxCommandEvent &event );
void OnListBoxButtons( wxCommandEvent &event );
+ void OnChoice( wxCommandEvent &event );
+ void OnChoiceButtons( wxCommandEvent &event );
+ void OnCombo( wxCommandEvent &event );
+ void OnComboButtons( wxCommandEvent &event );
+ void OnRadio( wxCommandEvent &event );
+ void OnRadioButtons( wxCommandEvent &event );
wxListBox *m_listbox;
wxChoice *m_choice;
wxComboBox *m_combo;
+ wxRadioBox *m_radio;
wxTextCtrl *m_text;
wxNotebook *m_notebook;
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+ frame->SetIcon(wxIcon( mondrian_xpm ));
#endif
wxMenu *file_menu = new wxMenu;
const ID_CHOICE_APPEND = 124;
const ID_COMBO = 140;
+const ID_COMBO_SEL_NUM = 141;
+const ID_COMBO_SEL_STR = 142;
+const ID_COMBO_CLEAR = 143;
+const ID_COMBO_APPEND = 144;
const ID_TEXT = 150;
+const ID_RADIOBOX = 160;
+const ID_RADIOBOX_SEL_NUM = 161;
+const ID_RADIOBOX_SEL_STR = 162;
+
BEGIN_EVENT_TABLE(MyPanel, wxPanel)
EVT_SIZE ( MyPanel::OnSize)
EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox)
EVT_BUTTON (ID_LISTBOX_SEL_STR, MyPanel::OnListBoxButtons)
EVT_BUTTON (ID_LISTBOX_CLEAR, MyPanel::OnListBoxButtons)
EVT_BUTTON (ID_LISTBOX_APPEND, 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_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_RADIOBOX (ID_RADIOBOX, MyPanel::OnRadio)
+ EVT_BUTTON (ID_RADIOBOX_SEL_NUM, MyPanel::OnRadioButtons)
+ EVT_BUTTON (ID_RADIOBOX_SEL_STR, MyPanel::OnRadioButtons)
END_EVENT_TABLE()
MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) :
wxString choices[] =
{
"This",
- "is",
- "a",
- "wonderfull example.",
- "Or",
- "what",
- "do",
- "you",
- "think?"
+ "is a",
+ "wonderfull",
+ "example.",
};
wxPanel *panel = new wxPanel(m_notebook);
- m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 9, choices );
+ m_listbox = new wxListBox( panel, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 4, choices );
(void)new wxButton( panel, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(100,30) );
(void)new wxButton( panel, ID_LISTBOX_SEL_STR, "Select 'This'", wxPoint(300,30), wxSize(100,30) );
(void)new wxButton( panel, ID_LISTBOX_CLEAR, "Clear", wxPoint(180,80), wxSize(100,30) );
m_notebook->AddPage(panel, "wxList");
panel = new wxPanel(m_notebook);
- m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 9, choices );
+ m_choice = new wxChoice( panel, ID_CHOICE, wxPoint(10,10), wxSize(120,-1), 4, choices );
+ (void)new wxButton( panel, ID_CHOICE_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(100,30) );
+ (void)new wxButton( panel, ID_CHOICE_SEL_STR, "Select 'This'", wxPoint(300,30), wxSize(100,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) );
m_notebook->AddPage(panel, "wxChoice");
panel = new wxPanel(m_notebook);
- m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(120,-1), 9, choices );
+ m_combo = new wxComboBox( panel, ID_COMBO, "This", wxPoint(10,10), wxSize(170,-1), 4, choices );
+ (void)new wxButton( panel, ID_COMBO_SEL_NUM, "Select #2", wxPoint(180,30), wxSize(100,30) );
+ (void)new wxButton( panel, ID_COMBO_SEL_STR, "Select 'This'", wxPoint(300,30), wxSize(100,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) );
m_notebook->AddPage(panel, "wxComboBox");
wxTextCtrl *text = new wxTextCtrl( m_notebook, ID_TEXT, "Write text here.", wxPoint(10,10), wxSize(120,100), wxTE_MULTILINE );
m_notebook->AddPage( text, "wxTextCtrl" );
+
+ panel = new wxPanel(m_notebook);
+ 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_notebook->AddPage(panel, "wxRadioBox");
}
void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) )
void MyPanel::OnListBox( wxCommandEvent &event )
{
- m_text->WriteText( "ListBox Event:\n");
m_text->WriteText( "ListBox selection string is: " );
m_text->WriteText( event.GetString() );
m_text->WriteText( "\n" );
}
-void MyPanel::OnListBoxButtons( wxCommandEvent &WXUNUSED(event) )
+void MyPanel::OnListBoxButtons( wxCommandEvent &event )
+{
+ switch (event.GetId())
+ {
+ case ID_LISTBOX_SEL_NUM:
+ {
+ m_listbox->SetSelection( 2 );
+ break;
+ }
+ case ID_LISTBOX_SEL_STR:
+ {
+ m_listbox->SetStringSelection( "This" );
+ break;
+ }
+ case ID_LISTBOX_CLEAR:
+ {
+ m_listbox->Clear();
+ break;
+ }
+ case ID_LISTBOX_APPEND:
+ {
+ m_listbox->Append( "Hi!" );
+ break;
+ }
+ }
+}
+
+void MyPanel::OnChoice( wxCommandEvent &event )
+{
+ m_text->WriteText( "Choice selection string is: " );
+ m_text->WriteText( event.GetString() );
+ m_text->WriteText( "\n" );
+}
+
+void MyPanel::OnChoiceButtons( wxCommandEvent &event )
+{
+ switch (event.GetId())
+ {
+ case ID_CHOICE_SEL_NUM:
+ {
+ m_choice->SetSelection( 2 );
+ break;
+ }
+ case ID_CHOICE_SEL_STR:
+ {
+ m_choice->SetStringSelection( "This" );
+ break;
+ }
+ case ID_CHOICE_CLEAR:
+ {
+ m_choice->Clear();
+ break;
+ }
+ case ID_CHOICE_APPEND:
+ {
+ m_choice->Append( "Hi!" );
+ break;
+ }
+ }
+}
+
+void MyPanel::OnCombo( wxCommandEvent &event )
+{
+ m_text->WriteText( "ComboBox selection string is: " );
+ m_text->WriteText( event.GetString() );
+ m_text->WriteText( "\n" );
+}
+
+void MyPanel::OnComboButtons( wxCommandEvent &event )
{
- if (m_notebook->GetPageCount() > 1)
- m_notebook->DeletePage( 1 );
+ switch (event.GetId())
+ {
+ case ID_COMBO_SEL_NUM:
+ {
+ m_combo->SetSelection( 2 );
+ break;
+ }
+ case ID_COMBO_SEL_STR:
+ {
+ m_combo->SetStringSelection( "This" );
+ break;
+ }
+ case ID_COMBO_CLEAR:
+ {
+ m_combo->Clear();
+ break;
+ }
+ case ID_COMBO_APPEND:
+ {
+ m_combo->Append( "Hi!" );
+ break;
+ }
+ }
+}
+
+void MyPanel::OnRadio( wxCommandEvent &event )
+{
+ m_text->WriteText( "RadioBox selection string is: " );
+ m_text->WriteText( event.GetString() );
+ m_text->WriteText( "\n" );
+}
+
+void MyPanel::OnRadioButtons( wxCommandEvent &event )
+{
+ switch (event.GetId())
+ {
+ case ID_RADIOBOX_SEL_NUM:
+ {
+ m_radio->SetSelection( 2 );
+ break;
+ }
+ case ID_RADIOBOX_SEL_STR:
+ {
+ m_radio->SetStringSelection( "This" );
+ break;
+ }
+ }
}
//----------------------------------------------------------------------
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
bool MyApp::OnInit(void)
{
m_canvasTextColour = wxColour("BLACK");
- m_canvasFont = *wxNORMAL_FONT;
+ m_canvasFont = *wxSWISS_FONT;
// Create the main frame window
MyFrame *frame = new MyFrame(NULL, "wxWindows dialogs example", wxPoint(50, 50), wxSize(400, 300));
#include "wx/dnd.h"
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
// ----------------------------------------------------------------------------
// Derive 2 simple classes which just put in the listbox the strings (text or
// file names) we drop on them
#ifdef __WXMSW__
// frame icon and status bar
SetIcon(wxIcon("mondrian"));
+#else
+ SetIcon(wxIcon(mondrian_xpm));
#endif
const int widths[] = { -1 };
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
#include "wx/wx.h"
#endif
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
// Define a new application type
class MyApp: public wxApp
{ public:
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+ frame->SetIcon(wxIcon(mondrian_xpm));
#endif
// Make a menubar
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
#include "wx/file.h"
#include "wx/log.h"
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
// Define a new application type
class MyApp: public wxApp
{
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+ frame->SetIcon(wxIcon(mondrian_xpm));
#endif
// Make a menubar
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
--- /dev/null
+/* XPM */
+static char *copy_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+" c None",
+". c Black",
+"X c Gray100",
+"o c #000080",
+/* pixels */
+" ",
+" ...... ",
+" .XXXX.. ",
+" .XXXX.X. ",
+" .X..X.oooooo ",
+" .XXXXXoXXXXoo ",
+" .X....oXXXXoXo ",
+" .XXXXXoX..Xoooo",
+" .X....oXXXXXXXo",
+" .XXXXXoX.....Xo",
+" ......oXXXXXXXo",
+" oX.....Xo",
+" oXXXXXXXo",
+" ooooooooo",
+" "
+};
--- /dev/null
+/* XPM */
+static char *cut_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+" c None",
+". c Black",
+"X c #000080",
+/* pixels */
+" ",
+" . . ",
+" . . ",
+" . . ",
+" .. .. ",
+" . . ",
+" ... ",
+" . ",
+" X.X ",
+" X XXX ",
+" XXX X X ",
+" X X X X ",
+" X X X X ",
+" X X XX ",
+" XX "
+};
--- /dev/null
+/* XPM */
+static char *help_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+" c None",
+". c Black",
+"X c Blue",
+"o c #000080",
+/* pixels */
+" ",
+" ...... ",
+" .XXXXX.. ",
+" .XX...oX.. ",
+" .X.. .X.. ",
+" .X.. .XX.. ",
+" .. .XX.. ",
+" .XX.. ",
+" .X.. ",
+" .X.. ",
+" .o.. ",
+" .. ",
+" .XX.. ",
+" .XX.. ",
+" ... "
+};
--- /dev/null
+/* XPM */
+static char *new_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+" c None",
+". c Black",
+"X c Gray100",
+/* pixels */
+" ",
+" ........ ",
+" .XXXXXX.. ",
+" .XXXXXX.X. ",
+" .XXXXXX.... ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" ........... ",
+" "
+};
--- /dev/null
+/* XPM */
+static char *open_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+" c None",
+". c Black",
+"X c Yellow",
+"o c Gray100",
+"O c #bfbf00",
+/* pixels */
+" ",
+" ... ",
+" . . .",
+" ..",
+" ... ...",
+" .XoX....... ",
+" .oXoXoXoXo. ",
+" .XoXoXoXoX. ",
+" .oXoX..........",
+" .XoX.OOOOOOOOO.",
+" .oo.OOOOOOOOO. ",
+" .X.OOOOOOOOO. ",
+" ..OOOOOOOOO. ",
+" ........... ",
+" "
+};
--- /dev/null
+/* XPM */
+static char *print_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+" c None",
+". c Black",
+"X c Gray100",
+"o c #808000",
+"O c Yellow",
+/* pixels */
+" ",
+" ......... ",
+" .XXXXXXXX. ",
+" .X.....X. ",
+" .XXXXXXXX. ",
+" .X.....X.... ",
+" .XXXXXXXX. . .",
+" .......... . ..",
+". . . .",
+"............. .",
+". ooo . . ",
+". OOO ... ",
+"............. . ",
+" . . . ",
+" ........... "
+};
--- /dev/null
+/* XPM */
+static char *save_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+" c None",
+". c Black",
+"X c #808000",
+"o c #808080",
+/* pixels */
+" ",
+" .............. ",
+" .X. . . ",
+" .X. ... ",
+" .X. .X. ",
+" .X. .X. ",
+" .X. .X. ",
+" .X. .X. ",
+" .XX........oX. ",
+" .XXXXXXXXXXXX. ",
+" .XX.........X. ",
+" .XX...... .X. ",
+" .XX...... .X. ",
+" .XX...... .X. ",
+" ............. "
+};
#include <wx/toolbar.h>
#ifdef __WXGTK__
-#include "folder.xpm"
+#include "mondrian.xpm"
+#include "bitmaps/new.xpm"
+#include "bitmaps/open.xpm"
+#include "bitmaps/save.xpm"
+#include "bitmaps/copy.xpm"
+#include "bitmaps/cut.xpm"
+// #include "bitmaps/paste.xpm"
+#include "bitmaps/print.xpm"
+#include "bitmaps/preview.xpm"
+#include "bitmaps/help.xpm"
#endif
+
#include "mdi.h"
MyFrame *frame = NULL;
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mdi_icn"));
#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("aiai.xbm"));
-#endif
// Make a menubar
wxMenu *file_menu = new wxMenu;
// Give it an icon (this is ignored in MDI mode: uses resources)
#ifdef __WXMSW__
subframe->SetIcon(wxIcon("chrt_icn"));
-#endif
-#ifdef __X__
- subframe->SetIcon(wxIcon("aiai.xbm"));
+#else
+ subframe->SetIcon(wxIcon(mondrian_xpm));
#endif
// Give it a status line
bitmaps[6] = new wxBitmap("icon7", wxBITMAP_TYPE_RESOURCE);
bitmaps[7] = new wxBitmap("icon8", wxBITMAP_TYPE_RESOURCE);
#else
- bitmaps[0] = new wxBitmap( folder_xpm );
- bitmaps[1] = new wxBitmap( folder_xpm );
- bitmaps[2] = new wxBitmap( folder_xpm );
- bitmaps[3] = new wxBitmap( folder_xpm );
- bitmaps[4] = new wxBitmap( folder_xpm );
- bitmaps[5] = new wxBitmap( folder_xpm );
- bitmaps[6] = new wxBitmap( folder_xpm );
- bitmaps[7] = new wxBitmap( folder_xpm );
+ bitmaps[0] = new wxBitmap( new_xpm );
+ bitmaps[1] = new wxBitmap( open_xpm );
+ bitmaps[2] = new wxBitmap( save_xpm );
+ bitmaps[3] = new wxBitmap( copy_xpm );
+ bitmaps[4] = new wxBitmap( cut_xpm );
+// bitmaps[5] = new wxBitmap( paste_xpm );
+ bitmaps[5] = new wxBitmap( preview_xpm );
+ bitmaps[6] = new wxBitmap( print_xpm );
+ bitmaps[7] = new wxBitmap( help_xpm );
#endif
#ifdef __WXMSW__
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
#include "wx/date.h"
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
#if !WXDEBUG
#error You must set WXDEBUG to 1 on the 'make' command line (MSW) or with configure (GTK)
#endif
// Give it an icon
#ifdef wx_msw
frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef wx_x
- frame->SetIcon(wxIcon("mondrian.xbm"));
+ frame->SetIcon(wxIcon(mondrian_xpm));
#endif
// Make a menubar
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
--- /dev/null
+/* XPM */
+static char *copy_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+" c None",
+". c Black",
+"X c Gray100",
+"o c #000080",
+/* pixels */
+" ",
+" ...... ",
+" .XXXX.. ",
+" .XXXX.X. ",
+" .X..X.oooooo ",
+" .XXXXXoXXXXoo ",
+" .X....oXXXXoXo ",
+" .XXXXXoX..Xoooo",
+" .X....oXXXXXXXo",
+" .XXXXXoX.....Xo",
+" ......oXXXXXXXo",
+" oX.....Xo",
+" oXXXXXXXo",
+" ooooooooo",
+" "
+};
--- /dev/null
+/* XPM */
+static char *cut_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+" c None",
+". c Black",
+"X c #000080",
+/* pixels */
+" ",
+" . . ",
+" . . ",
+" . . ",
+" .. .. ",
+" . . ",
+" ... ",
+" . ",
+" X.X ",
+" X XXX ",
+" XXX X X ",
+" X X X X ",
+" X X X X ",
+" X X XX ",
+" XX "
+};
--- /dev/null
+/* XPM */
+static char *help_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+" c None",
+". c Black",
+"X c Blue",
+"o c #000080",
+/* pixels */
+" ",
+" ...... ",
+" .XXXXX.. ",
+" .XX...oX.. ",
+" .X.. .X.. ",
+" .X.. .XX.. ",
+" .. .XX.. ",
+" .XX.. ",
+" .X.. ",
+" .X.. ",
+" .o.. ",
+" .. ",
+" .XX.. ",
+" .XX.. ",
+" ... "
+};
--- /dev/null
+/* XPM */
+static char *new_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 3 1",
+" c None",
+". c Black",
+"X c Gray100",
+/* pixels */
+" ",
+" ........ ",
+" .XXXXXX.. ",
+" .XXXXXX.X. ",
+" .XXXXXX.... ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" .XXXXXXXXX. ",
+" ........... ",
+" "
+};
--- /dev/null
+/* XPM */
+static char *open_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+" c None",
+". c Black",
+"X c Yellow",
+"o c Gray100",
+"O c #bfbf00",
+/* pixels */
+" ",
+" ... ",
+" . . .",
+" ..",
+" ... ...",
+" .XoX....... ",
+" .oXoXoXoXo. ",
+" .XoXoXoXoX. ",
+" .oXoX..........",
+" .XoX.OOOOOOOOO.",
+" .oo.OOOOOOOOO. ",
+" .X.OOOOOOOOO. ",
+" ..OOOOOOOOO. ",
+" ........... ",
+" "
+};
--- /dev/null
+/* XPM */
+static char *preview_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+" c Black",
+". c None",
+"X c Gray100",
+"o c #808080",
+"O c Cyan",
+/* pixels */
+" .......",
+" XXXXXXX ......",
+" XXXXXXX . .....",
+" XXXXXXX ....",
+" XXXXXXXXXX ....",
+" XXXXXXX ....",
+" XXXXXX o..o ...",
+" XXXXX oOO.oo ..",
+" XXXXX .O..o. ..",
+" XXXXX ....o. ..",
+" XXXXX o..Ooo ..",
+" XXXXXX o..o o..",
+" XXXXXXX o .",
+" XXXXXXXXXX . ",
+" .. "
+};
--- /dev/null
+/* XPM */
+static char *print_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 5 1",
+" c None",
+". c Black",
+"X c Gray100",
+"o c #808000",
+"O c Yellow",
+/* pixels */
+" ",
+" ......... ",
+" .XXXXXXXX. ",
+" .X.....X. ",
+" .XXXXXXXX. ",
+" .X.....X.... ",
+" .XXXXXXXX. . .",
+" .......... . ..",
+". . . .",
+"............. .",
+". ooo . . ",
+". OOO ... ",
+"............. . ",
+" . . . ",
+" ........... "
+};
--- /dev/null
+/* XPM */
+static char *save_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"16 15 4 1",
+" c None",
+". c Black",
+"X c #808000",
+"o c #808080",
+/* pixels */
+" ",
+" .............. ",
+" .X. . . ",
+" .X. ... ",
+" .X. .X. ",
+" .X. .X. ",
+" .X. .X. ",
+" .X. .X. ",
+" .XX........oX. ",
+" .XXXXXXXXXXXX. ",
+" .XX.........X. ",
+" .XX...... .X. ",
+" .XX...... .X. ",
+" .XX...... .X. ",
+" ............. "
+};
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
#include "wx/toolbar.h"
#include "test.h"
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#include "bitmaps/new.xpm"
+#include "bitmaps/open.xpm"
+#include "bitmaps/save.xpm"
+#include "bitmaps/copy.xpm"
+#include "bitmaps/cut.xpm"
+// #include "bitmaps/paste.xpm"
+#include "bitmaps/print.xpm"
+#include "bitmaps/preview.xpm"
+#include "bitmaps/help.xpm"
+#endif
+
IMPLEMENT_APP(MyApp)
-#ifdef __X__
-// TODO: include XBM or XPM icons for X apps
-#endif
// The `main program' equivalent, creating the windows and returning the
// main frame
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("mondrian.xbm"));
+#else
+ frame->SetIcon( wxIcon(mondrian_xpm) );
#endif
// Make a menubar
toolBarBitmaps[5] = new wxBitmap("icon6");
toolBarBitmaps[6] = new wxBitmap("icon7");
toolBarBitmaps[7] = new wxBitmap("icon8");
-#endif
-#ifdef __X__
- // TODO
- toolBarBitmaps[0] = new wxBitmap(...);
- toolBarBitmaps[1] = new wxBitmap(...);
- toolBarBitmaps[2] = new wxBitmap(...);
- toolBarBitmaps[3] = new wxBitmap(...);
- toolBarBitmaps[4] = new wxBitmap(...);
- toolBarBitmaps[5] = new wxBitmap(...);
- toolBarBitmaps[6] = new wxBitmap(...);
- toolBarBitmaps[7] = new wxBitmap(...);
+#else
+ toolBarBitmaps[0] = new wxBitmap( new_xpm );
+ toolBarBitmaps[1] = new wxBitmap( open_xpm );
+ toolBarBitmaps[2] = new wxBitmap( save_xpm );
+ toolBarBitmaps[3] = new wxBitmap( copy_xpm );
+ toolBarBitmaps[4] = new wxBitmap( cut_xpm );
+// toolBarBitmaps[5] = new wxBitmap( paste_xpm );
+ toolBarBitmaps[5] = new wxBitmap( preview_xpm );
+ toolBarBitmaps[6] = new wxBitmap( print_xpm );
+ toolBarBitmaps[7] = new wxBitmap( help_xpm );
#endif
#ifdef __WXMSW__
#else
int width = 16;
#endif
- int offX = 5;
int currentX = 5;
toolBar->AddTool(wxID_NEW, *(toolBarBitmaps[0]), wxNullBitmap, FALSE, (float)currentX, -1, NULL, "New file");
m_textWindow = new wxTextCtrl(this, -1, "", wxPoint(0, 0), wxSize(-1, -1), wxTE_MULTILINE);
}
-void MyFrame::OnQuit(wxCommandEvent& event)
+void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
Close(TRUE);
}
-void MyFrame::OnAbout(wxCommandEvent& event)
+void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
{
(void)wxMessageBox("wxWindows wxToolBar demo\n", "About wxToolBar");
}
// Define the behaviour for the frame closing
// - must delete all frames except for the main one.
-void MyFrame::OnCloseWindow(wxCloseEvent& event)
+void MyFrame::OnCloseWindow(wxCloseEvent& WXUNUSED(event))
{
Destroy();
}
--- /dev/null
+/* XPM */
+static char *mondrian_xpm[] = {
+/* columns rows colors chars-per-pixel */
+"32 32 6 1",
+" c Black",
+". c Blue",
+"X c #00bf00",
+"o c Red",
+"O c Yellow",
+"+ c Gray100",
+/* pixels */
+" ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" oooooo +++++++++++++++++++++++ ",
+" ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ .... ",
+" ++++++ ++++++++++++++++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++++++++++++++++ ++++ ",
+" ++++++ ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" ++++++ OOOOOOOOOOOO XXXXX ++++ ",
+" "
+};
#include "wx/wx.h"
#endif
+#ifdef __WXGTK__
+#include "mondrian.xpm"
+#endif
+
#include "wx/treectrl.h"
#include "treetest.h"
// Give it an icon
#ifdef __WXMSW__
frame->SetIcon(wxIcon("mondrian"));
-#endif
-#ifdef __X__
- frame->SetIcon(wxIcon("aiai.xbm"));
+#else
+ frame->SetIcon(wxIcon(mondrian_xpm));
#endif
// Make an image list containing small icons
m_current = line;
HilightAll( FALSE );
m_current->ReverseHilight();
+ RefreshLine( m_current );
}
else
{
{
m_current = line;
m_current->ReverseHilight();
+ RefreshLine( m_current );
}
else if (event.ControlDown())
{
RefreshLine( test_line );
node = node->Next();
}
- return;
}
else
{
m_current = line;
HilightAll( FALSE );
m_current->ReverseHilight();
+ RefreshLine( m_current );
}
}
- RefreshLine( m_current );
if (m_current != oldCurrent)
{
+ RefreshLine( oldCurrent );
UnfocusLine( oldCurrent );
FocusLine( m_current );
- RefreshLine( oldCurrent );
};
m_lastOnSame = (m_current == oldCurrent);
return;
void wxListMainWindow::OnArrowChar( wxListLineData *newCurrent, bool shiftDown )
{
- UnfocusLine( m_current );
if ((m_mode & wxLC_SINGLE_SEL) || (m_usedKeys == FALSE)) m_current->Hilight( FALSE );
wxListLineData *oldCurrent = m_current;
m_current = newCurrent;
MoveToFocus();
if (shiftDown || (m_mode & wxLC_SINGLE_SEL)) m_current->Hilight( TRUE );
- FocusLine( m_current );
RefreshLine( m_current );
RefreshLine( oldCurrent );
+ FocusLine( m_current );
+ UnfocusLine( oldCurrent );
};
void wxListMainWindow::OnChar( wxKeyEvent &event )
if (!(m_mode & wxLC_SINGLE_SEL))
{
wxListLineData *oldCurrent = m_current;
- UnfocusLine( m_current );
m_current->ReverseHilight();
wxNode *node = m_lines.Member( m_current )->Next();
if (node) m_current = (wxListLineData*)node->Data();
MoveToFocus();
- FocusLine( m_current );
- RefreshLine( m_current );
RefreshLine( oldCurrent );
+ RefreshLine( m_current );
+ UnfocusLine( oldCurrent );
+ FocusLine( m_current );
};
};
break;
void wxListMainWindow::DeleteAllItems( void )
{
m_dirty = TRUE;
+ m_current = NULL;
wxNode *node = m_lines.First();
while (node)
{
node = node->Next();
};
m_lines.Clear();
- m_current = NULL;
};
void wxListMainWindow::DeleteEverything( void )
{
m_dirty = TRUE;
+ m_current = NULL;
wxNode *node = m_lines.First();
while (node)
{
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- wxBitmapButton *button = (wxBitmapButton*)data;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
- button->ProcessEvent(event);
+ button->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{
- wxButton *button = (wxButton*)data;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
- button->ProcessEvent(event);
+ button->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
// wxCheckBox
//-----------------------------------------------------------------------------
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{
- wxCheckBox *cb = (wxCheckBox*)data;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() );
event.SetEventObject(cb);
- cb->ProcessEvent(event);
+ cb->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
- wxChoice *choice = (wxChoice*)data;
- wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
+ wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice);
- choice->ProcessEvent(event);
+ choice->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
int wxChoice::FindString( const wxString &string ) const
{
- // If you read this code once and you think you undestand
- // it, then you are very wrong. RR
+ // 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;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
- GtkLabel *label = GTK_LABEL(bin->child);
+ GtkLabel *label = NULL;
+ if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
if (string == label->label) return count;
child = child->next;
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
- GtkLabel *label = GTK_LABEL(bin->child);
+ GtkLabel *label = NULL;
+ if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
return label->label;
};
{
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
+
+ gtk_choice_clicked_callback( NULL, this );
};
void wxChoice::SetStringSelection( const wxString &string )
#include "wx/combobox.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
-void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+//-----------------------------------------------------------------------------
+// clicked
+
+static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
+ if (combo->m_alreadySent)
+ {
+ combo->m_alreadySent = FALSE;
+ return;
+ }
+
+ combo->m_alreadySent = TRUE;
+
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, combo->GetId());
event.SetInt( combo->GetSelection() );
wxString tmp( combo->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(combo);
- combo->ProcessEvent(event);
+ combo->GetEventHandler()->ProcessEvent(event);
};
+//-----------------------------------------------------------------------------
+// size
+
+/*
+static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
+{
+ if (!win->HasVMT()) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
+ if (!widget->button) return FALSE;
+
+ widget->button->allocation.x =
+ alloc->width - widget->button->allocation.width;
+
+ return FALSE;
+};
+*/
+
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
int n, const wxString choices[],
long style, const wxString& name )
{
+ m_alreadySent = FALSE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
gtk_container_add( GTK_CONTAINER(list), list_item );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_widget_show( list_item );
};
PostCreation();
+/*
+ gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
+*/
+
if (!value.IsNull()) SetValue( value );
Show( TRUE );
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
+
+ m_clientData.Clear();
};
void wxComboBox::Append( const wxString &item )
+{
+ Append( item, (char*)NULL );
+};
+
+void wxComboBox::Append( const wxString &item, char *clientData )
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( item );
- gtk_signal_connect( GTK_OBJECT(list_item), "select",
+ gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
gtk_container_add( GTK_CONTAINER(list), list_item );
gtk_widget_show( list_item );
-};
-
-void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
-{
+
+ m_clientData.Append( (wxObject*)clientData );
};
void wxComboBox::Delete( int n )
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), n, n );
+
+ wxNode *node = m_clientData.Nth( n );
+ if (!node)
+ {
+ wxFAIL_MSG("wxComboBox::Delete wrong index");
+ }
+ else
+ m_clientData.DeleteNode( node );
};
int wxComboBox::FindString( const wxString &item )
gtk_list_select_item( GTK_LIST(list), n );
};
+void wxComboBox::SetStringSelection( const wxString &string )
+{
+ int res = FindString( string );
+ if (res == -1) return;
+ SetSelection( res );
+};
+
wxString wxComboBox::GetValue(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// size
+// set size
void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{
return TRUE;
};
+//-----------------------------------------------------------------------------
+// configure
+
+gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+{
+ if (!win->HasVMT()) return FALSE;
+
+ win->m_x = event->x;
+ win->m_y = event->y;
+
+ return FALSE;
+};
+
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
+ gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
+ GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
+
PostCreation();
gtk_widget_realize( m_mainWindow );
};
};
-void wxFrame::GtkOnSize( int x, int y, int width, int height )
+void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{
- m_x = x;
- m_y = y;
+ // due to a bug in gtk, x,y are always 0
+ // m_x = x;
+ // m_y = y;
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
// m_wxwindow just like any other window.
// not really needed
- gtk_widget_set_usize( m_mainWindow, width, height );
+// gtk_widget_set_usize( m_mainWindow, width, height );
if (m_frameMenuBar)
{
// wxListBox
//-----------------------------------------------------------------------------
-void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
+void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
{
- wxListBox *listbox = (wxListBox*)data;
-
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) );
GtkLabel *label = GTK_LABEL( bin->child );
wxString tmp( label->label );
event.SetString( WXSTRINGCAST(tmp) );
-
event.SetEventObject( listbox );
- listbox->ProcessEvent( event );
+ listbox->GetEventHandler()->ProcessEvent( event );
};
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
{
- wxRadioBox *rb = (wxRadioBox*)data;
+ if (rb->m_alreadySent)
+ {
+ rb->m_alreadySent = FALSE;
+ return;
+ }
+
+ rb->m_alreadySent = TRUE;
+
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
wxString tmp( rb->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject( rb );
- rb->ProcessEvent(event);
+ rb->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
int WXUNUSED(majorDim), long style,
const wxString &name )
{
+ m_alreadySent = FALSE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
for (int i = 0; i < n; i++)
{
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
+
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
return TRUE;
};
-int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
+int wxRadioBox::FindString( const wxString &s ) const
{
- return 0;
+ GSList *item = gtk_radio_button_group( m_radio );
+
+ int count = g_slist_length(item)-1;
+
+ while (item)
+ {
+ GtkButton *b = GTK_BUTTON( item->data );
+ GtkLabel *l = GTK_LABEL( b->child );
+ if (s == l->label) return count;
+ count--;
+ item = item->next;
+ };
+
+ return -1;
};
-void wxRadioBox::SetSelection( int WXUNUSED(n) )
+void wxRadioBox::SetSelection( int n )
{
+ GSList *item = gtk_radio_button_group( m_radio );
+ item = g_slist_nth( item, g_slist_length(item)-n-1 );
+ if (!item) return;
+
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+
+ gtk_toggle_button_set_state( button, 1 );
};
int wxRadioBox::GetSelection(void) const
return -1;
};
-wxString wxRadioBox::GetString( int WXUNUSED(n) ) const
+wxString wxRadioBox::GetString( int n ) const
{
- return "";
+ GSList *item = gtk_radio_button_group( m_radio );
+
+ item = g_slist_nth( item, g_slist_length(item)-n-1 );
+ if (!item) return "";
+
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+
+ GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
+
+ return wxString( label->label );
};
wxString wxRadioBox::GetLabel(void) const
return "";
};
-bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
+bool wxRadioBox::SetStringSelection( const wxString&s )
{
+ int res = FindString( s );
+ if (res == -1) return FALSE;
+ SetSelection( res );
return TRUE;
};
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
- win->ProcessEvent( event );
+ win->GetEventHandler()->ProcessEvent( event );
/*
wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
PreCreation( parent, id, pos, size, style, name );
bool bMultiLine = (style & wxTE_MULTILINE) != 0;
- if ( bMultiLine ) {
+ if ( bMultiLine )
+ {
// a multi-line edit control: create a vertical scrollbar by default and
// horizontal if requested
bool bHasHScrollbar = (style & wxHSCROLL) != 0;
#include "wx/mdi.h"
#include "wx/notebook.h"
#include "wx/statusbr.h"
-#include "wx/treectrl.h"
+//#include "wx/treectrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
if (IsKindOf(CLASSINFO(wxFrame)) ||
IsKindOf(CLASSINFO(wxDialog)))
{
- gtk_widget_set_uposition( m_widget, m_x, m_y );
+ if ((m_x != -1) || (m_y != -1))
+ gtk_widget_set_uposition( m_widget, m_x, m_y );
}
else
{
node = node->Next();
}
- SetClientSize(maxX + 5, maxY + 5);
+ SetClientSize(maxX + 5, maxY + 10);
};
void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
// wxFrame has a private AddChild
- if (IS_KIND_OF(this,wxFrame))
+ if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame))
{
wxFrame *frame = (wxFrame*)this;
frame->AddChild( child );
gdk_rect.width = rect->width;
gdk_rect.height = rect->height;
- if (IS_KIND_OF(this,wxTreeCtrl))
- {
- printf( "x: %d y: %d w: %d h: %d .\n",
- gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
- }
-
if (m_wxwindow)
gtk_widget_draw( m_wxwindow, &gdk_rect );
else
IMPLEMENT_DYNAMIC_CLASS(wxBitmapButton,wxControl)
-void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_bmpbutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxBitmapButton *button )
{
- wxBitmapButton *button = (wxBitmapButton*)data;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
- button->ProcessEvent(event);
+ button->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxButton,wxControl)
-void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_button_clicked_callback( GtkWidget *WXUNUSED(widget), wxButton *button )
{
- wxButton *button = (wxButton*)data;
wxCommandEvent event(wxEVT_COMMAND_BUTTON_CLICKED, button->GetId());
event.SetEventObject(button);
- button->ProcessEvent(event);
+ button->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
// wxCheckBox
//-----------------------------------------------------------------------------
-void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_checkbox_clicked_callback( GtkWidget *WXUNUSED(widget), wxCheckBox *cb )
{
- wxCheckBox *cb = (wxCheckBox*)data;
wxCommandEvent event(wxEVT_COMMAND_CHECKBOX_CLICKED, cb->GetId());
event.SetInt( cb->GetValue() );
event.SetEventObject(cb);
- cb->ProcessEvent(event);
+ cb->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
// wxChoice
//-----------------------------------------------------------------------------
-void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_choice_clicked_callback( GtkWidget *WXUNUSED(widget), wxChoice *choice )
{
- wxChoice *choice = (wxChoice*)data;
- wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId());
+ wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, choice->GetId() );
event.SetInt( choice->GetSelection() );
wxString tmp( choice->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(choice);
- choice->ProcessEvent(event);
+ choice->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
int wxChoice::FindString( const wxString &string ) const
{
- // If you read this code once and you think you undestand
- // it, then you are very wrong. RR
+ // 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;
while (child)
{
GtkBin *bin = GTK_BIN( child->data );
- GtkLabel *label = GTK_LABEL(bin->child);
+ GtkLabel *label = NULL;
+ if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
if (string == label->label) return count;
child = child->next;
GtkBin *bin = GTK_BIN( child->data );
if (count == n)
{
- GtkLabel *label = GTK_LABEL(bin->child);
+ GtkLabel *label = NULL;
+ if (bin->child) label = GTK_LABEL(bin->child);
if (!label) label = GTK_LABEL( GTK_BUTTON(m_widget)->child );
return label->label;
};
{
int tmp = n;
gtk_option_menu_set_history( GTK_OPTION_MENU(m_widget), (gint)tmp );
+
+ gtk_choice_clicked_callback( NULL, this );
};
void wxChoice::SetStringSelection( const wxString &string )
#include "wx/combobox.h"
+//-----------------------------------------------------------------------------
+// data
+//-----------------------------------------------------------------------------
+
+extern bool g_blockEventsOnDrag;
+
//-----------------------------------------------------------------------------
// wxComboBox
//-----------------------------------------------------------------------------
-void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
+//-----------------------------------------------------------------------------
+// clicked
+
+static void gtk_combo_clicked_callback( GtkWidget *WXUNUSED(widget), wxComboBox *combo )
{
+ if (combo->m_alreadySent)
+ {
+ combo->m_alreadySent = FALSE;
+ return;
+ }
+
+ combo->m_alreadySent = TRUE;
+
wxCommandEvent event(wxEVT_COMMAND_CHOICE_SELECTED, combo->GetId());
event.SetInt( combo->GetSelection() );
wxString tmp( combo->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject(combo);
- combo->ProcessEvent(event);
+ combo->GetEventHandler()->ProcessEvent(event);
};
+//-----------------------------------------------------------------------------
+// size
+
+/*
+static gint gtk_combo_size_callback( GtkCombo *widget, GtkAllocation* alloc, wxComboBox *win )
+{
+ if (!win->HasVMT()) return FALSE;
+ if (g_blockEventsOnDrag) return FALSE;
+ if (!widget->button) return FALSE;
+
+ widget->button->allocation.x =
+ alloc->width - widget->button->allocation.width;
+
+ return FALSE;
+};
+*/
+
//-----------------------------------------------------------------------------
IMPLEMENT_DYNAMIC_CLASS(wxComboBox,wxControl)
int n, const wxString choices[],
long style, const wxString& name )
{
+ m_alreadySent = FALSE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
gtk_container_add( GTK_CONTAINER(list), list_item );
+ m_clientData.Append( (wxObject*)NULL );
+
gtk_widget_show( list_item );
};
PostCreation();
+/*
+ gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
+ GTK_SIGNAL_FUNC(gtk_combo_size_callback), (gpointer)this );
+*/
+
if (!value.IsNull()) SetValue( value );
Show( TRUE );
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), 0, Number() );
+
+ m_clientData.Clear();
};
void wxComboBox::Append( const wxString &item )
+{
+ Append( item, (char*)NULL );
+};
+
+void wxComboBox::Append( const wxString &item, char *clientData )
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
GtkWidget *list_item;
list_item = gtk_list_item_new_with_label( item );
- gtk_signal_connect( GTK_OBJECT(list_item), "select",
+ gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
gtk_container_add( GTK_CONTAINER(list), list_item );
gtk_widget_show( list_item );
-};
-
-void wxComboBox::Append( const wxString &WXUNUSED(item), char* WXUNUSED(clientData) )
-{
+
+ m_clientData.Append( (wxObject*)clientData );
};
void wxComboBox::Delete( int n )
{
GtkWidget *list = GTK_COMBO(m_widget)->list;
gtk_list_clear_items( GTK_LIST(list), n, n );
+
+ wxNode *node = m_clientData.Nth( n );
+ if (!node)
+ {
+ wxFAIL_MSG("wxComboBox::Delete wrong index");
+ }
+ else
+ m_clientData.DeleteNode( node );
};
int wxComboBox::FindString( const wxString &item )
gtk_list_select_item( GTK_LIST(list), n );
};
+void wxComboBox::SetStringSelection( const wxString &string )
+{
+ int res = FindString( string );
+ if (res == -1) return;
+ SetSelection( res );
+};
+
wxString wxComboBox::GetValue(void) const
{
GtkWidget *entry = GTK_COMBO(m_widget)->entry;
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
-// size
+// set size
void gtk_frame_size_callback( GtkWidget *WXUNUSED(widget), GtkAllocation* alloc, wxFrame *win )
{
return TRUE;
};
+//-----------------------------------------------------------------------------
+// configure
+
+gint gtk_frame_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *event, wxFrame *win )
+{
+ if (!win->HasVMT()) return FALSE;
+
+ win->m_x = event->x;
+ win->m_y = event->y;
+
+ return FALSE;
+};
+
//-----------------------------------------------------------------------------
BEGIN_EVENT_TABLE(wxFrame, wxWindow)
gtk_signal_connect( GTK_OBJECT(m_widget), "size_allocate",
GTK_SIGNAL_FUNC(gtk_frame_size_callback), (gpointer)this );
+ gtk_signal_connect( GTK_OBJECT(m_widget), "configure_event",
+ GTK_SIGNAL_FUNC(gtk_frame_configure_callback), (gpointer)this );
+
PostCreation();
gtk_widget_realize( m_mainWindow );
};
};
-void wxFrame::GtkOnSize( int x, int y, int width, int height )
+void wxFrame::GtkOnSize( int WXUNUSED(x), int WXUNUSED(y), int width, int height )
{
- m_x = x;
- m_y = y;
+ // due to a bug in gtk, x,y are always 0
+ // m_x = x;
+ // m_y = y;
if ((m_height == height) && (m_width == width) &&
(m_sizeSet)) return;
// m_wxwindow just like any other window.
// not really needed
- gtk_widget_set_usize( m_mainWindow, width, height );
+// gtk_widget_set_usize( m_mainWindow, width, height );
if (m_frameMenuBar)
{
// wxListBox
//-----------------------------------------------------------------------------
-void gtk_listitem_select_callback( GtkWidget *widget, gpointer data )
+void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox )
{
- wxListBox *listbox = (wxListBox*)data;
-
wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
event.SetInt( listbox->GetIndex( widget ) );
GtkLabel *label = GTK_LABEL( bin->child );
wxString tmp( label->label );
event.SetString( WXSTRINGCAST(tmp) );
-
event.SetEventObject( listbox );
- listbox->ProcessEvent( event );
+ listbox->GetEventHandler()->ProcessEvent( event );
};
//-----------------------------------------------------------------------------
// wxRadioBox
//-----------------------------------------------------------------------------
-void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), gpointer data )
+void gtk_radiobutton_clicked_callback( GtkWidget *WXUNUSED(widget), wxRadioBox *rb )
{
- wxRadioBox *rb = (wxRadioBox*)data;
+ if (rb->m_alreadySent)
+ {
+ rb->m_alreadySent = FALSE;
+ return;
+ }
+
+ rb->m_alreadySent = TRUE;
+
wxCommandEvent event( wxEVT_COMMAND_RADIOBOX_SELECTED, rb->GetId() );
event.SetInt( rb->GetSelection() );
wxString tmp( rb->GetStringSelection() );
event.SetString( WXSTRINGCAST(tmp) );
event.SetEventObject( rb );
- rb->ProcessEvent(event);
+ rb->GetEventHandler()->ProcessEvent(event);
};
//-----------------------------------------------------------------------------
int WXUNUSED(majorDim), long style,
const wxString &name )
{
+ m_alreadySent = FALSE;
m_needParent = TRUE;
PreCreation( parent, id, pos, size, style, name );
for (int i = 0; i < n; i++)
{
if (i) radio_button_group = gtk_radio_button_group( GTK_RADIO_BUTTON(m_radio) );
+
m_radio = GTK_RADIO_BUTTON( gtk_radio_button_new_with_label( radio_button_group, choices[i] ) );
if (!i) gtk_toggle_button_set_state( GTK_TOGGLE_BUTTON(m_radio), TRUE );
return TRUE;
};
-int wxRadioBox::FindString( const wxString& WXUNUSED(s) ) const
+int wxRadioBox::FindString( const wxString &s ) const
{
- return 0;
+ GSList *item = gtk_radio_button_group( m_radio );
+
+ int count = g_slist_length(item)-1;
+
+ while (item)
+ {
+ GtkButton *b = GTK_BUTTON( item->data );
+ GtkLabel *l = GTK_LABEL( b->child );
+ if (s == l->label) return count;
+ count--;
+ item = item->next;
+ };
+
+ return -1;
};
-void wxRadioBox::SetSelection( int WXUNUSED(n) )
+void wxRadioBox::SetSelection( int n )
{
+ GSList *item = gtk_radio_button_group( m_radio );
+ item = g_slist_nth( item, g_slist_length(item)-n-1 );
+ if (!item) return;
+
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+
+ gtk_toggle_button_set_state( button, 1 );
};
int wxRadioBox::GetSelection(void) const
return -1;
};
-wxString wxRadioBox::GetString( int WXUNUSED(n) ) const
+wxString wxRadioBox::GetString( int n ) const
{
- return "";
+ GSList *item = gtk_radio_button_group( m_radio );
+
+ item = g_slist_nth( item, g_slist_length(item)-n-1 );
+ if (!item) return "";
+
+ GtkToggleButton *button = GTK_TOGGLE_BUTTON( item->data );
+
+ GtkLabel *label = GTK_LABEL( GTK_BUTTON(button)->child );
+
+ return wxString( label->label );
};
wxString wxRadioBox::GetLabel(void) const
return "";
};
-bool wxRadioBox::SetStringSelection( const wxString& WXUNUSED(s) )
+bool wxRadioBox::SetStringSelection( const wxString&s )
{
+ int res = FindString( s );
+ if (res == -1) return FALSE;
+ SetSelection( res );
return TRUE;
};
wxScrollEvent event( command, win->GetId(), value, orient );
event.SetEventObject( win );
- win->ProcessEvent( event );
+ win->GetEventHandler()->ProcessEvent( event );
/*
wxCommandEvent cevent( wxEVT_COMMAND_SCROLLBAR_UPDATED, win->GetId() );
PreCreation( parent, id, pos, size, style, name );
bool bMultiLine = (style & wxTE_MULTILINE) != 0;
- if ( bMultiLine ) {
+ if ( bMultiLine )
+ {
// a multi-line edit control: create a vertical scrollbar by default and
// horizontal if requested
bool bHasHScrollbar = (style & wxHSCROLL) != 0;
#include "wx/mdi.h"
#include "wx/notebook.h"
#include "wx/statusbr.h"
-#include "wx/treectrl.h"
+//#include "wx/treectrl.h"
#include "gdk/gdkkeysyms.h"
#include <math.h>
#include "wx/gtk/win_gtk.h"
if (IsKindOf(CLASSINFO(wxFrame)) ||
IsKindOf(CLASSINFO(wxDialog)))
{
- gtk_widget_set_uposition( m_widget, m_x, m_y );
+ if ((m_x != -1) || (m_y != -1))
+ gtk_widget_set_uposition( m_widget, m_x, m_y );
}
else
{
node = node->Next();
}
- SetClientSize(maxX + 5, maxY + 5);
+ SetClientSize(maxX + 5, maxY + 10);
};
void wxWindow::OnSize( wxSizeEvent &WXUNUSED(event) )
// wxFrame has a private AddChild
- if (IS_KIND_OF(this,wxFrame))
+ if (IS_KIND_OF(this,wxFrame) && !IS_KIND_OF(this,wxMDIChildFrame))
{
wxFrame *frame = (wxFrame*)this;
frame->AddChild( child );
gdk_rect.width = rect->width;
gdk_rect.height = rect->height;
- if (IS_KIND_OF(this,wxTreeCtrl))
- {
- printf( "x: %d y: %d w: %d h: %d .\n",
- gdk_rect.x, gdk_rect.y, gdk_rect.width, gdk_rect.height );
- }
-
if (m_wxwindow)
gtk_widget_draw( m_wxwindow, &gdk_rect );
else
(void) new wxButton( &dialog, wxID_OK, "Return", wxPoint(w/2-40,h-50), wxSize(80,30) );
+ dialog.Fit();
+
dialog.ShowModal();
};
@param baseLine the baseline for alignment, from top of box
@draw if set to false, do not draw but just calculate sizes
*/
- virtual void Draw(wxDC &dc, wxPoint position, CoordType baseLine,
- bool draw = true) {};
+ virtual void Draw( wxDC &WXUNUSED(dc), wxPoint WXUNUSED(position),
+ CoordType WXUNUSED(baseLine), bool draw = true) {};
/** Calculates and returns the size of the object. May need to be
called twice to work.
baseline)
@return the size of the object's box in pixels
*/
- virtual wxPoint GetSize(CoordType *baseLine) const { return
- wxPoint(0,0); };
+ virtual wxPoint GetSize( CoordType *WXUNUSED(baseLine) ) const
+ { return wxPoint(0,0); };
+
/// returns the number of cursor positions occupied by this object
virtual CoordType CountPositions(void) const { return 1; }
#include "wxllist.h"
+#define BROKEN_COMPILER
+
#ifdef BROKEN_COMPILER
# define virtual
#endif