ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, button_xpm)
{
- imaglist->Add(wxBitmap(button_xpm));
-
// init everything
m_chkBitmap =
m_chkImage =
CheckBoxWidgetsPage::CheckBoxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, checkbox_xpm)
{
- imaglist->Add(wxBitmap(checkbox_xpm));
-
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane
ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, combobox_xpm)
{
// init everything
m_chkSort =
m_combobox = (wxComboBox *)NULL;
m_sizerCombo = (wxSizer *)NULL;
- imaglist->Add(wxBitmap(combobox_xpm));
-
/*
What we create here is a frame having 3 panes: style pane is the
leftmost one, in the middle the pane with buttons allowing to perform
DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- :WidgetsPage(book)
+ :WidgetsPage(book, imaglist, datepick_xpm)
{
- imaglist->Add(wxBitmap(datepick_xpm));
-
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane
GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- :WidgetsPage(book)
+ :WidgetsPage(book, imaglist, gauge_xpm)
{
- imaglist->Add(wxBitmap(gauge_xpm));
-
// init everything
m_range = 100;
ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, listbox_xpm)
{
- imaglist->Add(wxBitmap(listbox_xpm));
-
// init everything
m_radioSelMode = (wxRadioBox *)NULL;
#include "wx/sizer.h"
#include "wx/bookctrl.h"
#include "wx/artprov.h"
+#include "wx/imaglist.h"
#include "widgets.h"
class BookWidgetsPage : public WidgetsPage
{
public:
- BookWidgetsPage(WidgetsBookCtrl *book);
+ BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[]);
virtual ~BookWidgetsPage();
virtual wxControl *GetWidget() const { return m_book; }
// implementation
// ============================================================================
-BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book)
- :WidgetsPage(book)
+BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[])
+ :WidgetsPage(book, imaglist, icon)
{
// init everything
m_chkImages = NULL;
{
public:
NotebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
- : BookWidgetsPage(book)
+ : BookWidgetsPage(book, imaglist, notebook_xpm)
{
- imaglist->Add(wxBitmap(notebook_xpm));
RecreateBook();
}
virtual ~NotebookWidgetsPage() {}
{
public:
ListbookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
- : BookWidgetsPage(book)
+ : BookWidgetsPage(book, imaglist, listbook_xpm)
{
- imaglist->Add(wxBitmap(listbook_xpm));
RecreateBook();
}
virtual ~ListbookWidgetsPage() {}
{
public:
ChoicebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
- : BookWidgetsPage(book)
+ : BookWidgetsPage(book, imaglist, choicebk_xpm)
{
- imaglist->Add(wxBitmap(choicebk_xpm));
RecreateBook();
}
virtual ~ChoicebookWidgetsPage() {}
RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, radio_xpm)
{
- imaglist->Add(wxBitmap(radio_xpm));
-
// init everything
m_chkVert = (wxCheckBox *)NULL;
m_chkEnableItem = (wxCheckBox *)NULL;
SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, slider_xpm)
{
- imaglist->Add(wxBitmap(slider_xpm));
-
// init everything
m_min = 0;
m_max = 100;
SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, spinbtn_xpm)
{
m_chkVert = NULL;
m_chkWrap = NULL;
m_textValue = NULL;
m_textMin = NULL;
m_textMax = NULL;
- imaglist->Add(wxBitmap(spinbtn_xpm));
// init everything
m_min = 0;
StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, statbox_xpm)
{
- imaglist->Add(wxBitmap(statbox_xpm));
-
// init everything
m_chkVert =
m_chkAutoResize = (wxCheckBox *)NULL;
// ----------------------------------------------------------------------------
TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
- : WidgetsPage(book)
+ : WidgetsPage(book, imaglist, text_xpm)
{
- imaglist->Add(wxBitmap(text_xpm));
-
// init everything
#ifdef __WXMSW__
m_radioKind =
#ifndef WX_PRECOMP
#include "wx/sizer.h"
#include "wx/statbox.h"
+ #include "wx/textctrl.h"
#endif
#include "icons/toggle.xpm"
ToggleWidgetsPage::ToggleWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
- :WidgetsPage(book)
+ :WidgetsPage(book, imaglist, toggle_xpm)
{
- imaglist->Add(wxBitmap(toggle_xpm));
-
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
// left pane
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#include "wx/textdlg.h"
+#include "wx/imaglist.h"
#include "widgets.h"
// we have 2 panes: book with pages demonstrating the controls in the
// upper one and the log window with some buttons in the lower
- int style = wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxBK_DEFAULT;
+ int style = wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|WidgetBookStyle;
// Uncomment to suppress page theme (draw in solid colour)
//style |= wxNB_NOPAGETHEME;
style);
InitBook();
-#ifndef __SMARTPHONE__
+#ifndef __WXHANDHELD__
// the lower one only has the log listbox and a button to clear it
#if USE_LOG
wxSizer *sizerDown = new wxStaticBoxSizer(
sizerTop->Add(0, 5, 0, wxGROW); // spacer in between
sizerTop->Add(sizerDown, 0, wxGROW | (wxALL & ~wxTOP), 10);
-#else // !__SMARTPHONE__/__SMARTPHONE__
+#else // !__WXHANDHELD__/__WXHANDHELD__
sizerTop->Add(m_book, 1, wxGROW | wxALL );
-#endif // __SMARTPHONE__
+#endif // __WXHANDHELD__
m_panel->SetSizer(sizerTop);
void WidgetsFrame::InitBook()
{
+#if USE_ICONS_IN_BOOK
wxImageList *imageList = new wxImageList(32, 32);
imageList->Add(wxBitmap(sample_xpm));
+#else
+ wxImageList *imageList = NULL;
+#endif
#if !USE_TREEBOOK
WidgetsBookCtrl *books[MAX_PAGES];
#if USE_TREEBOOK
nPage++; // increase for parent page
#else
- books[cat] = new WidgetsBookCtrl( m_book, wxID_ANY );
+ books[cat] = new WidgetsBookCtrl(m_book,
+ wxID_ANY,
+ wxDefaultPosition,
+ wxDefaultSize,
+ WidgetBookStyle);
#endif
for ( WidgetsPageInfo *info = WidgetsPage::ms_widgetPages;
GetMenuBar()->Append(menuPages, _T("&Page"));
+#if USE_ICONS_IN_BOOK
m_book->AssignImageList(imageList);
+#endif
for ( cat = 0; cat < MAX_PAGES; cat++ )
{
m_book->AddPage(NULL,WidgetsCategories[cat],false,0);
#else
m_book->AddPage(books[cat],WidgetsCategories[cat],false,0);
+#if USE_ICONS_IN_BOOK
books[cat]->SetImageList(imageList);
+#endif
#endif
// now do add them
int WidgetsPage::ms_defaultFlags = wxBORDER_DEFAULT;
WidgetsPageInfo *WidgetsPage::ms_widgetPages = NULL;
-WidgetsPage::WidgetsPage(WidgetsBookCtrl *book)
+WidgetsPage::WidgetsPage(WidgetsBookCtrl *book,
+ wxImageList *imaglist,
+ char* icon[])
: wxPanel(book, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
wxNO_FULL_REPAINT_ON_RESIZE |
wxCLIP_CHILDREN |
wxTAB_TRAVERSAL)
{
+#if USE_ICONS_IN_BOOK
+ imaglist->Add(wxBitmap(icon));
+#else
+ wxUnusedVar(imaglist);
+ wxUnusedVar(icon);
+#endif
}
wxSizer *WidgetsPage::CreateSizerWithText(wxControl *control,
#define WidgetsBookCtrl wxTreebook
#define WidgetsBookCtrlEvent wxTreebookEvent
#define EVT_WIDGETS_PAGE_CHANGED(id,func) EVT_TREEBOOK_PAGE_CHANGED(id,func)
+ #define WidgetBookStyle (wxBK_DEFAULT)
#else
#include "wx/bookctrl.h"
#define USE_TREEBOOK 0
#define WidgetsBookCtrl wxBookCtrl
#define WidgetsBookCtrlEvent wxBookCtrlEvent
#define EVT_WIDGETS_PAGE_CHANGED(id,func) EVT_BOOKCTRL_PAGE_CHANGED(id,func)
+ #ifdef __POCKETPC__
+ #define WidgetBookStyle (wxBK_BOTTOM|wxNB_FLAT)
+ #else
+ #define WidgetBookStyle (wxBK_DEFAULT)
+ #endif
#endif
-#if wxUSE_LOG && !defined(__SMARTPHONE__)
+#if wxUSE_LOG && !defined(__WXHANDHELD__)
#define USE_LOG 1
#else
#define USE_LOG 0
#endif
+#if defined(__WXHANDHELD__)
+ #define USE_ICONS_IN_BOOK 0
+#else
+ #define USE_ICONS_IN_BOOK 1
+#endif
+
class WXDLLEXPORT wxCheckBox;
class WXDLLEXPORT wxSizer;
+class WXDLLEXPORT wxImageList;
class WXDLLEXPORT wxTextCtrl;
class WXDLLEXPORT WidgetsBookCtrl;
#include "wx/panel.h"
-// all source files use wxImageList
-#include "wx/imaglist.h"
-
// INTRODUCING NEW PAGES DON'T FORGET TO ADD ENTRIES TO 'WidgetsCategories'
enum
{
class WidgetsPage : public wxPanel
{
public:
- WidgetsPage(WidgetsBookCtrl *book);
+ WidgetsPage(WidgetsBookCtrl *book,
+ wxImageList *imaglist,
+ char* icon[]);
// return the control shown by this page
virtual wxControl *GetWidget() const = 0;