projects
/
wxWidgets.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fixes #12220
[wxWidgets.git]
/
src
/
generic
/
notebook.cpp
diff --git
a/src/generic/notebook.cpp
b/src/generic/notebook.cpp
index fd5c9f05ea3d8a5c6dc02c9b656a1a9b7b11c1cf..560ea1000f97381aaf2452d58c2dba0e30ce558f 100644
(file)
--- a/
src/generic/notebook.cpp
+++ b/
src/generic/notebook.cpp
@@
-49,10
+49,7
@@
// event table
// ----------------------------------------------------------------------------
// event table
// ----------------------------------------------------------------------------
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
-
-BEGIN_EVENT_TABLE(wxNotebook, wxControl)
+BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
EVT_PAINT(wxNotebook::OnPaint)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
EVT_PAINT(wxNotebook::OnPaint)
@@
-61,9
+58,6
@@
BEGIN_EVENT_TABLE(wxNotebook, wxControl)
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey)
END_EVENT_TABLE()
-IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl)
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxCommandEvent)
-
// ============================================================================
// implementation
// ============================================================================
// ============================================================================
// implementation
// ============================================================================
@@
-106,7
+100,7
@@
private:
static int GetPageId(wxTabView *tabview, wxNotebookPage *page)
{
static int GetPageId(wxTabView *tabview, wxNotebookPage *page)
{
- return
wx_static_cast(wxNotebookTabView*,
tabview)->GetId(page);
+ return
static_cast<wxNotebookTabView*>(
tabview)->GetId(page);
}
// ----------------------------------------------------------------------------
}
// ----------------------------------------------------------------------------
@@
-116,8
+110,8
@@
static int GetPageId(wxTabView *tabview, wxNotebookPage *page)
// common part of all ctors
void wxNotebook::Init()
{
// common part of all ctors
void wxNotebook::Init()
{
- m_tabView =
(wxNotebookTabView*)
NULL;
- m_
nS
election = -1;
+ m_tabView = NULL;
+ m_
s
election = -1;
}
// default for dynamic class
}
// default for dynamic class
@@
-278,10
+272,10
@@
bool wxNotebook::DeletePage(size_t nPage)
{
wxCHECK( IS_VALID_PAGE(nPage), false );
{
wxCHECK( IS_VALID_PAGE(nPage), false );
- if (m_
nS
election != -1)
+ if (m_
s
election != -1)
{
{
- m_pages[m_
nS
election]->Show(false);
- m_pages[m_
nS
election]->Lower();
+ m_pages[m_
s
election]->Show(false);
+ m_pages[m_
s
election]->Lower();
}
wxNotebookPage* pPage = GetPage(nPage);
}
wxNotebookPage* pPage = GetPage(nPage);
@@
-293,16
+287,16
@@
bool wxNotebook::DeletePage(size_t nPage)
if (m_pages.GetCount() == 0)
{
if (m_pages.GetCount() == 0)
{
- m_
nS
election = -1;
+ m_
s
election = -1;
m_tabView->SetTabSelection(-1, false);
}
m_tabView->SetTabSelection(-1, false);
}
- else if (m_
nS
election > -1)
+ else if (m_
s
election > -1)
{
{
- m_
nS
election = -1;
+ m_
s
election = -1;
m_tabView->SetTabSelection(GetPageId(m_tabView, GetPage(0)), false);
m_tabView->SetTabSelection(GetPageId(m_tabView, GetPage(0)), false);
- if (m_
nS
election != 0)
+ if (m_
s
election != 0)
ChangePage(-1, 0);
}
ChangePage(-1, 0);
}
@@
-341,16
+335,16
@@
wxWindow* wxNotebook::DoRemovePage(size_t nPage)
if (m_pages.GetCount() == 0)
{
if (m_pages.GetCount() == 0)
{
- m_
nS
election = -1;
+ m_
s
election = -1;
m_tabView->SetTabSelection(-1, true);
}
m_tabView->SetTabSelection(-1, true);
}
- else if (m_
nS
election > -1)
+ else if (m_
s
election > -1)
{
// Only change the selection if the page we
// deleted was the selection.
{
// Only change the selection if the page we
// deleted was the selection.
- if (nPage == (size_t)m_
nS
election)
+ if (nPage == (size_t)m_
s
election)
{
{
- m_
nS
election = -1;
+ m_
s
election = -1;
// Select the first tab. Generates a ChangePage.
m_tabView->SetTabSelection(0, true);
}
// Select the first tab. Generates a ChangePage.
m_tabView->SetTabSelection(0, true);
}
@@
-359,8
+353,8
@@
wxWindow* wxNotebook::DoRemovePage(size_t nPage)
// We must adjust which tab we think is selected.
// If greater than the page we deleted, it must be moved down
// a notch.
// We must adjust which tab we think is selected.
// If greater than the page we deleted, it must be moved down
// a notch.
- if (size_t(m_
nS
election) > nPage)
- m_
nS
election -- ;
+ if (size_t(m_
s
election) > nPage)
+ m_
s
election -- ;
}
}
}
}
@@
-431,7
+425,7
@@
bool wxNotebook::InsertPage(size_t nPage,
// some page must be selected: either this one or the first one if there is
// still no selection
// some page must be selected: either this one or the first one if there is
// still no selection
- if ( m_
nS
election == -1 )
+ if ( m_
s
election == -1 )
ChangePage(-1, 0);
RefreshLayout(false);
ChangePage(-1, 0);
RefreshLayout(false);
@@
-545,12
+539,12
@@
bool wxNotebook::RefreshLayout(bool force)
return true;
}
return true;
}
-void wxNotebook::OnSelChange(wx
Notebook
Event& event)
+void wxNotebook::OnSelChange(wx
BookCtrl
Event& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
{
{
// is it our tab control?
if ( event.GetEventObject() == this )
{
- if (event.GetSelection() != m_
nS
election)
+ if (event.GetSelection() != m_
s
election)
ChangePage(event.GetOldSelection(), event.GetSelection());
}
ChangePage(event.GetOldSelection(), event.GetSelection());
}
@@
-561,23
+555,25
@@
void wxNotebook::OnSelChange(wxNotebookEvent& event)
void wxNotebook::OnSetFocus(wxFocusEvent& event)
{
// set focus to the currently selected page if any
void wxNotebook::OnSetFocus(wxFocusEvent& event)
{
// set focus to the currently selected page if any
- if ( m_
nS
election != -1 )
- m_pages[m_
nS
election]->SetFocus();
+ if ( m_
s
election != -1 )
+ m_pages[m_
s
election]->SetFocus();
event.Skip();
}
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
event.Skip();
}
void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event)
{
- if ( event.IsWindowChange() ) {
+ if ( event.IsWindowChange() )
+ {
// change pages
AdvanceSelection(event.GetDirection());
}
else {
// pass to the parent
// change pages
AdvanceSelection(event.GetDirection());
}
else {
// pass to the parent
- if ( GetParent() ) {
+ if ( GetParent() )
+ {
event.SetCurrentFocus(this);
event.SetCurrentFocus(this);
- GetParent()->ProcessEvent(event);
+ GetParent()->Process
Window
Event(event);
}
}
}
}
}
}
@@
-630,7
+626,7
@@
void wxNotebook::ChangePage(int nOldSel, int nSel)
pPage->Raise();
pPage->SetFocus();
pPage->Raise();
pPage->SetFocus();
- m_
nS
election = nSel;
+ m_
s
election = nSel;
}
void wxNotebook::OnMouseEvent(wxMouseEvent& event)
}
void wxNotebook::OnMouseEvent(wxMouseEvent& event)
@@
-713,7
+709,7
@@
void wxNotebookTabView::OnTabActivate(int activateId, int deactivateId)
if (!m_notebook)
return;
if (!m_notebook)
return;
- wx
Notebook
Event event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
+ wx
BookCtrl
Event event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, m_notebook->GetId());
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
@@
-736,7
+732,7
@@
bool wxNotebookTabView::OnTabPreActivate(int activateId, int deactivateId)
if (m_notebook)
{
if (m_notebook)
{
- wx
Notebook
Event event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId());
+ wx
BookCtrl
Event event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, m_notebook->GetId());
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).
// Translate from wxTabView's ids (which aren't position-dependent)
// to wxNotebook's (which are).