Small devices adjustements.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@39344 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2006-05-26 14:07:47 +00:00
parent 93fbbe0765
commit 261357eb0a
15 changed files with 64 additions and 55 deletions

View File

@ -164,10 +164,8 @@ IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS );
ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
: WidgetsPage(book, imaglist, button_xpm)
{
imaglist->Add(wxBitmap(button_xpm));
// init everything
m_chkBitmap =
m_chkImage =

View File

@ -158,10 +158,8 @@ IMPLEMENT_WIDGETS_PAGE(CheckBoxWidgetsPage, wxT("CheckBox"), FAMILY_CTRLS );
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

View File

@ -204,7 +204,7 @@ IMPLEMENT_WIDGETS_PAGE(ComboboxWidgetsPage, _T("Combobox"),
ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
: WidgetsPage(book, imaglist, combobox_xpm)
{
// init everything
m_chkSort =
@ -213,8 +213,6 @@ ComboboxWidgetsPage::ComboboxWidgetsPage(WidgetsBookCtrl *book,
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

View File

@ -131,10 +131,8 @@ IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"),
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

View File

@ -167,10 +167,8 @@ IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"), FAMILY_CTRLS );
GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
:WidgetsPage(book)
:WidgetsPage(book, imaglist, gauge_xpm)
{
imaglist->Add(wxBitmap(gauge_xpm));
// init everything
m_range = 100;

View File

@ -205,10 +205,8 @@ IMPLEMENT_WIDGETS_PAGE(ListboxWidgetsPage, _T("Listbox"),
ListboxWidgetsPage::ListboxWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
: WidgetsPage(book, imaglist, listbox_xpm)
{
imaglist->Add(wxBitmap(listbox_xpm));
// init everything
m_radioSelMode = (wxRadioBox *)NULL;

View File

@ -44,6 +44,7 @@
#include "wx/sizer.h"
#include "wx/bookctrl.h"
#include "wx/artprov.h"
#include "wx/imaglist.h"
#include "widgets.h"
@ -85,7 +86,7 @@ enum Orient
class BookWidgetsPage : public WidgetsPage
{
public:
BookWidgetsPage(WidgetsBookCtrl *book);
BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[]);
virtual ~BookWidgetsPage();
virtual wxControl *GetWidget() const { return m_book; }
@ -184,8 +185,8 @@ END_EVENT_TABLE()
// implementation
// ============================================================================
BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book)
:WidgetsPage(book)
BookWidgetsPage::BookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist, char* icon[])
:WidgetsPage(book, imaglist, icon)
{
// init everything
m_chkImages = NULL;
@ -519,9 +520,8 @@ class NotebookWidgetsPage : public BookWidgetsPage
{
public:
NotebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: BookWidgetsPage(book)
: BookWidgetsPage(book, imaglist, notebook_xpm)
{
imaglist->Add(wxBitmap(notebook_xpm));
RecreateBook();
}
virtual ~NotebookWidgetsPage() {}
@ -602,9 +602,8 @@ class ListbookWidgetsPage : public BookWidgetsPage
{
public:
ListbookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: BookWidgetsPage(book)
: BookWidgetsPage(book, imaglist, listbook_xpm)
{
imaglist->Add(wxBitmap(listbook_xpm));
RecreateBook();
}
virtual ~ListbookWidgetsPage() {}
@ -677,9 +676,8 @@ class ChoicebookWidgetsPage : public BookWidgetsPage
{
public:
ChoicebookWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: BookWidgetsPage(book)
: BookWidgetsPage(book, imaglist, choicebk_xpm)
{
imaglist->Add(wxBitmap(choicebk_xpm));
RecreateBook();
}
virtual ~ChoicebookWidgetsPage() {}

View File

@ -185,10 +185,8 @@ IMPLEMENT_WIDGETS_PAGE(RadioWidgetsPage, _T("Radio"),
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;

View File

@ -208,10 +208,8 @@ IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"), FAMILY_CTRLS );
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;

View File

@ -178,7 +178,7 @@ IMPLEMENT_WIDGETS_PAGE(SpinBtnWidgetsPage, _T("Spin"),
SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
wxImageList *imaglist)
: WidgetsPage(book)
: WidgetsPage(book, imaglist, spinbtn_xpm)
{
m_chkVert = NULL;
m_chkWrap = NULL;
@ -187,7 +187,6 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(WidgetsBookCtrl *book,
m_textValue = NULL;
m_textMin = NULL;
m_textMax = NULL;
imaglist->Add(wxBitmap(spinbtn_xpm));
// init everything
m_min = 0;

View File

@ -210,10 +210,8 @@ IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static"),
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;

View File

@ -346,10 +346,8 @@ IMPLEMENT_WIDGETS_PAGE(TextWidgetsPage, _T("Text"),
// ----------------------------------------------------------------------------
TextWidgetsPage::TextWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: WidgetsPage(book)
: WidgetsPage(book, imaglist, text_xpm)
{
imaglist->Add(wxBitmap(text_xpm));
// init everything
#ifdef __WXMSW__
m_radioKind =

View File

@ -34,6 +34,7 @@
#ifndef WX_PRECOMP
#include "wx/sizer.h"
#include "wx/statbox.h"
#include "wx/textctrl.h"
#endif
#include "icons/toggle.xpm"
@ -114,10 +115,8 @@ IMPLEMENT_WIDGETS_PAGE(ToggleWidgetsPage, wxT("ToggleButton"),
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

View File

@ -47,6 +47,7 @@
#include "wx/colordlg.h"
#include "wx/fontdlg.h"
#include "wx/textdlg.h"
#include "wx/imaglist.h"
#include "widgets.h"
@ -380,7 +381,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
// 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;
@ -393,7 +394,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
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(
@ -423,11 +424,11 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
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);
@ -445,9 +446,13 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
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];
@ -469,7 +474,11 @@ void WidgetsFrame::InitBook()
#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;
@ -517,7 +526,9 @@ void WidgetsFrame::InitBook()
GetMenuBar()->Append(menuPages, _T("&Page"));
#if USE_ICONS_IN_BOOK
m_book->AssignImageList(imageList);
#endif
for ( cat = 0; cat < MAX_PAGES; cat++ )
{
@ -525,7 +536,9 @@ void WidgetsFrame::InitBook()
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
@ -816,13 +829,21 @@ WidgetsPageInfo::WidgetsPageInfo(Constructor ctor, const wxChar *label, int cate
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,

View File

@ -18,22 +18,35 @@
#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;
@ -41,9 +54,6 @@ class WidgetsPageInfo;
#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
{
@ -81,7 +91,9 @@ 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;