From 1c005ff76d730891c038de560b49a0c39fa6924f Mon Sep 17 00:00:00 2001 From: Robert Roebling Date: Sat, 30 May 1998 17:10:15 +0000 Subject: [PATCH] GTK: Added wxTabCtrl Work on wxEventhandler (delete clientdata) wxChoice (derive from wxControl) wxTextCtrl (init with text) Added sample for tabctrl (and more) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/controls/Makefile | 1 + samples/controls/Makefile.in | 26 +++++ samples/controls/aiai.ico | Bin 0 -> 766 bytes samples/controls/aiai.xbm | 38 +++++++ samples/controls/makefile.b32 | 64 +++++++++++ samples/controls/makefile.bcc | 73 ++++++++++++ samples/controls/makefile.dos | 65 +++++++++++ samples/controls/makefile.g95 | 37 ++++++ samples/controls/makefile.nt | 64 +++++++++++ samples/controls/makefile.sc | 35 ++++++ samples/controls/makefile.unx | 58 ++++++++++ samples/controls/makefile.vms | 38 +++++++ samples/controls/makefile.wat | 43 +++++++ samples/controls/minimal.cpp | 208 ++++++++++++++++++++++++++++++++++ samples/controls/minimal.def | 8 ++ samples/controls/minimal.rc | 3 + samples/controls/mondrian.ico | Bin 0 -> 766 bytes 17 files changed, 761 insertions(+) create mode 100644 samples/controls/Makefile create mode 100644 samples/controls/Makefile.in create mode 100644 samples/controls/aiai.ico create mode 100644 samples/controls/aiai.xbm create mode 100644 samples/controls/makefile.b32 create mode 100644 samples/controls/makefile.bcc create mode 100644 samples/controls/makefile.dos create mode 100644 samples/controls/makefile.g95 create mode 100644 samples/controls/makefile.nt create mode 100644 samples/controls/makefile.sc create mode 100644 samples/controls/makefile.unx create mode 100644 samples/controls/makefile.vms create mode 100644 samples/controls/makefile.wat create mode 100644 samples/controls/minimal.cpp create mode 100644 samples/controls/minimal.def create mode 100644 samples/controls/minimal.rc create mode 100644 samples/controls/mondrian.ico diff --git a/samples/controls/Makefile b/samples/controls/Makefile new file mode 100644 index 0000000000..027d82ae19 --- /dev/null +++ b/samples/controls/Makefile @@ -0,0 +1 @@ +include ../../src/gtk/setup/general/makeapp diff --git a/samples/controls/Makefile.in b/samples/controls/Makefile.in new file mode 100644 index 0000000000..13d042e5ef --- /dev/null +++ b/samples/controls/Makefile.in @@ -0,0 +1,26 @@ +# WXXT base directory +WXBASEDIR=@WXBASEDIR@ + +# set the OS type for compilation +OS=@OS@ +# compile a library only +RULE=bin + +# define library name +BIN_TARGET=test +# define library sources +BIN_SRC=\ +minimal.cpp + +#define library objects +BIN_OBJ=\ +minimal.o + +# additional things needed to link +BIN_LINK= + +# additional things needed to compile +ADD_COMPILE= + +# include the definitions now +include ../../../template.mak diff --git a/samples/controls/aiai.ico b/samples/controls/aiai.ico new file mode 100644 index 0000000000000000000000000000000000000000..a3db6563cc0b9f4588e1e994fe54b90a3cb1d6c1 GIT binary patch literal 766 zcmc(bJ930T3`Bcft}@v=+L+MC@X_W5#I6lE$3$=(hlEfB4Zbw(l3|27cf@{)u1o%88L{R;n8d60briz)7fioa{V~VK) z)$t4e1%j>c0*T7ZEBuvb0Ndch+2BCx7U^mZHa?iIh11ZPGV>8*oPzc{HmcjEM7U^( z*rd)gSRm_`KJo;dxt={X3#3|q&kYE;ul$En1WJC3UOX%3ev8=SetIcon(wxIcon("mondrian")); +#endif +#ifdef __X__ + frame->SetIcon(wxIcon("aiai.xbm")); +#endif + + wxMenu *file_menu = new wxMenu; + + file_menu->Append(MINIMAL_ABOUT, "&About"); + file_menu->Append(MINIMAL_QUIT, "E&xit"); + wxMenuBar *menu_bar = new wxMenuBar; + menu_bar->Append(file_menu, "&File"); + frame->SetMenuBar(menu_bar); + + frame->Show(TRUE); + + SetTopWindow(frame); + + return TRUE; +} + +//---------------------------------------------------------------------- +// MyPanel +//---------------------------------------------------------------------- + +const MINIMAL_TAB = 1000; + +const ID_LISTBOX = 130; +const ID_LISTBOX_SEL_NUM = 131; +const ID_LISTBOX_SEL_STR = 132; +const ID_LISTBOX_CLEAR = 133; +const ID_LISTBOX_APPEND = 134; + +BEGIN_EVENT_TABLE(MyPanel, wxPanel) + EVT_SIZE ( MyPanel::OnSize) + EVT_LISTBOX (ID_LISTBOX, MyPanel::OnListBox) + EVT_BUTTON (ID_LISTBOX_SEL_NUM, MyPanel::OnListBoxButtons) + EVT_BUTTON (ID_LISTBOX_SEL_STR, MyPanel::OnListBoxButtons) + EVT_BUTTON (ID_LISTBOX_CLEAR, MyPanel::OnListBoxButtons) + EVT_BUTTON (ID_LISTBOX_APPEND, MyPanel::OnListBoxButtons) +END_EVENT_TABLE() + +MyPanel::MyPanel( wxFrame *frame, int x, int y, int w, int h ) : + wxPanel( frame, -1, wxPoint(x, y), wxSize(w, h) ) +{ + m_text = new wxTextCtrl( this, -1, "This is the log window.\n", wxPoint(0,50), wxSize(100,50), wxTE_MULTILINE ); + + m_tab = new wxTabCtrl( this, MINIMAL_TAB, wxPoint(0,0), wxSize(200,150) ); + + wxString choices[4] = + { + "This", + "is", + "a", + "wonderfull example." + }; + + m_tab->InsertItem( 0, "wxList" ); + m_listbox = new wxListBox( m_tab, ID_LISTBOX, wxPoint(10,10), wxSize(120,70), 4, choices ); + (void)new wxButton( m_tab, ID_LISTBOX_SEL_NUM, "Select #2", wxPoint(140,30), wxSize(100,30) ); + (void)new wxButton( m_tab, ID_LISTBOX_SEL_STR, "Select 'This'", wxPoint(260,30), wxSize(100,30) ); + (void)new wxButton( m_tab, ID_LISTBOX_CLEAR, "Clear", wxPoint(140,80), wxSize(100,30) ); + (void)new wxButton( m_tab, ID_LISTBOX_APPEND, "Append 'Hi!'", wxPoint(260,80), wxSize(100,30) ); + + m_tab->InsertItem( 1, "wxChoice" ); +} + +void MyPanel::OnSize( wxSizeEvent& WXUNUSED(event) ) +{ + int x = 0; + int y = 0; + GetClientSize( &x, &y ); + + if (m_tab) m_tab->SetSize( 2, 2, x-4, y/2-4 ); + if (m_text) m_text->SetSize( 2, y/2+2, x-4, y/2-4 ); +} + +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) ) +{ +} + +//---------------------------------------------------------------------- +// MyFrame +//---------------------------------------------------------------------- + +BEGIN_EVENT_TABLE(MyFrame, wxFrame) + EVT_MENU(MINIMAL_QUIT, MyFrame::OnQuit) + EVT_MENU(MINIMAL_ABOUT, MyFrame::OnAbout) +END_EVENT_TABLE() + +MyFrame::MyFrame(wxFrame *frame, char *title, int x, int y, int w, int h): + wxFrame(frame, -1, title, wxPoint(x, y), wxSize(w, h)) +{ + (void*) new MyPanel( this, 10, 10, 300, 100 ); +} + +void MyFrame::OnQuit (wxCommandEvent& WXUNUSED(event) ) +{ + Close(TRUE); +} + +void MyFrame::OnAbout( wxCommandEvent& WXUNUSED(event) ) +{ + wxMessageDialog dialog(this, "This is a control sample", "About Controls", wxOK ); + dialog.ShowModal(); +} + + diff --git a/samples/controls/minimal.def b/samples/controls/minimal.def new file mode 100644 index 0000000000..060bfe3fce --- /dev/null +++ b/samples/controls/minimal.def @@ -0,0 +1,8 @@ +NAME Minimal +DESCRIPTION 'Minimal wxWindows application' +EXETYPE WINDOWS +STUB 'WINSTUB.EXE' +CODE PRELOAD MOVEABLE DISCARDABLE +DATA PRELOAD MOVEABLE MULTIPLE +HEAPSIZE 4048 +STACKSIZE 16000 diff --git a/samples/controls/minimal.rc b/samples/controls/minimal.rc new file mode 100644 index 0000000000..7655c62a4c --- /dev/null +++ b/samples/controls/minimal.rc @@ -0,0 +1,3 @@ +mondrian ICON "mondrian.ico" +#include "wx/msw/wx.rc" + diff --git a/samples/controls/mondrian.ico b/samples/controls/mondrian.ico new file mode 100644 index 0000000000000000000000000000000000000000..2310c5d275a87af295d5ea8dc79ea417a5e74c53 GIT binary patch literal 766 zcmZQzU<5)11px*Sc)`TLAO@s0fLH;D9e|jTfdxnc0Z