Unified flags for orienting wxBookCtrls (with backward compatibility). Centralised code for sizing internals.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35972 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -307,34 +307,26 @@ MyFrame::~MyFrame()
|
|||||||
// part is control class-specific
|
// part is control class-specific
|
||||||
#if wxUSE_NOTEBOOK
|
#if wxUSE_NOTEBOOK
|
||||||
#define CASE_NOTEBOOK(x) case Type_Notebook: x; break;
|
#define CASE_NOTEBOOK(x) case Type_Notebook: x; break;
|
||||||
#define FLAG_NOTEBOOK(x) wxNB_##x
|
|
||||||
#else
|
#else
|
||||||
#define CASE_NOTEBOOK(x)
|
#define CASE_NOTEBOOK(x)
|
||||||
#define FLAG_NOTEBOOK(x) 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_LISTBOOK
|
#if wxUSE_LISTBOOK
|
||||||
#define CASE_LISTBOOK(x) case Type_Listbook: x; break;
|
#define CASE_LISTBOOK(x) case Type_Listbook: x; break;
|
||||||
#define FLAG_LISTBOOK(x) wxLB_##x
|
|
||||||
#else
|
#else
|
||||||
#define CASE_LISTBOOK(x)
|
#define CASE_LISTBOOK(x)
|
||||||
#define FLAG_LISTBOOK(x) 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_CHOICEBOOK
|
#if wxUSE_CHOICEBOOK
|
||||||
#define CASE_CHOICEBOOK(x) case Type_Choicebook: x; break;
|
#define CASE_CHOICEBOOK(x) case Type_Choicebook: x; break;
|
||||||
#define FLAG_CHOICEBOOK(x) wxCHB_##x
|
|
||||||
#else
|
#else
|
||||||
#define CASE_CHOICEBOOK(x)
|
#define CASE_CHOICEBOOK(x)
|
||||||
#define FLAG_CHOICEBOOK(x) 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if wxUSE_TREEBOOK
|
#if wxUSE_TREEBOOK
|
||||||
#define CASE_TREEBOOK(x) case Type_Treebook: x; break;
|
#define CASE_TREEBOOK(x) case Type_Treebook: x; break;
|
||||||
#define FLAG_TREEBOOK(x) wxTBK_##x
|
|
||||||
#else
|
#else
|
||||||
#define CASE_TREEBOOK(x)
|
#define CASE_TREEBOOK(x)
|
||||||
#define FLAG_TREEBOOK(x) 0
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define DISPATCH_ON_TYPE(before, nb, lb, cb, tb, after) \
|
#define DISPATCH_ON_TYPE(before, nb, lb, cb, tb, after) \
|
||||||
@@ -360,34 +352,29 @@ int MyFrame::TranslateBookFlag(int nb, int lb, int chb, int tbk) const
|
|||||||
|
|
||||||
void MyFrame::RecreateBook()
|
void MyFrame::RecreateBook()
|
||||||
{
|
{
|
||||||
#define SELECT_FLAG(f) \
|
|
||||||
TranslateBookFlag(FLAG_NOTEBOOK(f), FLAG_LISTBOOK(f), FLAG_CHOICEBOOK(f), FLAG_TREEBOOK(f))
|
|
||||||
|
|
||||||
int flags;
|
int flags;
|
||||||
switch ( m_orient )
|
switch ( m_orient )
|
||||||
{
|
{
|
||||||
case ID_ORIENT_TOP:
|
case ID_ORIENT_TOP:
|
||||||
flags = SELECT_FLAG(TOP);
|
flags = wxBK_TOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ORIENT_BOTTOM:
|
case ID_ORIENT_BOTTOM:
|
||||||
flags = SELECT_FLAG(BOTTOM);
|
flags = wxBK_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ORIENT_LEFT:
|
case ID_ORIENT_LEFT:
|
||||||
flags = SELECT_FLAG(LEFT);
|
flags = wxBK_LEFT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ID_ORIENT_RIGHT:
|
case ID_ORIENT_RIGHT:
|
||||||
flags = SELECT_FLAG(RIGHT);
|
flags = wxBK_RIGHT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
flags = SELECT_FLAG(DEFAULT);
|
flags = wxBK_DEFAULT;
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef SELECT_FLAG
|
|
||||||
|
|
||||||
if ( m_multi && m_type == Type_Notebook )
|
if ( m_multi && m_type == Type_Notebook )
|
||||||
flags |= wxNB_MULTILINE;
|
flags |= wxNB_MULTILINE;
|
||||||
flags |= wxDOUBLE_BORDER;
|
flags |= wxDOUBLE_BORDER;
|
||||||
@@ -823,4 +810,3 @@ void MyFrame::OnBookCtrl(wxBookCtrlBaseEvent& event)
|
|||||||
m_text->SetInsertionPointEnd();
|
m_text->SetInsertionPointEnd();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -355,19 +355,19 @@ void NotebookWidgetsPage::CreateNotebook()
|
|||||||
// fall through
|
// fall through
|
||||||
|
|
||||||
case Orient_Top:
|
case Orient_Top:
|
||||||
flags = wxNB_TOP;
|
flags = wxBK_TOP;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Orient_Bottom:
|
case Orient_Bottom:
|
||||||
flags = wxNB_BOTTOM;
|
flags = wxBK_BOTTOM;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Orient_Left:
|
case Orient_Left:
|
||||||
flags = wxNB_LEFT;
|
flags = wxBK_LEFT;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Orient_Right:
|
case Orient_Right:
|
||||||
flags = wxNB_RIGHT;
|
flags = wxBK_RIGHT;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -506,7 +506,7 @@ void NotebookWidgetsPage::OnUpdateUIRemoveButton(wxUpdateUIEvent& event)
|
|||||||
void NotebookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
void NotebookWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
event.Enable( !m_chkImages->GetValue() ||
|
event.Enable( !m_chkImages->GetValue() ||
|
||||||
m_radioOrient->GetSelection() != wxNB_TOP );
|
m_radioOrient->GetSelection() != wxBK_TOP );
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotebookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
|
void NotebookWidgetsPage::OnUpdateUINumPagesText(wxUpdateUIEvent& event)
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Program: wxWidgets Widgets Sample
|
// Program: wxWidgets Widgets Sample
|
||||||
// Name: widgets.cpp
|
// Name: samples/widgets/widgets.cpp
|
||||||
// Purpose: Sample showing most of the simple wxWidgets widgets
|
// Purpose: Sample showing most of the simple wxWidgets widgets
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Created: 27.03.01
|
// Created: 27.03.01
|
||||||
@@ -322,13 +322,13 @@ WidgetsFrame::WidgetsFrame(const wxString& title)
|
|||||||
// we have 2 panes: book with pages demonstrating the controls in the
|
// we have 2 panes: book with pages demonstrating the controls in the
|
||||||
// upper one and the log window with some buttons in the lower
|
// upper one and the log window with some buttons in the lower
|
||||||
|
|
||||||
int style = wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxBC_DEFAULT;
|
int style = wxNO_FULL_REPAINT_ON_RESIZE|wxCLIP_CHILDREN|wxBK_DEFAULT;
|
||||||
// Uncomment to suppress page theme (draw in solid colour)
|
// Uncomment to suppress page theme (draw in solid colour)
|
||||||
//style |= wxNB_NOPAGETHEME;
|
//style |= wxNB_NOPAGETHEME;
|
||||||
|
|
||||||
m_book = new wxBookCtrl(m_panel, wxID_ANY, wxDefaultPosition,
|
m_book = new wxBookCtrl(m_panel, wxID_ANY, wxDefaultPosition,
|
||||||
#ifdef __WXMOTIF__
|
#ifdef __WXMOTIF__
|
||||||
wxSize(500, -1), // under Motif, height is a function of the width...
|
wxSize(500, wxDefaultCoord), // under Motif, height is a function of the width...
|
||||||
#else
|
#else
|
||||||
wxDefaultSize,
|
wxDefaultSize,
|
||||||
#endif
|
#endif
|
||||||
@@ -698,4 +698,3 @@ wxCheckBox *WidgetsPage::CreateCheckBoxAndAddToSizer(wxSizer *sizer,
|
|||||||
|
|
||||||
return checkbox;
|
return checkbox;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: common/bookctrl.cpp
|
// Name: src/common/bookctrl.cpp
|
||||||
// Purpose: wxBookCtrlBase implementation
|
// Purpose: wxBookCtrlBase implementation
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -34,12 +34,23 @@
|
|||||||
// implementation
|
// implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// event table
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
IMPLEMENT_ABSTRACT_CLASS(wxBookCtrlBase, wxControl)
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE(wxBookCtrlBase, wxControl)
|
||||||
|
EVT_SIZE(wxBookCtrlBase::OnSize)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// constructors and destructors
|
// constructors and destructors
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
void wxBookCtrlBase::Init()
|
void wxBookCtrlBase::Init()
|
||||||
{
|
{
|
||||||
|
m_bookctrl = NULL;
|
||||||
m_imageList = NULL;
|
m_imageList = NULL;
|
||||||
m_ownsImageList = false;
|
m_ownsImageList = false;
|
||||||
|
|
||||||
@@ -151,7 +162,8 @@ wxBookCtrlBase::InsertPage(size_t nPage,
|
|||||||
bool WXUNUSED(bSelect),
|
bool WXUNUSED(bSelect),
|
||||||
int WXUNUSED(imageId))
|
int WXUNUSED(imageId))
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( page || AllowNullPage(), false, _T("NULL page in wxBookCtrlBase::InsertPage()") );
|
wxCHECK_MSG( page || AllowNullPage(), false,
|
||||||
|
_T("NULL page in wxBookCtrlBase::InsertPage()") );
|
||||||
wxCHECK_MSG( nPage <= m_pages.size(), false,
|
wxCHECK_MSG( nPage <= m_pages.size(), false,
|
||||||
_T("invalid page index in wxBookCtrlBase::InsertPage()") );
|
_T("invalid page index in wxBookCtrlBase::InsertPage()") );
|
||||||
|
|
||||||
@@ -208,4 +220,112 @@ int wxBookCtrlBase::GetNextPage(bool forward) const
|
|||||||
return nPage;
|
return nPage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxRect wxBookCtrlBase::GetPageRect() const
|
||||||
|
{
|
||||||
|
const wxSize size = GetControllerSize();
|
||||||
|
|
||||||
|
wxPoint pt;
|
||||||
|
wxRect rectPage(pt, GetClientSize());
|
||||||
|
switch ( GetWindowStyle() & wxBK_ALIGN_MASK )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
wxFAIL_MSG( _T("unexpected alignment") );
|
||||||
|
// fall through
|
||||||
|
|
||||||
|
case wxBK_TOP:
|
||||||
|
rectPage.y = size.y + GetInternalBorder();
|
||||||
|
// fall through
|
||||||
|
|
||||||
|
case wxBK_BOTTOM:
|
||||||
|
rectPage.height -= size.y + GetInternalBorder();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxBK_LEFT:
|
||||||
|
rectPage.x = size.x + GetInternalBorder();
|
||||||
|
// fall through
|
||||||
|
|
||||||
|
case wxBK_RIGHT:
|
||||||
|
rectPage.width -= size.x + GetInternalBorder();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return rectPage;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxBookCtrlBase::OnSize(wxSizeEvent& event)
|
||||||
|
{
|
||||||
|
event.Skip();
|
||||||
|
|
||||||
|
if ( !m_bookctrl )
|
||||||
|
{
|
||||||
|
// we're not fully created yet or OnSize() should be hidden by derived class
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// resize controller and the page area to fit inside our new size
|
||||||
|
const wxSize sizeClient( GetClientSize() ),
|
||||||
|
sizeBorder( m_bookctrl->GetSize() - m_bookctrl->GetClientSize() ),
|
||||||
|
sizeCtrl( GetControllerSize() );
|
||||||
|
|
||||||
|
m_bookctrl->SetClientSize( sizeCtrl.x - sizeBorder.x, sizeCtrl.y - sizeBorder.y );
|
||||||
|
|
||||||
|
const wxSize sizeNew = m_bookctrl->GetSize();
|
||||||
|
wxPoint posCtrl;
|
||||||
|
switch ( GetWindowStyle() & wxBK_ALIGN_MASK )
|
||||||
|
{
|
||||||
|
default:
|
||||||
|
wxFAIL_MSG( _T("unexpected alignment") );
|
||||||
|
// fall through
|
||||||
|
|
||||||
|
case wxBK_TOP:
|
||||||
|
case wxBK_LEFT:
|
||||||
|
// posCtrl is already ok
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxBK_BOTTOM:
|
||||||
|
posCtrl.y = sizeClient.y - sizeNew.y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case wxBK_RIGHT:
|
||||||
|
posCtrl.x = sizeClient.x - sizeNew.x;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_bookctrl->GetPosition() != posCtrl )
|
||||||
|
m_bookctrl->Move(posCtrl);
|
||||||
|
|
||||||
|
// resize the currently shown page
|
||||||
|
if (GetSelection() != wxNOT_FOUND )
|
||||||
|
{
|
||||||
|
wxWindow *page = m_pages[GetSelection()];
|
||||||
|
wxCHECK_RET( page, _T("NULL page?") );
|
||||||
|
page->SetSize(GetPageRect());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSize wxBookCtrlBase::GetControllerSize() const
|
||||||
|
{
|
||||||
|
if(!m_bookctrl)
|
||||||
|
return wxSize(0,0);
|
||||||
|
|
||||||
|
const wxSize sizeClient = GetClientSize(),
|
||||||
|
sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(),
|
||||||
|
sizeCtrl = m_bookctrl->GetBestSize() + sizeBorder;
|
||||||
|
|
||||||
|
wxSize size;
|
||||||
|
|
||||||
|
if ( IsVertical() )
|
||||||
|
{
|
||||||
|
size.x = sizeClient.x;
|
||||||
|
size.y = sizeCtrl.y;
|
||||||
|
}
|
||||||
|
else // left/right aligned
|
||||||
|
{
|
||||||
|
size.x = sizeCtrl.x;
|
||||||
|
size.y = sizeClient.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
#endif // wxUSE_BOOKCTRL
|
#endif // wxUSE_BOOKCTRL
|
||||||
|
@@ -45,7 +45,7 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
|
|||||||
// default because not all ports implement this
|
// default because not all ports implement this
|
||||||
wxSize sizeTotal = sizePage;
|
wxSize sizeTotal = sizePage;
|
||||||
|
|
||||||
if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
|
if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) )
|
||||||
{
|
{
|
||||||
sizeTotal.x += 90;
|
sizeTotal.x += 90;
|
||||||
sizeTotal.y += 10;
|
sizeTotal.y += 10;
|
||||||
@@ -60,4 +60,3 @@ wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_NOTEBOOK
|
#endif // wxUSE_NOTEBOOK
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: generic/choicbkg.cpp
|
// Name: src/generic/choicbkg.cpp
|
||||||
// Purpose: generic implementation of wxChoicebook
|
// Purpose: generic implementation of wxChoicebook
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by: Wlodzimierz ABX Skiba from generic/listbkg.cpp
|
// Modified by: Wlodzimierz ABX Skiba from generic/listbkg.cpp
|
||||||
@@ -42,7 +42,7 @@
|
|||||||
// event table
|
// event table
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxChoicebook, wxBookCtrlBase)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxChoicebookEvent, wxNotifyEvent)
|
||||||
|
|
||||||
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType();
|
const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGING = wxNewEventType();
|
||||||
@@ -50,7 +50,6 @@ const wxEventType wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED = wxNewEventType();
|
|||||||
const int wxID_CHOICEBOOKCHOICE = wxNewId();
|
const int wxID_CHOICEBOOKCHOICE = wxNewId();
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase)
|
BEGIN_EVENT_TABLE(wxChoicebook, wxBookCtrlBase)
|
||||||
EVT_SIZE(wxChoicebook::OnSize)
|
|
||||||
EVT_CHOICE(wxID_CHOICEBOOKCHOICE, wxChoicebook::OnChoiceSelected)
|
EVT_CHOICE(wxID_CHOICEBOOKCHOICE, wxChoicebook::OnChoiceSelected)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
@@ -64,7 +63,6 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void wxChoicebook::Init()
|
void wxChoicebook::Init()
|
||||||
{
|
{
|
||||||
m_choice = NULL;
|
|
||||||
m_selection = wxNOT_FOUND;
|
m_selection = wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -76,9 +74,9 @@ wxChoicebook::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
if ( (style & wxCHB_ALIGN_MASK) == wxCHB_DEFAULT )
|
if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
|
||||||
{
|
{
|
||||||
style |= wxCHB_TOP;
|
style |= wxBK_TOP;
|
||||||
}
|
}
|
||||||
|
|
||||||
// no border for this control, it doesn't look nice together with
|
// no border for this control, it doesn't look nice together with
|
||||||
@@ -90,7 +88,7 @@ wxChoicebook::Create(wxWindow *parent,
|
|||||||
wxDefaultValidator, name) )
|
wxDefaultValidator, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_choice = new wxChoice
|
m_bookctrl = new wxChoice
|
||||||
(
|
(
|
||||||
this,
|
this,
|
||||||
wxID_CHOICEBOOKCHOICE,
|
wxID_CHOICEBOOKCHOICE,
|
||||||
@@ -105,10 +103,10 @@ wxChoicebook::Create(wxWindow *parent,
|
|||||||
// wxChoicebook geometry management
|
// wxChoicebook geometry management
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSize wxChoicebook::GetChoiceSize() const
|
wxSize wxChoicebook::GetControllerSize() const
|
||||||
{
|
{
|
||||||
const wxSize sizeClient = GetClientSize(),
|
const wxSize sizeClient = GetClientSize(),
|
||||||
sizeChoice = m_choice->GetBestFittingSize();
|
sizeChoice = m_bookctrl->GetBestFittingSize();
|
||||||
|
|
||||||
wxSize size;
|
wxSize size;
|
||||||
if ( IsVertical() )
|
if ( IsVertical() )
|
||||||
@@ -125,89 +123,10 @@ wxSize wxChoicebook::GetChoiceSize() const
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxChoicebook::GetPageRect() const
|
|
||||||
{
|
|
||||||
const wxSize sizeChoice = m_choice->GetBestFittingSize();
|
|
||||||
|
|
||||||
wxPoint pt;
|
|
||||||
wxRect rectPage(pt, GetClientSize());
|
|
||||||
switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxCHB_TOP:
|
|
||||||
rectPage.y = sizeChoice.y + GetInternalBorder();
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxCHB_BOTTOM:
|
|
||||||
rectPage.height -= sizeChoice.y + GetInternalBorder();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxCHB_LEFT:
|
|
||||||
rectPage.x = sizeChoice.x + GetInternalBorder();
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxCHB_RIGHT:
|
|
||||||
rectPage.width -= sizeChoice.x + GetInternalBorder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rectPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxChoicebook::OnSize(wxSizeEvent& event)
|
|
||||||
{
|
|
||||||
event.Skip();
|
|
||||||
|
|
||||||
if ( !m_choice )
|
|
||||||
{
|
|
||||||
// we're not fully created yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// resize the choice control and the page area to fit inside our new size
|
|
||||||
const wxSize sizeClient = GetClientSize(),
|
|
||||||
sizeChoice = GetChoiceSize();
|
|
||||||
|
|
||||||
wxPoint posChoice;
|
|
||||||
switch ( GetWindowStyle() & wxCHB_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected wxChoicebook alignment") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxCHB_TOP:
|
|
||||||
case wxCHB_LEFT:
|
|
||||||
// posChoice is already ok
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxCHB_BOTTOM:
|
|
||||||
posChoice.y = sizeClient.y - sizeChoice.y;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxCHB_RIGHT:
|
|
||||||
posChoice.x = sizeClient.x - sizeChoice.x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_choice->Move(posChoice);
|
|
||||||
m_choice->SetSize(sizeChoice);
|
|
||||||
|
|
||||||
// resize the currently shown page
|
|
||||||
if ( m_selection != wxNOT_FOUND )
|
|
||||||
{
|
|
||||||
wxWindow *page = m_pages[m_selection];
|
|
||||||
wxCHECK_RET( page, _T("NULL page in wxChoicebook?") );
|
|
||||||
page->SetSize(GetPageRect());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
|
wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
|
||||||
{
|
{
|
||||||
// we need to add the size of the choice control and the border between
|
// we need to add the size of the choice control and the border between
|
||||||
const wxSize sizeChoice = GetChoiceSize();
|
const wxSize sizeChoice = GetControllerSize();
|
||||||
|
|
||||||
wxSize size = sizePage;
|
wxSize size = sizePage;
|
||||||
if ( IsVertical() )
|
if ( IsVertical() )
|
||||||
@@ -229,14 +148,14 @@ wxSize wxChoicebook::CalcSizeFromPage(const wxSize& sizePage) const
|
|||||||
|
|
||||||
bool wxChoicebook::SetPageText(size_t n, const wxString& strText)
|
bool wxChoicebook::SetPageText(size_t n, const wxString& strText)
|
||||||
{
|
{
|
||||||
m_choice->SetString(n, strText);
|
GetChoiceCtrl()->SetString(n, strText);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxChoicebook::GetPageText(size_t n) const
|
wxString wxChoicebook::GetPageText(size_t n) const
|
||||||
{
|
{
|
||||||
return m_choice->GetString(n);
|
return GetChoiceCtrl()->GetString(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxChoicebook::GetPageImage(size_t WXUNUSED(n)) const
|
int wxChoicebook::GetPageImage(size_t WXUNUSED(n)) const
|
||||||
@@ -297,7 +216,7 @@ int wxChoicebook::SetSelection(size_t n)
|
|||||||
|
|
||||||
// change m_selection now to ignore the selection change event
|
// change m_selection now to ignore the selection change event
|
||||||
m_selection = n;
|
m_selection = n;
|
||||||
m_choice->Select(n);
|
GetChoiceCtrl()->Select(n);
|
||||||
|
|
||||||
// program allows the page change
|
// program allows the page change
|
||||||
event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED);
|
event.SetEventType(wxEVT_COMMAND_CHOICEBOOK_PAGE_CHANGED);
|
||||||
@@ -322,7 +241,7 @@ wxChoicebook::InsertPage(size_t n,
|
|||||||
if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
|
if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_choice->Insert(text, n);
|
GetChoiceCtrl()->Insert(text, n);
|
||||||
|
|
||||||
// if the inserted page is before the selected one, we must update the
|
// if the inserted page is before the selected one, we must update the
|
||||||
// index of the selected page
|
// index of the selected page
|
||||||
@@ -330,7 +249,7 @@ wxChoicebook::InsertPage(size_t n,
|
|||||||
{
|
{
|
||||||
// one extra page added
|
// one extra page added
|
||||||
m_selection++;
|
m_selection++;
|
||||||
m_choice->Select(m_selection);
|
GetChoiceCtrl()->Select(m_selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// some page should be selected: either this one or the first one if there
|
// some page should be selected: either this one or the first one if there
|
||||||
@@ -358,7 +277,7 @@ wxWindow *wxChoicebook::DoRemovePage(size_t page)
|
|||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
m_choice->Delete(page);
|
GetChoiceCtrl()->Delete(page);
|
||||||
|
|
||||||
if (m_selection >= (int)page)
|
if (m_selection >= (int)page)
|
||||||
{
|
{
|
||||||
@@ -383,7 +302,7 @@ wxWindow *wxChoicebook::DoRemovePage(size_t page)
|
|||||||
|
|
||||||
bool wxChoicebook::DeleteAllPages()
|
bool wxChoicebook::DeleteAllPages()
|
||||||
{
|
{
|
||||||
m_choice->Clear();
|
GetChoiceCtrl()->Clear();
|
||||||
return wxBookCtrlBase::DeleteAllPages();
|
return wxBookCtrlBase::DeleteAllPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -407,7 +326,7 @@ void wxChoicebook::OnChoiceSelected(wxCommandEvent& eventChoice)
|
|||||||
|
|
||||||
// change wasn't allowed, return to previous state
|
// change wasn't allowed, return to previous state
|
||||||
if (m_selection != selNew)
|
if (m_selection != selNew)
|
||||||
m_choice->Select(m_selection);
|
GetChoiceCtrl()->Select(m_selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_CHOICEBOOK
|
#endif // wxUSE_CHOICEBOOK
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: generic/listbkg.cpp
|
// Name: src/generic/listbkg.cpp
|
||||||
// Purpose: generic implementation of wxListbook
|
// Purpose: generic implementation of wxListbook
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -43,7 +43,7 @@
|
|||||||
// event table
|
// event table
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxListbook, wxBookCtrlBase)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxListbookEvent, wxNotifyEvent)
|
||||||
|
|
||||||
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
|
const wxEventType wxEVT_COMMAND_LISTBOOK_PAGE_CHANGING = wxNewEventType();
|
||||||
@@ -65,10 +65,6 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void wxListbook::Init()
|
void wxListbook::Init()
|
||||||
{
|
{
|
||||||
m_list = NULL;
|
|
||||||
#if wxUSE_LINE_IN_LISTBOOK
|
|
||||||
m_line = NULL;
|
|
||||||
#endif // wxUSE_LINE_IN_LISTBOOK
|
|
||||||
m_selection = wxNOT_FOUND;
|
m_selection = wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -80,12 +76,12 @@ wxListbook::Create(wxWindow *parent,
|
|||||||
long style,
|
long style,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
if ( (style & wxLB_ALIGN_MASK) == wxLB_DEFAULT )
|
if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
|
||||||
{
|
{
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
style |= wxLB_TOP;
|
style |= wxBK_TOP;
|
||||||
#else // !__WXMAC__
|
#else // !__WXMAC__
|
||||||
style |= wxLB_LEFT;
|
style |= wxBK_LEFT;
|
||||||
#endif // __WXMAC__/!__WXMAC__
|
#endif // __WXMAC__/!__WXMAC__
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,7 +94,7 @@ wxListbook::Create(wxWindow *parent,
|
|||||||
wxDefaultValidator, name) )
|
wxDefaultValidator, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_list = new wxListView
|
m_bookctrl = new wxListView
|
||||||
(
|
(
|
||||||
this,
|
this,
|
||||||
wxID_LISTBOOKLISTVIEW,
|
wxID_LISTBOOKLISTVIEW,
|
||||||
@@ -108,19 +104,8 @@ wxListbook::Create(wxWindow *parent,
|
|||||||
(IsVertical() ? wxLC_ALIGN_LEFT : wxLC_ALIGN_TOP)
|
(IsVertical() ? wxLC_ALIGN_LEFT : wxLC_ALIGN_TOP)
|
||||||
);
|
);
|
||||||
|
|
||||||
#if wxUSE_LINE_IN_LISTBOOK
|
|
||||||
m_line = new wxStaticLine
|
|
||||||
(
|
|
||||||
this,
|
|
||||||
wxID_ANY,
|
|
||||||
wxDefaultPosition,
|
|
||||||
wxDefaultSize,
|
|
||||||
IsVertical() ? wxLI_HORIZONTAL : wxLI_VERTICAL
|
|
||||||
);
|
|
||||||
#endif // wxUSE_LINE_IN_LISTBOOK
|
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// On XP with themes enabled the GetViewRect used in GetListSize to
|
// On XP with themes enabled the GetViewRect used in GetControllerSize() to
|
||||||
// determine the space needed for the list view will incorrectly return
|
// determine the space needed for the list view will incorrectly return
|
||||||
// (0,0,0,0) the first time. So send a pending event so OnSize will be
|
// (0,0,0,0) the first time. So send a pending event so OnSize will be
|
||||||
// called again after the window is ready to go. Technically we don't
|
// called again after the window is ready to go. Technically we don't
|
||||||
@@ -136,13 +121,14 @@ wxListbook::Create(wxWindow *parent,
|
|||||||
// wxListbook geometry management
|
// wxListbook geometry management
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSize wxListbook::GetListSize() const
|
wxSize wxListbook::GetControllerSize() const
|
||||||
{
|
{
|
||||||
const wxSize sizeClient = GetClientSize(),
|
const wxSize sizeClient = GetClientSize(),
|
||||||
sizeBorder = m_list->GetSize() - m_list->GetClientSize(),
|
sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(),
|
||||||
sizeList = m_list->GetViewRect().GetSize() + sizeBorder;
|
sizeList = GetListView()->GetViewRect().GetSize() + sizeBorder;
|
||||||
|
|
||||||
wxSize size;
|
wxSize size;
|
||||||
|
|
||||||
if ( IsVertical() )
|
if ( IsVertical() )
|
||||||
{
|
{
|
||||||
size.x = sizeClient.x;
|
size.x = sizeClient.x;
|
||||||
@@ -157,132 +143,22 @@ wxSize wxListbook::GetListSize() const
|
|||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxListbook::GetPageRect() const
|
|
||||||
{
|
|
||||||
const wxSize sizeList = m_list->GetSize();
|
|
||||||
|
|
||||||
wxPoint pt;
|
|
||||||
wxRect rectPage(pt, GetClientSize());
|
|
||||||
switch ( GetWindowStyle() & wxLB_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected wxListbook alignment") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxLB_TOP:
|
|
||||||
rectPage.y = sizeList.y + GetInternalBorder();
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxLB_BOTTOM:
|
|
||||||
rectPage.height -= sizeList.y + GetInternalBorder();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxLB_LEFT:
|
|
||||||
rectPage.x = sizeList.x + GetInternalBorder();
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxLB_RIGHT:
|
|
||||||
rectPage.width -= sizeList.x + GetInternalBorder();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rectPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxListbook::OnSize(wxSizeEvent& event)
|
void wxListbook::OnSize(wxSizeEvent& event)
|
||||||
{
|
{
|
||||||
event.Skip();
|
|
||||||
|
|
||||||
if ( !m_list )
|
|
||||||
{
|
|
||||||
// we're not fully created yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// arrange the icons before calling SetClientSize(), otherwise it wouldn't
|
// arrange the icons before calling SetClientSize(), otherwise it wouldn't
|
||||||
// account for the scrollbars the list control might need and, at least
|
// account for the scrollbars the list control might need and, at least
|
||||||
// under MSW, we'd finish with an ugly looking list control with both
|
// under MSW, we'd finish with an ugly looking list control with both
|
||||||
// vertical and horizontal scrollbar (with one of them being added because
|
// vertical and horizontal scrollbar (with one of them being added because
|
||||||
// the other one is not accounted for in client size computations)
|
// the other one is not accounted for in client size computations)
|
||||||
m_list->Arrange();
|
wxListView *list = GetListView();
|
||||||
|
if (list) list->Arrange();
|
||||||
// resize the list control and the page area to fit inside our new size
|
wxBookCtrlBase::OnSize(event);
|
||||||
const wxSize sizeClient = GetClientSize(),
|
|
||||||
sizeBorder = m_list->GetSize() - m_list->GetClientSize(),
|
|
||||||
sizeList = GetListSize();
|
|
||||||
|
|
||||||
m_list->SetClientSize( sizeList.x - sizeBorder.x, sizeList.y - sizeBorder.y );
|
|
||||||
|
|
||||||
const wxSize sizeNew = m_list->GetSize();
|
|
||||||
wxPoint posList;
|
|
||||||
switch ( GetWindowStyle() & wxLB_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected wxListbook alignment") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxLB_TOP:
|
|
||||||
case wxLB_LEFT:
|
|
||||||
// posList is already ok
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxLB_BOTTOM:
|
|
||||||
posList.y = sizeClient.y - sizeNew.y;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxLB_RIGHT:
|
|
||||||
posList.x = sizeClient.x - sizeNew.x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_list->GetPosition() != posList )
|
|
||||||
m_list->Move(posList);
|
|
||||||
|
|
||||||
#if wxUSE_LINE_IN_LISTBOOK
|
|
||||||
if ( m_line )
|
|
||||||
{
|
|
||||||
wxRect rectLine(sizeClient);
|
|
||||||
|
|
||||||
switch ( GetWindowStyle() & wxLB_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
case wxLB_TOP:
|
|
||||||
rectLine.y = sizeNew.y + 1;
|
|
||||||
rectLine.height = GetInternalBorder() - 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxLB_BOTTOM:
|
|
||||||
rectLine.height = GetInternalBorder() - 2;
|
|
||||||
rectLine.y = sizeClient.y - sizeNew.y - rectLine.height;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxLB_LEFT:
|
|
||||||
rectLine.x = sizeNew.x + 1;
|
|
||||||
rectLine.width = GetInternalBorder() - 2;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxLB_RIGHT:
|
|
||||||
rectLine.width = GetInternalBorder() - 2;
|
|
||||||
rectLine.x = sizeClient.x - sizeNew.x - rectLine.width;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_line->SetSize(rectLine);
|
|
||||||
}
|
|
||||||
#endif // wxUSE_LINE_IN_LISTBOOK
|
|
||||||
|
|
||||||
// resize the currently shown page
|
|
||||||
if (m_selection != wxNOT_FOUND )
|
|
||||||
{
|
|
||||||
wxWindow *page = m_pages[m_selection];
|
|
||||||
wxCHECK_RET( page, _T("NULL page in wxListbook?") );
|
|
||||||
page->SetSize(GetPageRect());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const
|
wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const
|
||||||
{
|
{
|
||||||
// we need to add the size of the list control and the border between
|
// we need to add the size of the list control and the border between
|
||||||
const wxSize sizeList = GetListSize();
|
const wxSize sizeList = GetControllerSize();
|
||||||
|
|
||||||
wxSize size = sizePage;
|
wxSize size = sizePage;
|
||||||
if ( IsVertical() )
|
if ( IsVertical() )
|
||||||
@@ -304,14 +180,14 @@ wxSize wxListbook::CalcSizeFromPage(const wxSize& sizePage) const
|
|||||||
|
|
||||||
bool wxListbook::SetPageText(size_t n, const wxString& strText)
|
bool wxListbook::SetPageText(size_t n, const wxString& strText)
|
||||||
{
|
{
|
||||||
m_list->SetItemText(n, strText);
|
GetListView()->SetItemText(n, strText);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString wxListbook::GetPageText(size_t n) const
|
wxString wxListbook::GetPageText(size_t n) const
|
||||||
{
|
{
|
||||||
return m_list->GetItemText(n);
|
return GetListView()->GetItemText(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListbook::GetPageImage(size_t WXUNUSED(n)) const
|
int wxListbook::GetPageImage(size_t WXUNUSED(n)) const
|
||||||
@@ -323,7 +199,7 @@ int wxListbook::GetPageImage(size_t WXUNUSED(n)) const
|
|||||||
|
|
||||||
bool wxListbook::SetPageImage(size_t n, int imageId)
|
bool wxListbook::SetPageImage(size_t n, int imageId)
|
||||||
{
|
{
|
||||||
return m_list->SetItemImage(n, imageId);
|
return GetListView()->SetItemImage(n, imageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -332,7 +208,7 @@ bool wxListbook::SetPageImage(size_t n, int imageId)
|
|||||||
|
|
||||||
void wxListbook::SetImageList(wxImageList *imageList)
|
void wxListbook::SetImageList(wxImageList *imageList)
|
||||||
{
|
{
|
||||||
m_list->SetImageList(imageList, wxIMAGE_LIST_NORMAL);
|
GetListView()->SetImageList(imageList, wxIMAGE_LIST_NORMAL);
|
||||||
|
|
||||||
wxBookCtrlBase::SetImageList(imageList);
|
wxBookCtrlBase::SetImageList(imageList);
|
||||||
}
|
}
|
||||||
@@ -370,8 +246,8 @@ int wxListbook::SetSelection(size_t n)
|
|||||||
|
|
||||||
// change m_selection now to ignore the selection change event
|
// change m_selection now to ignore the selection change event
|
||||||
m_selection = n;
|
m_selection = n;
|
||||||
m_list->Select(n);
|
GetListView()->Select(n);
|
||||||
m_list->Focus(n);
|
GetListView()->Focus(n);
|
||||||
|
|
||||||
// program allows the page change
|
// program allows the page change
|
||||||
event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED);
|
event.SetEventType(wxEVT_COMMAND_LISTBOOK_PAGE_CHANGED);
|
||||||
@@ -396,7 +272,7 @@ wxListbook::InsertPage(size_t n,
|
|||||||
if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
|
if ( !wxBookCtrlBase::InsertPage(n, page, text, bSelect, imageId) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_list->InsertItem(n, text, imageId);
|
GetListView()->InsertItem(n, text, imageId);
|
||||||
|
|
||||||
// if the inserted page is before the selected one, we must update the
|
// if the inserted page is before the selected one, we must update the
|
||||||
// index of the selected page
|
// index of the selected page
|
||||||
@@ -404,8 +280,8 @@ wxListbook::InsertPage(size_t n,
|
|||||||
{
|
{
|
||||||
// one extra page added
|
// one extra page added
|
||||||
m_selection++;
|
m_selection++;
|
||||||
m_list->Select(m_selection);
|
GetListView()->Select(m_selection);
|
||||||
m_list->Focus(m_selection);
|
GetListView()->Focus(m_selection);
|
||||||
}
|
}
|
||||||
|
|
||||||
// some page should be selected: either this one or the first one if there
|
// some page should be selected: either this one or the first one if there
|
||||||
@@ -423,7 +299,7 @@ wxListbook::InsertPage(size_t n,
|
|||||||
SetSelection(selNew);
|
SetSelection(selNew);
|
||||||
|
|
||||||
InvalidateBestSize();
|
InvalidateBestSize();
|
||||||
m_list->Arrange();
|
GetListView()->Arrange();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -434,7 +310,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
|||||||
|
|
||||||
if ( win )
|
if ( win )
|
||||||
{
|
{
|
||||||
m_list->DeleteItem(page);
|
GetListView()->DeleteItem(page);
|
||||||
|
|
||||||
if (m_selection >= (int)page)
|
if (m_selection >= (int)page)
|
||||||
{
|
{
|
||||||
@@ -452,7 +328,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
|||||||
SetSelection(sel);
|
SetSelection(sel);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_list->Arrange();
|
GetListView()->Arrange();
|
||||||
}
|
}
|
||||||
|
|
||||||
return win;
|
return win;
|
||||||
@@ -461,7 +337,7 @@ wxWindow *wxListbook::DoRemovePage(size_t page)
|
|||||||
|
|
||||||
bool wxListbook::DeleteAllPages()
|
bool wxListbook::DeleteAllPages()
|
||||||
{
|
{
|
||||||
m_list->DeleteAllItems();
|
GetListView()->DeleteAllItems();
|
||||||
return wxBookCtrlBase::DeleteAllPages();
|
return wxBookCtrlBase::DeleteAllPages();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -486,8 +362,8 @@ void wxListbook::OnListSelected(wxListEvent& eventList)
|
|||||||
// change wasn't allowed, return to previous state
|
// change wasn't allowed, return to previous state
|
||||||
if (m_selection != selNew)
|
if (m_selection != selNew)
|
||||||
{
|
{
|
||||||
m_list->Select(m_selection);
|
GetListView()->Select(m_selection);
|
||||||
m_list->Focus(m_selection);
|
GetListView()->Focus(m_selection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: propdlg.cpp
|
// Name: src/generic/propdlg.cpp
|
||||||
// Purpose: wxPropertySheetDialog
|
// Purpose: wxPropertySheetDialog
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -110,9 +110,9 @@ wxBookCtrlBase* wxPropertySheetDialog::CreateBookCtrl()
|
|||||||
{
|
{
|
||||||
int style = wxCLIP_CHILDREN;
|
int style = wxCLIP_CHILDREN;
|
||||||
#if defined(__POCKETPC__) && wxUSE_NOTEBOOK
|
#if defined(__POCKETPC__) && wxUSE_NOTEBOOK
|
||||||
style |= wxNB_BOTTOM|wxNB_FLAT;
|
style |= wxBK_BOTTOM|wxNB_FLAT;
|
||||||
#else
|
#else
|
||||||
style |= wxBC_DEFAULT;
|
style |= wxBK_DEFAULT;
|
||||||
#endif
|
#endif
|
||||||
return new wxBookCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
return new wxBookCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
|
||||||
}
|
}
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
// event table
|
// event table
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxTreebook, wxBookCtrlBase)
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxTreebookEvent, wxNotifyEvent)
|
IMPLEMENT_DYNAMIC_CLASS(wxTreebookEvent, wxNotifyEvent)
|
||||||
|
|
||||||
const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxNewEventType();
|
const wxEventType wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING = wxNewEventType();
|
||||||
@@ -51,7 +51,6 @@ const wxEventType wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED = wxNewEventType();
|
|||||||
const int wxID_TREEBOOKTREEVIEW = wxNewId();
|
const int wxID_TREEBOOKTREEVIEW = wxNewId();
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE(wxTreebook, wxBookCtrlBase)
|
BEGIN_EVENT_TABLE(wxTreebook, wxBookCtrlBase)
|
||||||
EVT_SIZE(wxTreebook::OnSize)
|
|
||||||
EVT_TREE_SEL_CHANGED (wxID_TREEBOOKTREEVIEW, wxTreebook::OnTreeSelectionChange)
|
EVT_TREE_SEL_CHANGED (wxID_TREEBOOKTREEVIEW, wxTreebook::OnTreeSelectionChange)
|
||||||
EVT_TREE_ITEM_EXPANDED (wxID_TREEBOOKTREEVIEW, wxTreebook::OnTreeNodeExpandedCollapsed)
|
EVT_TREE_ITEM_EXPANDED (wxID_TREEBOOKTREEVIEW, wxTreebook::OnTreeNodeExpandedCollapsed)
|
||||||
EVT_TREE_ITEM_COLLAPSED(wxID_TREEBOOKTREEVIEW, wxTreebook::OnTreeNodeExpandedCollapsed)
|
EVT_TREE_ITEM_COLLAPSED(wxID_TREEBOOKTREEVIEW, wxTreebook::OnTreeNodeExpandedCollapsed)
|
||||||
@@ -67,7 +66,6 @@ END_EVENT_TABLE()
|
|||||||
|
|
||||||
void wxTreebook::Init()
|
void wxTreebook::Init()
|
||||||
{
|
{
|
||||||
m_tree = NULL;
|
|
||||||
m_selection =
|
m_selection =
|
||||||
m_actualSelection = wxNOT_FOUND;
|
m_actualSelection = wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
@@ -81,14 +79,9 @@ wxTreebook::Create(wxWindow *parent,
|
|||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
// Check the style flag to have either wxTBK_RIGHT or wxTBK_LEFT
|
// Check the style flag to have either wxTBK_RIGHT or wxTBK_LEFT
|
||||||
if ( style & wxTBK_RIGHT )
|
if ( (style & wxBK_ALIGN_MASK) == wxBK_DEFAULT )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( !(style & wxTBK_LEFT),
|
style |= wxBK_LEFT;
|
||||||
_T("RIGHT and LEFT can't be used together") );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
style |= wxTBK_LEFT;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// no border for this control, it doesn't look nice together with the tree
|
// no border for this control, it doesn't look nice together with the tree
|
||||||
@@ -99,7 +92,7 @@ wxTreebook::Create(wxWindow *parent,
|
|||||||
style, wxDefaultValidator, name) )
|
style, wxDefaultValidator, name) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_tree = new wxTreeCtrl
|
m_bookctrl = new wxTreeCtrl
|
||||||
(
|
(
|
||||||
this,
|
this,
|
||||||
wxID_TREEBOOKTREEVIEW,
|
wxID_TREEBOOKTREEVIEW,
|
||||||
@@ -110,16 +103,10 @@ wxTreebook::Create(wxWindow *parent,
|
|||||||
wxTR_HIDE_ROOT |
|
wxTR_HIDE_ROOT |
|
||||||
wxTR_SINGLE
|
wxTR_SINGLE
|
||||||
);
|
);
|
||||||
m_tree->AddRoot(wxEmptyString); // label doesn't matter, it's hidden
|
GetTreeCtrl()->AddRoot(wxEmptyString); // label doesn't matter, it's hidden
|
||||||
|
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
// see listbook.h for origins of that
|
// We need to add dummy size event to force possible scrollbar hiding
|
||||||
// On XP with themes enabled the GetViewRect used in GetListSize to
|
|
||||||
// determine the space needed for the list view will incorrectly return
|
|
||||||
// (0,0,0,0) the first time. So send a pending event so OnSize will be
|
|
||||||
// called again after the window is ready to go. Technically we don't
|
|
||||||
// need to do this on non-XP windows, but if things are already sized
|
|
||||||
// correctly then nothing changes and so there is no harm.
|
|
||||||
wxSizeEvent evt;
|
wxSizeEvent evt;
|
||||||
GetEventHandler()->AddPendingEvent(evt);
|
GetEventHandler()->AddPendingEvent(evt);
|
||||||
#endif
|
#endif
|
||||||
@@ -172,31 +159,32 @@ bool wxTreebook::DoInsertPage(size_t pagePos,
|
|||||||
if ( !wxBookCtrlBase::InsertPage(pagePos, page, text, bSelect, imageId) )
|
if ( !wxBookCtrlBase::InsertPage(pagePos, page, text, bSelect, imageId) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
wxTreeItemId newId;
|
wxTreeItemId newId;
|
||||||
if ( pagePos == DoInternalGetPageCount() )
|
if ( pagePos == DoInternalGetPageCount() )
|
||||||
{
|
{
|
||||||
// append the page to the end
|
// append the page to the end
|
||||||
wxTreeItemId rootId = m_tree->GetRootItem();
|
wxTreeItemId rootId = tree->GetRootItem();
|
||||||
|
|
||||||
newId = m_tree->AppendItem(rootId, text, imageId);
|
newId = tree->AppendItem(rootId, text, imageId);
|
||||||
}
|
}
|
||||||
else // insert the new page before the given one
|
else // insert the new page before the given one
|
||||||
{
|
{
|
||||||
wxTreeItemId nodeId = m_treeIds[pagePos];
|
wxTreeItemId nodeId = m_treeIds[pagePos];
|
||||||
|
|
||||||
wxTreeItemId previousId = m_tree->GetPrevSibling(nodeId);
|
wxTreeItemId previousId = tree->GetPrevSibling(nodeId);
|
||||||
wxTreeItemId parentId = m_tree->GetItemParent(nodeId);
|
wxTreeItemId parentId = tree->GetItemParent(nodeId);
|
||||||
|
|
||||||
if ( previousId.IsOk() )
|
if ( previousId.IsOk() )
|
||||||
{
|
{
|
||||||
// insert before the sibling - previousId
|
// insert before the sibling - previousId
|
||||||
newId = m_tree->InsertItem(parentId, previousId, text, imageId);
|
newId = tree->InsertItem(parentId, previousId, text, imageId);
|
||||||
}
|
}
|
||||||
else // no prev siblings -- insert as a first child
|
else // no prev siblings -- insert as a first child
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( parentId.IsOk(), wxT( "Tree has no root node?" ) );
|
wxASSERT_MSG( parentId.IsOk(), wxT( "Tree has no root node?" ) );
|
||||||
|
|
||||||
newId = m_tree->PrependItem(parentId, text, imageId);
|
newId = tree->PrependItem(parentId, text, imageId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -213,23 +201,25 @@ bool wxTreebook::DoInsertPage(size_t pagePos,
|
|||||||
|
|
||||||
DoUpdateSelection(bSelect, pagePos);
|
DoUpdateSelection(bSelect, pagePos);
|
||||||
|
|
||||||
m_tree->InvalidateBestSize();
|
m_bookctrl->InvalidateBestSize();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreebook::DoAddSubPage(wxWindow *page, const wxString& text, bool bSelect, int imageId)
|
bool wxTreebook::DoAddSubPage(wxWindow *page, const wxString& text, bool bSelect, int imageId)
|
||||||
{
|
{
|
||||||
wxTreeItemId rootId = m_tree->GetRootItem();
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
|
|
||||||
wxTreeItemId lastNodeId = m_tree->GetLastChild(rootId);
|
wxTreeItemId rootId = tree->GetRootItem();
|
||||||
|
|
||||||
|
wxTreeItemId lastNodeId = tree->GetLastChild(rootId);
|
||||||
|
|
||||||
wxCHECK_MSG( lastNodeId.IsOk(), false,
|
wxCHECK_MSG( lastNodeId.IsOk(), false,
|
||||||
_T("Can't insert sub page when there are no pages") );
|
_T("Can't insert sub page when there are no pages") );
|
||||||
|
|
||||||
// now calculate its position (should we save/update it too?)
|
// now calculate its position (should we save/update it too?)
|
||||||
size_t newPos = m_tree->GetCount() -
|
size_t newPos = tree->GetCount() -
|
||||||
(m_tree->GetChildrenCount(lastNodeId, true) + 1);
|
(tree->GetChildrenCount(lastNodeId, true) + 1);
|
||||||
|
|
||||||
return DoInsertSubPage(newPos, page, text, bSelect, imageId);
|
return DoInsertSubPage(newPos, page, text, bSelect, imageId);
|
||||||
}
|
}
|
||||||
@@ -243,14 +233,16 @@ bool wxTreebook::DoInsertSubPage(size_t pagePos,
|
|||||||
wxTreeItemId parentId = DoInternalGetPage(pagePos);
|
wxTreeItemId parentId = DoInternalGetPage(pagePos);
|
||||||
wxCHECK_MSG( parentId.IsOk(), false, wxT("invalid tree item") );
|
wxCHECK_MSG( parentId.IsOk(), false, wxT("invalid tree item") );
|
||||||
|
|
||||||
size_t newPos = pagePos + m_tree->GetChildrenCount(parentId, true) + 1;
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
|
|
||||||
|
size_t newPos = pagePos + tree->GetChildrenCount(parentId, true) + 1;
|
||||||
wxASSERT_MSG( newPos <= DoInternalGetPageCount(),
|
wxASSERT_MSG( newPos <= DoInternalGetPageCount(),
|
||||||
wxT("Internal error in tree insert point calculation") );
|
wxT("Internal error in tree insert point calculation") );
|
||||||
|
|
||||||
if ( !wxBookCtrlBase::InsertPage(newPos, page, text, bSelect, imageId) )
|
if ( !wxBookCtrlBase::InsertPage(newPos, page, text, bSelect, imageId) )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
wxTreeItemId newId = m_tree->AppendItem(parentId, text, imageId);
|
wxTreeItemId newId = tree->AppendItem(parentId, text, imageId);
|
||||||
|
|
||||||
if ( !newId.IsOk() )
|
if ( !newId.IsOk() )
|
||||||
{
|
{
|
||||||
@@ -264,7 +256,7 @@ bool wxTreebook::DoInsertSubPage(size_t pagePos,
|
|||||||
|
|
||||||
DoUpdateSelection(bSelect, newPos);
|
DoUpdateSelection(bSelect, newPos);
|
||||||
|
|
||||||
m_tree->InvalidateBestSize();
|
m_bookctrl->InvalidateBestSize();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -288,8 +280,9 @@ wxTreebookPage *wxTreebook::DoRemovePage(size_t pagePos)
|
|||||||
wxCHECK_MSG( pageId.IsOk(), NULL, wxT("Invalid tree index") );
|
wxCHECK_MSG( pageId.IsOk(), NULL, wxT("Invalid tree index") );
|
||||||
|
|
||||||
wxTreebookPage * oldPage = GetPage(pagePos);
|
wxTreebookPage * oldPage = GetPage(pagePos);
|
||||||
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
|
|
||||||
size_t subCount = m_tree->GetChildrenCount(pageId, true);
|
size_t subCount = tree->GetChildrenCount(pageId, true);
|
||||||
wxASSERT_MSG ( IS_VALID_PAGE(pagePos + subCount),
|
wxASSERT_MSG ( IS_VALID_PAGE(pagePos + subCount),
|
||||||
wxT("Internal error in wxTreebook::DoRemovePage") );
|
wxT("Internal error in wxTreebook::DoRemovePage") );
|
||||||
|
|
||||||
@@ -311,9 +304,9 @@ wxTreebookPage *wxTreebook::DoRemovePage(size_t pagePos)
|
|||||||
|
|
||||||
DoInternalRemovePageRange(pagePos, subCount);
|
DoInternalRemovePageRange(pagePos, subCount);
|
||||||
|
|
||||||
m_tree->DeleteChildren( pageId );
|
tree->DeleteChildren( pageId );
|
||||||
m_tree->Delete( pageId );
|
tree->Delete( pageId );
|
||||||
m_tree->InvalidateBestSize();
|
tree->InvalidateBestSize();
|
||||||
|
|
||||||
return oldPage;
|
return oldPage;
|
||||||
}
|
}
|
||||||
@@ -325,7 +318,8 @@ bool wxTreebook::DeleteAllPages()
|
|||||||
m_selection =
|
m_selection =
|
||||||
m_actualSelection = wxNOT_FOUND;
|
m_actualSelection = wxNOT_FOUND;
|
||||||
|
|
||||||
m_tree->DeleteChildren(m_tree->GetRootItem());
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
|
tree->DeleteChildren(tree->GetRootItem());
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -389,9 +383,11 @@ void wxTreebook::DoInternalRemovePageRange(size_t pagePos, size_t subCount)
|
|||||||
}
|
}
|
||||||
else if ( (size_t)m_selection >= pagePos )
|
else if ( (size_t)m_selection >= pagePos )
|
||||||
{
|
{
|
||||||
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
|
|
||||||
// as selected page is going to be deleted, try to select the next
|
// as selected page is going to be deleted, try to select the next
|
||||||
// sibling if exists, if not then the parent
|
// sibling if exists, if not then the parent
|
||||||
wxTreeItemId nodeId = m_tree->GetNextSibling(pageId);
|
wxTreeItemId nodeId = tree->GetNextSibling(pageId);
|
||||||
|
|
||||||
m_selection = wxNOT_FOUND;
|
m_selection = wxNOT_FOUND;
|
||||||
m_actualSelection = wxNOT_FOUND;
|
m_actualSelection = wxNOT_FOUND;
|
||||||
@@ -399,15 +395,15 @@ void wxTreebook::DoInternalRemovePageRange(size_t pagePos, size_t subCount)
|
|||||||
if ( nodeId.IsOk() )
|
if ( nodeId.IsOk() )
|
||||||
{
|
{
|
||||||
// selecting next siblings
|
// selecting next siblings
|
||||||
m_tree->SelectItem(nodeId);
|
tree->SelectItem(nodeId);
|
||||||
}
|
}
|
||||||
else // no next sibling, select the parent
|
else // no next sibling, select the parent
|
||||||
{
|
{
|
||||||
wxTreeItemId parentId = m_tree->GetItemParent(pageId);
|
wxTreeItemId parentId = tree->GetItemParent(pageId);
|
||||||
|
|
||||||
if ( parentId.IsOk() && parentId != m_tree->GetRootItem() )
|
if ( parentId.IsOk() && parentId != tree->GetRootItem() )
|
||||||
{
|
{
|
||||||
m_tree->SelectItem(parentId);
|
tree->SelectItem(parentId);
|
||||||
}
|
}
|
||||||
else // parent is root
|
else // parent is root
|
||||||
{
|
{
|
||||||
@@ -486,7 +482,7 @@ bool wxTreebook::IsNodeExpanded(size_t pagePos) const
|
|||||||
|
|
||||||
wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") );
|
wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") );
|
||||||
|
|
||||||
return m_tree->IsExpanded(pageId);
|
return GetTreeCtrl()->IsExpanded(pageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreebook::ExpandNode(size_t pagePos, bool expand)
|
bool wxTreebook::ExpandNode(size_t pagePos, bool expand)
|
||||||
@@ -497,11 +493,11 @@ bool wxTreebook::ExpandNode(size_t pagePos, bool expand)
|
|||||||
|
|
||||||
if ( expand )
|
if ( expand )
|
||||||
{
|
{
|
||||||
m_tree->Expand( pageId );
|
GetTreeCtrl()->Expand( pageId );
|
||||||
}
|
}
|
||||||
else // collapse
|
else // collapse
|
||||||
{
|
{
|
||||||
m_tree->Collapse( pageId );
|
GetTreeCtrl()->Collapse( pageId );
|
||||||
|
|
||||||
// rely on the events generated by wxTreeCtrl to update selection
|
// rely on the events generated by wxTreeCtrl to update selection
|
||||||
}
|
}
|
||||||
@@ -514,7 +510,7 @@ int wxTreebook::GetPageParent(size_t pagePos) const
|
|||||||
wxTreeItemId nodeId = DoInternalGetPage( pagePos );
|
wxTreeItemId nodeId = DoInternalGetPage( pagePos );
|
||||||
wxCHECK_MSG( nodeId.IsOk(), wxNOT_FOUND, wxT("Invalid page index spacified!") );
|
wxCHECK_MSG( nodeId.IsOk(), wxNOT_FOUND, wxT("Invalid page index spacified!") );
|
||||||
|
|
||||||
const wxTreeItemId parent = m_tree->GetItemParent( nodeId );
|
const wxTreeItemId parent = GetTreeCtrl()->GetItemParent( nodeId );
|
||||||
|
|
||||||
return parent.IsOk() ? DoInternalFindPageById(parent) : wxNOT_FOUND;
|
return parent.IsOk() ? DoInternalFindPageById(parent) : wxNOT_FOUND;
|
||||||
}
|
}
|
||||||
@@ -525,7 +521,7 @@ bool wxTreebook::SetPageText(size_t n, const wxString& strText)
|
|||||||
|
|
||||||
wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") );
|
wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") );
|
||||||
|
|
||||||
m_tree->SetItemText(pageId, strText);
|
GetTreeCtrl()->SetItemText(pageId, strText);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -536,7 +532,7 @@ wxString wxTreebook::GetPageText(size_t n) const
|
|||||||
|
|
||||||
wxCHECK_MSG( pageId.IsOk(), wxString(), wxT("invalid tree item") );
|
wxCHECK_MSG( pageId.IsOk(), wxString(), wxT("invalid tree item") );
|
||||||
|
|
||||||
return m_tree->GetItemText(pageId);
|
return GetTreeCtrl()->GetItemText(pageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxTreebook::GetPageImage(size_t n) const
|
int wxTreebook::GetPageImage(size_t n) const
|
||||||
@@ -545,7 +541,7 @@ int wxTreebook::GetPageImage(size_t n) const
|
|||||||
|
|
||||||
wxCHECK_MSG( pageId.IsOk(), wxNOT_FOUND, wxT("invalid tree item") );
|
wxCHECK_MSG( pageId.IsOk(), wxNOT_FOUND, wxT("invalid tree item") );
|
||||||
|
|
||||||
return m_tree->GetItemImage(pageId);
|
return GetTreeCtrl()->GetItemImage(pageId);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxTreebook::SetPageImage(size_t n, int imageId)
|
bool wxTreebook::SetPageImage(size_t n, int imageId)
|
||||||
@@ -554,14 +550,14 @@ bool wxTreebook::SetPageImage(size_t n, int imageId)
|
|||||||
|
|
||||||
wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") );
|
wxCHECK_MSG( pageId.IsOk(), false, wxT("invalid tree item") );
|
||||||
|
|
||||||
m_tree->SetItemImage(pageId, imageId);
|
GetTreeCtrl()->SetItemImage(pageId, imageId);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSize wxTreebook::CalcSizeFromPage(const wxSize& sizePage) const
|
wxSize wxTreebook::CalcSizeFromPage(const wxSize& sizePage) const
|
||||||
{
|
{
|
||||||
const wxSize sizeTree = GetTreeSize();
|
const wxSize sizeTree = GetControllerSize();
|
||||||
|
|
||||||
wxSize size = sizePage;
|
wxSize size = sizePage;
|
||||||
size.x += sizeTree.x;
|
size.x += sizeTree.x;
|
||||||
@@ -590,6 +586,7 @@ int wxTreebook::DoSetSelection(size_t pagePos)
|
|||||||
wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!"));
|
wxT("wxTreebook logic error: m_treeIds and m_pages not in sync!"));
|
||||||
|
|
||||||
const int oldSel = m_selection;
|
const int oldSel = m_selection;
|
||||||
|
wxTreeCtrl *tree = GetTreeCtrl();
|
||||||
|
|
||||||
wxTreebookEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId);
|
wxTreebookEvent event(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGING, m_windowId);
|
||||||
event.SetEventObject(this);
|
event.SetEventObject(this);
|
||||||
@@ -619,7 +616,7 @@ int wxTreebook::DoSetSelection(size_t pagePos)
|
|||||||
while ( !page && childId.IsOk() )
|
while ( !page && childId.IsOk() )
|
||||||
{
|
{
|
||||||
wxTreeItemIdValue cookie;
|
wxTreeItemIdValue cookie;
|
||||||
childId = m_tree->GetFirstChild( childId, cookie );
|
childId = tree->GetFirstChild( childId, cookie );
|
||||||
if ( childId.IsOk() )
|
if ( childId.IsOk() )
|
||||||
{
|
{
|
||||||
page = wxBookCtrlBase::GetPage(++m_actualSelection);
|
page = wxBookCtrlBase::GetPage(++m_actualSelection);
|
||||||
@@ -635,7 +632,7 @@ int wxTreebook::DoSetSelection(size_t pagePos)
|
|||||||
page->Show();
|
page->Show();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_tree->SelectItem(DoInternalGetPage(pagePos));
|
tree->SelectItem(DoInternalGetPage(pagePos));
|
||||||
|
|
||||||
// notify about the (now completed) page change
|
// notify about the (now completed) page change
|
||||||
event.SetEventType(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED);
|
event.SetEventType(wxEVT_COMMAND_TREEBOOK_PAGE_CHANGED);
|
||||||
@@ -644,7 +641,7 @@ int wxTreebook::DoSetSelection(size_t pagePos)
|
|||||||
else // page change vetoed
|
else // page change vetoed
|
||||||
{
|
{
|
||||||
// tree selection might have already had changed
|
// tree selection might have already had changed
|
||||||
m_tree->SelectItem(DoInternalGetPage(oldSel));
|
tree->SelectItem(DoInternalGetPage(oldSel));
|
||||||
}
|
}
|
||||||
|
|
||||||
return oldSel;
|
return oldSel;
|
||||||
@@ -653,13 +650,13 @@ int wxTreebook::DoSetSelection(size_t pagePos)
|
|||||||
void wxTreebook::SetImageList(wxImageList *imageList)
|
void wxTreebook::SetImageList(wxImageList *imageList)
|
||||||
{
|
{
|
||||||
wxBookCtrlBase::SetImageList(imageList);
|
wxBookCtrlBase::SetImageList(imageList);
|
||||||
m_tree->SetImageList(imageList);
|
GetTreeCtrl()->SetImageList(imageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxTreebook::AssignImageList(wxImageList *imageList)
|
void wxTreebook::AssignImageList(wxImageList *imageList)
|
||||||
{
|
{
|
||||||
wxBookCtrlBase::AssignImageList(imageList);
|
wxBookCtrlBase::AssignImageList(imageList);
|
||||||
m_tree->SetImageList(imageList);
|
GetTreeCtrl()->SetImageList(imageList);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -671,7 +668,7 @@ void wxTreebook::OnTreeSelectionChange(wxTreeEvent& event)
|
|||||||
wxTreeItemId newId = event.GetItem();
|
wxTreeItemId newId = event.GetItem();
|
||||||
|
|
||||||
if ( (m_selection == wxNOT_FOUND &&
|
if ( (m_selection == wxNOT_FOUND &&
|
||||||
(!newId.IsOk() || newId == m_tree->GetRootItem())) ||
|
(!newId.IsOk() || newId == GetTreeCtrl()->GetRootItem())) ||
|
||||||
(m_selection != wxNOT_FOUND && newId == m_treeIds[m_selection]) )
|
(m_selection != wxNOT_FOUND && newId == m_treeIds[m_selection]) )
|
||||||
{
|
{
|
||||||
// this event can only come when we modify the tree selection ourselves
|
// this event can only come when we modify the tree selection ourselves
|
||||||
@@ -688,12 +685,12 @@ void wxTreebook::OnTreeSelectionChange(wxTreeEvent& event)
|
|||||||
void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event)
|
void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event)
|
||||||
{
|
{
|
||||||
wxTreeItemId nodeId = event.GetItem();
|
wxTreeItemId nodeId = event.GetItem();
|
||||||
if ( !nodeId.IsOk() || nodeId == m_tree->GetRootItem() )
|
if ( !nodeId.IsOk() || nodeId == GetTreeCtrl()->GetRootItem() )
|
||||||
return;
|
return;
|
||||||
int pagePos = DoInternalFindPageById(nodeId);
|
int pagePos = DoInternalFindPageById(nodeId);
|
||||||
wxCHECK_RET( pagePos != wxNOT_FOUND, wxT("Internal problem in wxTreebook!..") );
|
wxCHECK_RET( pagePos != wxNOT_FOUND, wxT("Internal problem in wxTreebook!..") );
|
||||||
|
|
||||||
wxTreebookEvent ev(m_tree->IsExpanded(nodeId)
|
wxTreebookEvent ev(GetTreeCtrl()->IsExpanded(nodeId)
|
||||||
? wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED
|
? wxEVT_COMMAND_TREEBOOK_NODE_EXPANDED
|
||||||
: wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED,
|
: wxEVT_COMMAND_TREEBOOK_NODE_COLLAPSED,
|
||||||
m_windowId);
|
m_windowId);
|
||||||
@@ -709,90 +706,6 @@ void wxTreebook::OnTreeNodeExpandedCollapsed(wxTreeEvent & event)
|
|||||||
// wxTreebook geometry management
|
// wxTreebook geometry management
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxSize wxTreebook::GetTreeSize() const
|
|
||||||
{
|
|
||||||
const wxSize sizeClient = GetClientSize(),
|
|
||||||
sizeBorder = m_tree->GetSize() - m_tree->GetClientSize(),
|
|
||||||
sizeTree = m_tree->GetBestSize() + sizeBorder;
|
|
||||||
|
|
||||||
wxSize size;
|
|
||||||
|
|
||||||
size.x = sizeTree.x;
|
|
||||||
size.y = sizeClient.y;
|
|
||||||
|
|
||||||
return size;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRect wxTreebook::GetPageRect() const
|
|
||||||
{
|
|
||||||
const wxSize sizeTree = m_tree->GetSize();
|
|
||||||
|
|
||||||
wxPoint pt;
|
|
||||||
wxRect rectPage(pt, GetClientSize());
|
|
||||||
switch ( GetWindowStyle() & wxTBK_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected wxTreebook alignment") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxTBK_LEFT:
|
|
||||||
rectPage.x = sizeTree.x; // + MARGIN;
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxTBK_RIGHT:
|
|
||||||
rectPage.width -= sizeTree.x; // + MARGIN;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return rectPage;
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxTreebook::OnSize(wxSizeEvent& event)
|
|
||||||
{
|
|
||||||
event.Skip();
|
|
||||||
|
|
||||||
if ( !m_tree )
|
|
||||||
{
|
|
||||||
// we're not fully created yet
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// resize the list control and the page area to fit inside our new size
|
|
||||||
const wxSize sizeClient = GetClientSize(),
|
|
||||||
sizeBorder = m_tree->GetSize() - m_tree->GetClientSize(),
|
|
||||||
sizeTree = GetTreeSize();
|
|
||||||
|
|
||||||
m_tree->SetClientSize( sizeTree.x - sizeBorder.x, sizeTree.y - sizeBorder.y );
|
|
||||||
|
|
||||||
const wxSize sizeNew = m_tree->GetSize();
|
|
||||||
wxPoint posTree;
|
|
||||||
switch ( GetWindowStyle() & wxTBK_ALIGN_MASK )
|
|
||||||
{
|
|
||||||
default:
|
|
||||||
wxFAIL_MSG( _T("unexpected wxTreebook alignment") );
|
|
||||||
// fall through
|
|
||||||
|
|
||||||
case wxTBK_LEFT:
|
|
||||||
// posTree is already ok
|
|
||||||
break;
|
|
||||||
|
|
||||||
case wxTBK_RIGHT:
|
|
||||||
posTree.x = sizeClient.x - sizeNew.x;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( m_tree->GetPosition() != posTree )
|
|
||||||
m_tree->Move(posTree);
|
|
||||||
|
|
||||||
// resize the currently shown page
|
|
||||||
wxTreebookPage *page = DoGetCurrentPage();
|
|
||||||
if ( page )
|
|
||||||
{
|
|
||||||
wxRect rectPage = GetPageRect();
|
|
||||||
page->SetSize(rectPage);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxTreebookPage * wxTreebook::DoGetCurrentPage() const
|
wxTreebookPage * wxTreebook::DoGetCurrentPage() const
|
||||||
{
|
{
|
||||||
if ( m_selection == wxNOT_FOUND )
|
if ( m_selection == wxNOT_FOUND )
|
||||||
@@ -808,4 +721,3 @@ wxTreebookPage * wxTreebook::DoGetCurrentPage() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif // wxUSE_TREEBOOK
|
#endif // wxUSE_TREEBOOK
|
||||||
|
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: msw/notebook.cpp
|
// Name: src/msw/notebook.cpp
|
||||||
// Purpose: implementation of wxNotebook
|
// Purpose: implementation of wxNotebook
|
||||||
// Author: Vadim Zeitlin
|
// Author: Vadim Zeitlin
|
||||||
// Modified by:
|
// Modified by:
|
||||||
@@ -153,9 +153,11 @@ wxBEGIN_FLAGS( wxNotebookStyle )
|
|||||||
wxFLAGS_MEMBER(wxHSCROLL)
|
wxFLAGS_MEMBER(wxHSCROLL)
|
||||||
|
|
||||||
wxFLAGS_MEMBER(wxNB_FIXEDWIDTH)
|
wxFLAGS_MEMBER(wxNB_FIXEDWIDTH)
|
||||||
wxFLAGS_MEMBER(wxNB_LEFT)
|
wxFLAGS_MEMBER(wxBK_DEFAULT)
|
||||||
wxFLAGS_MEMBER(wxNB_RIGHT)
|
wxFLAGS_MEMBER(wxBK_TOP)
|
||||||
wxFLAGS_MEMBER(wxNB_BOTTOM)
|
wxFLAGS_MEMBER(wxBK_LEFT)
|
||||||
|
wxFLAGS_MEMBER(wxBK_RIGHT)
|
||||||
|
wxFLAGS_MEMBER(wxBK_BOTTOM)
|
||||||
wxFLAGS_MEMBER(wxNB_NOPAGETHEME)
|
wxFLAGS_MEMBER(wxNB_NOPAGETHEME)
|
||||||
wxFLAGS_MEMBER(wxNB_FLAT)
|
wxFLAGS_MEMBER(wxNB_FLAT)
|
||||||
|
|
||||||
@@ -283,7 +285,7 @@ bool wxNotebook::Create(wxWindow *parent,
|
|||||||
if ( wxUxThemeEngine::GetIfActive() )
|
if ( wxUxThemeEngine::GetIfActive() )
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
style &= ~(wxNB_BOTTOM | wxNB_LEFT | wxNB_RIGHT);
|
style &= ~(wxBK_BOTTOM | wxBK_LEFT | wxBK_RIGHT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,11 +376,11 @@ WXDWORD wxNotebook::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
if ( style & wxNB_FIXEDWIDTH )
|
if ( style & wxNB_FIXEDWIDTH )
|
||||||
tabStyle |= TCS_FIXEDWIDTH;
|
tabStyle |= TCS_FIXEDWIDTH;
|
||||||
|
|
||||||
if ( style & wxNB_BOTTOM )
|
if ( style & wxBK_BOTTOM )
|
||||||
tabStyle |= TCS_RIGHT;
|
tabStyle |= TCS_RIGHT;
|
||||||
else if ( style & wxNB_LEFT )
|
else if ( style & wxBK_LEFT )
|
||||||
tabStyle |= TCS_VERTICAL;
|
tabStyle |= TCS_VERTICAL;
|
||||||
else if ( style & wxNB_RIGHT )
|
else if ( style & wxBK_RIGHT )
|
||||||
tabStyle |= TCS_VERTICAL | TCS_RIGHT;
|
tabStyle |= TCS_VERTICAL | TCS_RIGHT;
|
||||||
|
|
||||||
// ex style
|
// ex style
|
||||||
@@ -566,7 +568,7 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
|
|||||||
tabSize.x = rect.right - rect.left;
|
tabSize.x = rect.right - rect.left;
|
||||||
tabSize.y = rect.bottom - rect.top;
|
tabSize.y = rect.bottom - rect.top;
|
||||||
}
|
}
|
||||||
if ( HasFlag(wxNB_LEFT) || HasFlag(wxNB_RIGHT) )
|
if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) )
|
||||||
{
|
{
|
||||||
sizeTotal.x += tabSize.x + 7;
|
sizeTotal.x += tabSize.x + 7;
|
||||||
sizeTotal.y += 7;
|
sizeTotal.y += 7;
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: xh_choicbk.cpp
|
// Name: src/xrc/xh_choicbk.cpp
|
||||||
// Purpose: XRC resource for wxChoicebook
|
// Purpose: XRC resource for wxChoicebook
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Created: 2000/03/21
|
// Created: 2000/03/21
|
||||||
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2000 Vaclav Slavik
|
// Copyright: (c) 2000 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -28,11 +29,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxChoicebookXmlHandler, wxXmlResourceHandler)
|
|||||||
wxChoicebookXmlHandler::wxChoicebookXmlHandler()
|
wxChoicebookXmlHandler::wxChoicebookXmlHandler()
|
||||||
: wxXmlResourceHandler(), m_isInside(false), m_choicebook(NULL)
|
: wxXmlResourceHandler(), m_isInside(false), m_choicebook(NULL)
|
||||||
{
|
{
|
||||||
|
XRC_ADD_STYLE(wxBK_DEFAULT);
|
||||||
|
XRC_ADD_STYLE(wxBK_LEFT);
|
||||||
|
XRC_ADD_STYLE(wxBK_RIGHT);
|
||||||
|
XRC_ADD_STYLE(wxBK_TOP);
|
||||||
|
XRC_ADD_STYLE(wxBK_BOTTOM);
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
XRC_ADD_STYLE(wxCHB_DEFAULT);
|
XRC_ADD_STYLE(wxCHB_DEFAULT);
|
||||||
XRC_ADD_STYLE(wxCHB_LEFT);
|
XRC_ADD_STYLE(wxCHB_LEFT);
|
||||||
XRC_ADD_STYLE(wxCHB_RIGHT);
|
XRC_ADD_STYLE(wxCHB_RIGHT);
|
||||||
XRC_ADD_STYLE(wxCHB_TOP);
|
XRC_ADD_STYLE(wxCHB_TOP);
|
||||||
XRC_ADD_STYLE(wxCHB_BOTTOM);
|
XRC_ADD_STYLE(wxCHB_BOTTOM);
|
||||||
|
#endif
|
||||||
|
|
||||||
AddWindowStyles();
|
AddWindowStyles();
|
||||||
}
|
}
|
||||||
|
@@ -1,8 +1,9 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: xh_listbk.cpp
|
// Name: src/xrc/xh_listbk.cpp
|
||||||
// Purpose: XRC resource for wxListbook
|
// Purpose: XRC resource for wxListbook
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Created: 2000/03/21
|
// Created: 2000/03/21
|
||||||
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 2000 Vaclav Slavik
|
// Copyright: (c) 2000 Vaclav Slavik
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -28,11 +29,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxListbookXmlHandler, wxXmlResourceHandler)
|
|||||||
wxListbookXmlHandler::wxListbookXmlHandler()
|
wxListbookXmlHandler::wxListbookXmlHandler()
|
||||||
: wxXmlResourceHandler(), m_isInside(false), m_listbook(NULL)
|
: wxXmlResourceHandler(), m_isInside(false), m_listbook(NULL)
|
||||||
{
|
{
|
||||||
|
XRC_ADD_STYLE(wxBK_DEFAULT);
|
||||||
|
XRC_ADD_STYLE(wxBK_LEFT);
|
||||||
|
XRC_ADD_STYLE(wxBK_RIGHT);
|
||||||
|
XRC_ADD_STYLE(wxBK_TOP);
|
||||||
|
XRC_ADD_STYLE(wxBK_BOTTOM);
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
XRC_ADD_STYLE(wxLB_DEFAULT);
|
XRC_ADD_STYLE(wxLB_DEFAULT);
|
||||||
XRC_ADD_STYLE(wxLB_LEFT);
|
XRC_ADD_STYLE(wxLB_LEFT);
|
||||||
XRC_ADD_STYLE(wxLB_RIGHT);
|
XRC_ADD_STYLE(wxLB_RIGHT);
|
||||||
XRC_ADD_STYLE(wxLB_TOP);
|
XRC_ADD_STYLE(wxLB_TOP);
|
||||||
XRC_ADD_STYLE(wxLB_BOTTOM);
|
XRC_ADD_STYLE(wxLB_BOTTOM);
|
||||||
|
#endif
|
||||||
|
|
||||||
AddWindowStyles();
|
AddWindowStyles();
|
||||||
}
|
}
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: xh_notbk.cpp
|
// Name: src/xrc/xh_notbk.cpp
|
||||||
// Purpose: XRC resource for wxNotebook
|
// Purpose: XRC resource for wxNotebook
|
||||||
// Author: Vaclav Slavik
|
// Author: Vaclav Slavik
|
||||||
// Created: 2000/03/21
|
// Created: 2000/03/21
|
||||||
@@ -29,11 +29,19 @@ IMPLEMENT_DYNAMIC_CLASS(wxNotebookXmlHandler, wxXmlResourceHandler)
|
|||||||
wxNotebookXmlHandler::wxNotebookXmlHandler()
|
wxNotebookXmlHandler::wxNotebookXmlHandler()
|
||||||
: wxXmlResourceHandler(), m_isInside(false), m_notebook(NULL)
|
: wxXmlResourceHandler(), m_isInside(false), m_notebook(NULL)
|
||||||
{
|
{
|
||||||
|
XRC_ADD_STYLE(wxBK_DEFAULT);
|
||||||
|
XRC_ADD_STYLE(wxBK_LEFT);
|
||||||
|
XRC_ADD_STYLE(wxBK_RIGHT);
|
||||||
|
XRC_ADD_STYLE(wxBK_TOP);
|
||||||
|
XRC_ADD_STYLE(wxBK_BOTTOM);
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY_2_6
|
||||||
XRC_ADD_STYLE(wxNB_DEFAULT);
|
XRC_ADD_STYLE(wxNB_DEFAULT);
|
||||||
XRC_ADD_STYLE(wxNB_LEFT);
|
XRC_ADD_STYLE(wxNB_LEFT);
|
||||||
XRC_ADD_STYLE(wxNB_RIGHT);
|
XRC_ADD_STYLE(wxNB_RIGHT);
|
||||||
XRC_ADD_STYLE(wxNB_TOP);
|
XRC_ADD_STYLE(wxNB_TOP);
|
||||||
XRC_ADD_STYLE(wxNB_BOTTOM);
|
XRC_ADD_STYLE(wxNB_BOTTOM);
|
||||||
|
#endif
|
||||||
|
|
||||||
XRC_ADD_STYLE(wxNB_FIXEDWIDTH);
|
XRC_ADD_STYLE(wxNB_FIXEDWIDTH);
|
||||||
XRC_ADD_STYLE(wxNB_MULTILINE);
|
XRC_ADD_STYLE(wxNB_MULTILINE);
|
||||||
|
@@ -1,5 +1,5 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: xh_treebk.cpp
|
// Name: src/xrc/xh_treebk.cpp
|
||||||
// Purpose: XRC resource handler for wxTreebook
|
// Purpose: XRC resource handler for wxTreebook
|
||||||
// Author: Evgeniy Tarassov
|
// Author: Evgeniy Tarassov
|
||||||
// Created: 2005/09/28
|
// Created: 2005/09/28
|
||||||
@@ -28,9 +28,11 @@ IMPLEMENT_DYNAMIC_CLASS(wxTreebookXmlHandler, wxXmlResourceHandler)
|
|||||||
wxTreebookXmlHandler::wxTreebookXmlHandler()
|
wxTreebookXmlHandler::wxTreebookXmlHandler()
|
||||||
: wxXmlResourceHandler(), m_isInside(false), m_tbk(NULL), m_treeContext()
|
: wxXmlResourceHandler(), m_isInside(false), m_tbk(NULL), m_treeContext()
|
||||||
{
|
{
|
||||||
XRC_ADD_STYLE(wxTBK_DEFAULT);
|
XRC_ADD_STYLE(wxBK_DEFAULT);
|
||||||
XRC_ADD_STYLE(wxTBK_LEFT);
|
XRC_ADD_STYLE(wxBK_TOP);
|
||||||
XRC_ADD_STYLE(wxTBK_RIGHT);
|
XRC_ADD_STYLE(wxBK_BOTTOM);
|
||||||
|
XRC_ADD_STYLE(wxBK_LEFT);
|
||||||
|
XRC_ADD_STYLE(wxBK_RIGHT);
|
||||||
|
|
||||||
AddWindowStyles();
|
AddWindowStyles();
|
||||||
}
|
}
|
||||||
@@ -92,7 +94,7 @@ wxObject *wxTreebookXmlHandler::DoCreateResource()
|
|||||||
}
|
}
|
||||||
|
|
||||||
size_t depth = GetLong( wxT("depth") );
|
size_t depth = GetLong( wxT("depth") );
|
||||||
|
|
||||||
if( depth <= m_treeContext.Count() )
|
if( depth <= m_treeContext.Count() )
|
||||||
{
|
{
|
||||||
// first prepare the icon
|
// first prepare the icon
|
||||||
@@ -122,9 +124,9 @@ wxObject *wxTreebookXmlHandler::DoCreateResource()
|
|||||||
m_tbk->AddSubPage(m_treeContext.Item(depth - 1), wnd,
|
m_tbk->AddSubPage(m_treeContext.Item(depth - 1), wnd,
|
||||||
GetText(wxT("label")), GetBool(wxT("selected")), imgIndex);
|
GetText(wxT("label")), GetBool(wxT("selected")), imgIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_treeContext.Add( m_tbk->GetPageCount() - 1);
|
m_treeContext.Add( m_tbk->GetPageCount() - 1);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
wxLogError(wxT("Error in resource. wxTreebookPage has an invalid depth."));
|
wxLogError(wxT("Error in resource. wxTreebookPage has an invalid depth."));
|
||||||
|
Reference in New Issue
Block a user