projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
SWIGged updates for wxMSW
[wxWidgets.git]
/
src
/
generic
/
notebook.cpp
diff --git
a/src/generic/notebook.cpp
b/src/generic/notebook.cpp
index a398e2a5467f0d59f6d4134dd8f70300a3c2469e..5cb54f9c67cf4179267703dfd363146f32fd4968 100644
(file)
--- a/
src/generic/notebook.cpp
+++ b/
src/generic/notebook.cpp
@@
-45,7
+45,9
@@
// event table
// ----------------------------------------------------------------------------
// event table
// ----------------------------------------------------------------------------
-#if !USE_SHARED_LIBRARIES
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
+DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
+
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NOTEBOOK_PAGE_CHANGED(-1, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
@@
-58,7
+60,6
@@
END_EVENT_TABLE()
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
-#endif
// ============================================================================
// implementation
// ============================================================================
// implementation
@@
-72,7
+73,6
@@
IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
void wxNotebook::Init()
{
m_tabView = (wxNotebookTabView*) NULL;
void wxNotebook::Init()
{
m_tabView = (wxNotebookTabView*) NULL;
- m_pImageList = NULL;
m_nSelection = -1;
}
m_nSelection = -1;
}
@@
-112,7
+112,7
@@
bool wxNotebook::Create(wxWindow *parent,
if (!wxWindow::Create(parent, id, pos, size, style|wxNO_BORDER, name))
return FALSE;
if (!wxWindow::Create(parent, id, pos, size, style|wxNO_BORDER, name))
return FALSE;
- SetBackgroundColour(wxSystemSettings::Get
System
Colour(wxSYS_COLOUR_3DFACE));
+ SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
SetTabView(new wxNotebookTabView(this));
SetTabView(new wxNotebookTabView(this));
@@
-128,11
+128,6
@@
wxNotebook::~wxNotebook()
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
// ----------------------------------------------------------------------------
// wxNotebook accessors
// ----------------------------------------------------------------------------
-int wxNotebook::GetPageCount() const
-{
- return m_aPages.Count();
-}
-
int wxNotebook::GetRowCount() const
{
// TODO
int wxNotebook::GetRowCount() const
{
// TODO
@@
-157,6
+152,7
@@
int wxNotebook::SetSelection(int nPage)
return 0;
}
return 0;
}
+#if 0
void wxNotebook::AdvanceSelection(bool bForward)
{
int nSel = GetSelection();
void wxNotebook::AdvanceSelection(bool bForward)
{
int nSel = GetSelection();
@@
-166,6
+162,7
@@
void wxNotebook::AdvanceSelection(bool bForward)
else
SetSelection(nSel == 0 ? nMax : nSel - 1);
}
else
SetSelection(nSel == 0 ? nMax : nSel - 1);
}
+#endif
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
@@
-217,9
+214,21
@@
bool wxNotebook::SetPageImage(int nPage, int nImage)
return FALSE;
}
return FALSE;
}
-void wxNotebook::SetImageList(wxImageList* imageList)
-{
- m_pImageList = imageList;
+// set the size (the same for all pages)
+void wxNotebook::SetPageSize(const wxSize& size)
+{
+ // TODO
+}
+
+// set the padding between tabs (in pixels)
+void wxNotebook::SetPadding(const wxSize& padding)
+{
+ // TODO
+}
+
+// set the size of the tabs for wxNB_FIXEDWIDTH controls
+void wxNotebook::SetTabSize(const wxSize& sz)
+{
// TODO
}
// TODO
}
@@
-234,8
+243,8
@@
bool wxNotebook::DeletePage(int nPage)
if (m_nSelection != -1)
{
if (m_nSelection != -1)
{
- m_
aP
ages[m_nSelection]->Show(FALSE);
- m_
aP
ages[m_nSelection]->Lower();
+ m_
p
ages[m_nSelection]->Show(FALSE);
+ m_
p
ages[m_nSelection]->Lower();
}
wxNotebookPage* pPage = GetPage(nPage);
}
wxNotebookPage* pPage = GetPage(nPage);
@@
-245,10
+254,10
@@
bool wxNotebook::DeletePage(int nPage)
m_tabView->RemoveTab((int) (long) pPage);
#endif
m_tabView->RemoveTab((int) (long) pPage);
#endif
-
delete m_aPages[nPage]
;
-
m_aPages.Remove(nPage)
;
+
m_pages.Remove(pPage)
;
+
delete pPage
;
- if (m_
aP
ages.GetCount() == 0)
+ if (m_
p
ages.GetCount() == 0)
{
m_nSelection = -1;
m_tabView->SetTabSelection(-1, FALSE);
{
m_nSelection = -1;
m_tabView->SetTabSelection(-1, FALSE);
@@
-284,8
+293,8
@@
bool wxNotebook::RemovePage(int nPage)
{
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
{
wxCHECK( IS_VALID_PAGE(nPage), FALSE );
- m_
aP
ages[nPage]->Show(FALSE);
- // m_
aP
ages[nPage]->Lower();
+ m_
p
ages[nPage]->Show(FALSE);
+ // m_
p
ages[nPage]->Lower();
wxNotebookPage* pPage = GetPage(nPage);
#if defined (__WIN16__)
wxNotebookPage* pPage = GetPage(nPage);
#if defined (__WIN16__)
@@
-294,9
+303,9
@@
bool wxNotebook::RemovePage(int nPage)
m_tabView->RemoveTab((int) (long) pPage);
#endif
m_tabView->RemoveTab((int) (long) pPage);
#endif
- m_
aPages.Remove(n
Page);
+ m_
pages.Remove(p
Page);
- if (m_
aP
ages.GetCount() == 0)
+ if (m_
p
ages.GetCount() == 0)
{
m_nSelection = -1;
m_tabView->SetTabSelection(-1, TRUE);
{
m_nSelection = -1;
m_tabView->SetTabSelection(-1, TRUE);
@@
-341,7
+350,7
@@
int wxNotebook::FindPagePosition(wxNotebookPage* page) const
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
- if (m_
aP
ages[nPage] == page)
+ if (m_
p
ages[nPage] == page)
return nPage;
return -1;
}
return nPage;
return -1;
}
@@
-354,22
+363,13
@@
bool wxNotebook::DeleteAllPages()
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
int nPageCount = GetPageCount();
int nPage;
for ( nPage = 0; nPage < nPageCount; nPage++ )
- delete m_
aP
ages[nPage];
+ delete m_
p
ages[nPage];
- m_
aP
ages.Clear();
+ m_
p
ages.Clear();
return TRUE;
}
return TRUE;
}
-// add a page to the notebook
-bool wxNotebook::AddPage(wxNotebookPage *pPage,
- const wxString& strText,
- bool bSelect,
- int imageId)
-{
- return InsertPage(GetPageCount(), pPage, strText, bSelect, imageId);
-}
-
// same as AddPage() but does it at given position
bool wxNotebook::InsertPage(int nPage,
wxNotebookPage *pPage,
// same as AddPage() but does it at given position
bool wxNotebook::InsertPage(int nPage,
wxNotebookPage *pPage,
@@
-390,7
+390,7
@@
bool wxNotebook::InsertPage(int nPage,
pPage->Show(FALSE);
// save the pointer to the page
pPage->Show(FALSE);
// save the pointer to the page
- m_
aP
ages.Insert(pPage, nPage);
+ m_
p
ages.Insert(pPage, nPage);
if (bSelect)
{
if (bSelect)
{
@@
-476,7
+476,7
@@
bool wxNotebook::RefreshLayout(bool force)
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y ;
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y ;
-
+
m_tabView->SetViewRect(rect);
m_tabView->LayoutTabs();
m_tabView->SetViewRect(rect);
m_tabView->LayoutTabs();
@@
-489,7
+489,7
@@
bool wxNotebook::RefreshLayout(bool force)
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y ;
rect.y = tabHeight + 4;
rect.width = cw - 8;
rect.height = ch - 4 - rect.y ;
-
+
m_tabView->SetViewRect(rect);
m_tabView->LayoutTabs();
m_tabView->SetViewRect(rect);
m_tabView->LayoutTabs();
@@
-499,9
+499,9
@@
bool wxNotebook::RefreshLayout(bool force)
// fit the notebook page to the tab control's display area
// fit the notebook page to the tab control's display area
- unsigned int nCount = m_
aP
ages.Count();
+ unsigned int nCount = m_
p
ages.Count();
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) {
- wxNotebookPage *pPage = m_
aP
ages[nPage];
+ wxNotebookPage *pPage = m_
p
ages[nPage];
if (pPage->IsShown())
{
wxRect clientRect = GetAvailableClientSize();
if (pPage->IsShown())
{
wxRect clientRect = GetAvailableClientSize();
@@
-532,7
+532,7
@@
void wxNotebook::OnSetFocus(wxFocusEvent& event)
{
// set focus to the currently selected page if any
if ( m_nSelection != -1 )
{
// set focus to the currently selected page if any
if ( m_nSelection != -1 )
- m_
aP
ages[m_nSelection]->SetFocus();
+ m_
p
ages[m_nSelection]->SetFocus();
event.Skip();
}
event.Skip();
}
@@
-569,7
+569,7
@@
bool wxNotebook::DoPhase(int /* nPhase */)
return TRUE;
}
return TRUE;
}
-void wxNotebook::Command(wxCommandEvent&
event
)
+void wxNotebook::Command(wxCommandEvent&
WXUNUSED(event)
)
{
wxFAIL_MSG("wxNotebook::Command not implemented");
}
{
wxFAIL_MSG("wxNotebook::Command not implemented");
}
@@
-585,21
+585,21
@@
void wxNotebook::ChangePage(int nOldSel, int nSel)
wxASSERT( nOldSel != nSel ); // impossible
if ( nOldSel != -1 ) {
wxASSERT( nOldSel != nSel ); // impossible
if ( nOldSel != -1 ) {
- m_
aP
ages[nOldSel]->Show(FALSE);
- m_
aP
ages[nOldSel]->Lower();
+ m_
p
ages[nOldSel]->Show(FALSE);
+ m_
p
ages[nOldSel]->Lower();
}
}
- wxNotebookPage *pPage = m_
aP
ages[nSel];
+ wxNotebookPage *pPage = m_
p
ages[nSel];
wxRect clientRect = GetAvailableClientSize();
pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
wxRect clientRect = GetAvailableClientSize();
pPage->SetSize(clientRect.x, clientRect.y, clientRect.width, clientRect.height);
+ Refresh();
+
pPage->Show(TRUE);
pPage->Raise();
pPage->SetFocus();
pPage->Show(TRUE);
pPage->Raise();
pPage->SetFocus();
- Refresh();
-
m_nSelection = nSel;
}
m_nSelection = nSel;
}
@@
-636,7
+636,7
@@
wxRect wxNotebook::GetAvailableClientSize()
/*
* wxNotebookTabView
*/
/*
* wxNotebookTabView
*/
-
+
IMPLEMENT_CLASS(wxNotebookTabView, wxTabView)
wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style): wxTabView(style)
IMPLEMENT_CLASS(wxNotebookTabView, wxTabView)
wxNotebookTabView::wxNotebookTabView(wxNotebook *notebook, long style): wxTabView(style)
@@
-658,12
+658,7
@@
void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
if (!m_notebook)
return;
if (!m_notebook)
return;
-// Because of name truncation!
-#if defined(__BORLANDC__) && defined(__WIN16__)
- wxNotebookEvent event(wxEVT_COMMAND_NB_PAGE_CHANGED, m_notebook->GetId());
-#else
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
-#endif
#if defined (__WIN16__)
int activatePos = activateId;
#if defined (__WIN16__)
int activatePos = activateId;