projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Unicode fixes
[wxWidgets.git]
/
src
/
generic
/
notebook.cpp
diff --git
a/src/generic/notebook.cpp
b/src/generic/notebook.cpp
index 90782f45457acf2afbdbef48298007c9054ae4bc..439675439919cbe4003ec9e0c30e507ef9d59518 100644
(file)
--- a/
src/generic/notebook.cpp
+++ b/
src/generic/notebook.cpp
@@
-27,12
+27,12
@@
#pragma hdrstop
#endif
#pragma hdrstop
#endif
-#include
<wx/string.h>
-#include
<wx/log.h>
-#include
<wx/settings.h>
-#include
<wx/generic/imaglist.h>
-#include
<wx/generic/notebook.h>
-#include
<wx/dcclient.h>
+#include
"wx/string.h"
+#include
"wx/log.h"
+#include
"wx/settings.h"
+#include
"wx/generic/imaglist.h"
+#include
"wx/notebook.h"
+#include
"wx/dcclient.h"
// ----------------------------------------------------------------------------
// macros
// ----------------------------------------------------------------------------
// macros
@@
-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
@@
-146,10
+147,13
@@
int wxNotebook::SetSelection(int nPage)
wxASSERT( IS_VALID_PAGE(nPage) );
wxASSERT( IS_VALID_PAGE(nPage) );
+#if defined (__WIN16__)
+ m_tabView->SetTabSelection(nPage);
+#else
wxNotebookPage* pPage = GetPage(nPage);
m_tabView->SetTabSelection((int) (long) pPage);
wxNotebookPage* pPage = GetPage(nPage);
m_tabView->SetTabSelection((int) (long) pPage);
-
+#endif
// TODO
return 0;
}
// TODO
return 0;
}
@@
-167,7
+171,11
@@
void wxNotebook::AdvanceSelection(bool bForward)
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
wxASSERT( IS_VALID_PAGE(nPage) );
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
{
wxASSERT( IS_VALID_PAGE(nPage) );
-
+#if defined (__WIN16__)
+ m_tabView->SetTabText(nPage, strText);
+ Refresh();
+ return TRUE;
+#else
wxNotebookPage* page = GetPage(nPage);
if (page)
{
wxNotebookPage* page = GetPage(nPage);
if (page)
{
@@
-175,7
+183,7
@@
bool wxNotebook::SetPageText(int nPage, const wxString& strText)
Refresh();
return TRUE;
}
Refresh();
return TRUE;
}
-
+#endif
return FALSE;
}
return FALSE;
}
@@
-183,11
+191,15
@@
wxString wxNotebook::GetPageText(int nPage) const
{
wxASSERT( IS_VALID_PAGE(nPage) );
{
wxASSERT( IS_VALID_PAGE(nPage) );
+#if defined (__WIN16__)
+ return m_tabView->GetTabText(nPage);
+#else
wxNotebookPage* page = ((wxNotebook*)this)->GetPage(nPage);
if (page)
return m_tabView->GetTabText((int) (long) page);
else
return wxEmptyString;
wxNotebookPage* page = ((wxNotebook*)this)->GetPage(nPage);
if (page)
return m_tabView->GetTabText((int) (long) page);
else
return wxEmptyString;
+#endif
}
int wxNotebook::GetPageImage(int nPage) const
}
int wxNotebook::GetPageImage(int nPage) const
@@
-207,7
+219,7
@@
bool wxNotebook::SetPageImage(int nPage, int nImage)
}
void wxNotebook::SetImageList(wxImageList* imageList)
}
void wxNotebook::SetImageList(wxImageList* imageList)
-{
+{
m_pImageList = imageList;
// TODO
}
m_pImageList = imageList;
// TODO
}
@@
-228,7
+240,11
@@
bool wxNotebook::DeletePage(int nPage)
}
wxNotebookPage* pPage = GetPage(nPage);
}
wxNotebookPage* pPage = GetPage(nPage);
+#if defined (__WIN16__)
+ m_tabView->RemoveTab(nPage);
+#else
m_tabView->RemoveTab((int) (long) pPage);
m_tabView->RemoveTab((int) (long) pPage);
+#endif
delete m_aPages[nPage];
m_aPages.Remove(nPage);
delete m_aPages[nPage];
m_aPages.Remove(nPage);
@@
-241,7
+257,11
@@
bool wxNotebook::DeletePage(int nPage)
else if (m_nSelection > -1)
{
m_nSelection = -1;
else if (m_nSelection > -1)
{
m_nSelection = -1;
+#if defined (__WIN16__)
+ m_tabView->SetTabSelection(0, FALSE);
+#else
m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
m_tabView->SetTabSelection((int) (long) GetPage(0), FALSE);
+#endif
if (m_nSelection != 0)
ChangePage(-1, 0);
}
if (m_nSelection != 0)
ChangePage(-1, 0);
}
@@
-269,7
+289,11
@@
bool wxNotebook::RemovePage(int nPage)
// m_aPages[nPage]->Lower();
wxNotebookPage* pPage = GetPage(nPage);
// m_aPages[nPage]->Lower();
wxNotebookPage* pPage = GetPage(nPage);
+#if defined (__WIN16__)
+ m_tabView->RemoveTab(nPage);
+#else
m_tabView->RemoveTab((int) (long) pPage);
m_tabView->RemoveTab((int) (long) pPage);
+#endif
m_aPages.Remove(nPage);
m_aPages.Remove(nPage);
@@
-357,7
+381,12
@@
bool wxNotebook::InsertPage(int nPage,
wxASSERT( pPage != NULL );
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
wxASSERT( pPage != NULL );
wxCHECK( IS_VALID_PAGE(nPage) || nPage == GetPageCount(), FALSE );
+// For 16 bit integers (tabs limited to 32768)
+#if defined (__WIN16__)
+ m_tabView->AddTab(nPage, strText);
+#else
m_tabView->AddTab((int) (long) pPage, strText);
m_tabView->AddTab((int) (long) pPage, strText);
+#endif
if (!bSelect)
pPage->Show(FALSE);
if (!bSelect)
pPage->Show(FALSE);
@@
-367,7
+396,11
@@
bool wxNotebook::InsertPage(int nPage,
if (bSelect)
{
// This will cause ChangePage to be called, via OnSelPage
if (bSelect)
{
// This will cause ChangePage to be called, via OnSelPage
+#if defined (__WIN16__)
+ m_tabView->SetTabSelection(nPage, TRUE);
+#else
m_tabView->SetTabSelection((int) (long) pPage, TRUE);
m_tabView->SetTabSelection((int) (long) pPage, TRUE);
+#endif
}
// some page must be selected: either this one or the first one if there is
}
// some page must be selected: either this one or the first one if there is
@@
-444,10
+477,10
@@
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->SetViewRect(rect);
- m_tabView->Layout();
+ m_tabView->Layout
Tabs
();
// Need to do it a 2nd time to get the tab height with
// the new view width, since changing the view width changes the
// Need to do it a 2nd time to get the tab height with
// the new view width, since changing the view width changes the
@@
-457,10
+490,10
@@
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->SetViewRect(rect);
- m_tabView->Layout();
+ m_tabView->Layout
Tabs
();
if (!force && (rect == oldRect))
return FALSE;
if (!force && (rect == oldRect))
return FALSE;
@@
-537,7
+570,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");
}
@@
-562,12
+595,12
@@
void wxNotebook::ChangePage(int nOldSel, int 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;
}
@@
-601,15
+634,10
@@
wxRect wxNotebook::GetAvailableClientSize()
return rect;
}
return rect;
}
-void wxNotebook::SetTabSize(const wxSize& sz)
-{
- // TODO
-}
-
/*
* 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)
@@
-631,13
+659,12
@@
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;
+ int deactivatePos = deactivateId;
+#else
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
wxNotebookPage* pActive = (wxNotebookPage*) activateId;
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
wxNotebookPage* pActive = (wxNotebookPage*) activateId;
@@
-646,6
+673,7
@@
void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
int activatePos = m_notebook->FindPagePosition(pActive);
int deactivatePos = m_notebook->FindPagePosition(pDeactive);
int activatePos = m_notebook->FindPagePosition(pActive);
int deactivatePos = m_notebook->FindPagePosition(pDeactive);
+#endif
event.SetEventObject(m_notebook);
event.SetSelection(activatePos);
event.SetOldSelection(deactivatePos);
event.SetEventObject(m_notebook);
event.SetSelection(activatePos);
event.SetOldSelection(deactivatePos);