X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cdf1e7142564c55f5299f1f2d0909090534eb97c..24bcaec36746abeeb9e2023d03e3ab4289006fc3:/src/os2/notebook.cpp diff --git a/src/os2/notebook.cpp b/src/os2/notebook.cpp index 6355b3d9de..a32e88326e 100644 --- a/src/os2/notebook.cpp +++ b/src/os2/notebook.cpp @@ -2,7 +2,7 @@ // Name: notebook.cpp // Purpose: implementation of wxNotebook // Author: David Webster -// Modified by: +// Modified by: // Created: 10/12/99 // RCS-ID: $Id$ // Copyright: (c) David Webster @@ -56,17 +56,18 @@ // event table // ---------------------------------------------------------------------------- -#if !USE_SHARED_LIBRARIES - BEGIN_EVENT_TABLE(wxNotebook, wxControl) +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) EVT_SET_FOCUS(wxNotebook::OnSetFocus) EVT_NAVIGATION_KEY(wxNotebook::OnNavigationKey) - END_EVENT_TABLE() +END_EVENT_TABLE() - IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) - IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) -#endif +IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxControl) +IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent) // ============================================================================ // implementation @@ -115,7 +116,7 @@ bool wxNotebook::Create(wxWindow *parent, return FALSE; // colors and font - m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE)); +// TODO: m_backgroundColour = wxColour(GetSysColor(COLOR_BTNFACE)); m_foregroundColour = *wxBLACK ; // TODO: @@ -139,7 +140,7 @@ bool wxNotebook::Create(wxWindow *parent, tabStyle |= TCS_VERTICAL; if (m_windowStyle & wxNB_RIGHT) tabStyle |= TCS_VERTICAL|TCS_RIGHT; - + if ( !MSWCreate(GetId(), GetParent(), WC_TABCONTROL, this, NULL, pos.x, pos.y, size.x, size.y, @@ -233,7 +234,7 @@ bool wxNotebook::SetPageImage(int nPage, int nImage) } void wxNotebook::SetImageList(wxImageList* imageList) -{ +{ m_pImageList = imageList; // TODO } @@ -247,6 +248,25 @@ void wxNotebook::SetTabSize(const wxSize& sz) // wxNotebook operations // ---------------------------------------------------------------------------- +void wxNotebook::SetPageSize(const wxSize& size) +{ + // transform the page size into the notebook size + RECT rc; + rc.xLeft = rc.yTop = 0; + rc.xRight = size.x; + rc.yBottom = size.y; + +// TabCtrl_AdjustRect(GetHwnd(), TRUE, &rc); + + // and now set it + SetSize(rc.xRight - rc.xLeft, rc.yBottom - rc.yTop); +} + +void wxNotebook::SetPadding(const wxSize& padding) +{ +// TabCtrl_SetPadding(GetHwnd(), padding.x, padding.y); +} + // remove one page from the notebook bool wxNotebook::DeletePage(int nPage) { @@ -255,7 +275,7 @@ bool wxNotebook::DeletePage(int nPage) // TODO: delete native widget page delete m_aPages[nPage]; - m_aPages.Remove(nPage); + m_aPages.RemoveAt(nPage); return TRUE; } @@ -265,7 +285,7 @@ bool wxNotebook::RemovePage(int nPage) { wxCHECK_MSG( IS_VALID_PAGE(nPage), FALSE, wxT("notebook page out of range") ); - m_aPages.Remove(nPage); + m_aPages.RemoveAt(nPage); return TRUE; } @@ -309,7 +329,7 @@ bool wxNotebook::InsertPage(int nPage, // save the pointer to the page m_aPages.Insert(pPage, nPage); - // 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 // still no selection if ( bSelect ) m_nSelection = nPage; @@ -349,8 +369,11 @@ void wxNotebook::OnSize(wxSizeEvent& event) for ( unsigned int nPage = 0; nPage < nCount; nPage++ ) { wxNotebookPage *pPage = m_aPages[nPage]; pPage->SetSize(0, 0, w, h); +#if wxUSE_CONSTRAINTS if ( pPage->GetAutoLayout() ) pPage->Layout(); +#endif //wxUSE_CONSTRAINTS + } // Processing continues to next OnSize @@ -365,7 +388,7 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event) int sel = event.GetOldSelection(); if ( sel != -1 ) m_aPages[sel]->Show(FALSE); - + sel = event.GetSelection(); if ( sel != -1 ) { @@ -373,7 +396,7 @@ void wxNotebook::OnSelChange(wxNotebookEvent& event) pPage->Show(TRUE); pPage->SetFocus(); } - + m_nSelection = sel; } // we want to give others a chance to process this message as well @@ -412,8 +435,10 @@ void wxNotebook::OnNavigationKey(wxNavigationKeyEvent& event) void wxNotebook::SetConstraintSizes(bool /* recurse */) { +#if wxUSE_CONSTRAINTS // don't set the sizes of the pages - their correct size is not yet known wxControl::SetConstraintSizes(FALSE); +#endif } bool wxNotebook::DoPhase(int /* nPhase */) @@ -440,13 +465,13 @@ bool wxNotebook::OS2OnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result) return wxControl::MSWOnNotify(idCtrl, lParam, result); } */ - event.SetSelection(TabCtrl_GetCurSel(m_hwnd)); +// TODO: event.SetSelection(TabCtrl_GetCurSel(m_hwnd)); event.SetOldSelection(m_nSelection); event.SetEventObject(this); event.SetInt(idCtrl); bool processed = GetEventHandler()->ProcessEvent(event); - *result = !event.IsAllowed(); +// TODO: *result = !event.IsAllowed(); return processed; }