#include "wx/sysopt.h"
#include "wx/msw/private.h"
+#include "wx/msw/dc.h"
#include <windowsx.h>
#include "wx/msw/winundef.h"
WX_DEFINE_LIST( wxNotebookPageInfoList )
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
-DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
-
BEGIN_EVENT_TABLE(wxNotebook, wxBookCtrlBase)
EVT_NOTEBOOK_PAGE_CHANGED(wxID_ANY, wxNotebook::OnSelChange)
EVT_SIZE(wxNotebook::OnSize)
}
wxBEGIN_PROPERTIES_TABLE(wxNotebook)
- wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxNotebookEvent )
- wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxNotebookEvent )
+ wxEVENT_PROPERTY( PageChanging , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING , wxBookCtrlEvent )
+ wxEVENT_PROPERTY( PageChanged , wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED , wxBookCtrlEvent )
wxPROPERTY_COLLECTION( PageInfos , wxNotebookPageInfoList , wxNotebookPageInfo* , AddPageInfo , GetPageInfos , 0 /*flags*/ , wxT("Helpstring") , wxT("group"))
wxPROPERTY_FLAGS( WindowStyle , wxNotebookStyle , long , SetWindowStyleFlag , GetWindowStyleFlag , EMPTY_MACROVALUE , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style
IMPLEMENT_DYNAMIC_CLASS(wxNotebook, wxBookCtrlBase)
IMPLEMENT_DYNAMIC_CLASS(wxNotebookPageInfo, wxObject )
#endif
-IMPLEMENT_DYNAMIC_CLASS(wxNotebookEvent, wxNotifyEvent)
// ============================================================================
// implementation
if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) )
{
gs_wndprocNotebook =
- wx_reinterpret_cast(WXFARPROC, wc.lpfnWndProc);
+ reinterpret_cast<WXFARPROC>(wc.lpfnWndProc);
wc.lpszClassName = wxT("_wx_SysTabCtl32");
wc.style &= ~(CS_HREDRAW | CS_VREDRAW);
wc.hInstance = wxGetInstance();
else if ( style & wxBK_RIGHT )
tabStyle |= TCS_VERTICAL | TCS_RIGHT;
- // ex style
- if ( exstyle )
- {
- // note that we never want to have the default WS_EX_CLIENTEDGE style
- // as it looks too ugly for the notebooks
- *exstyle = 0;
- }
-
return tabStyle;
}
tabSize.y = rect.bottom - rect.top;
}
+ const int rows = GetRowCount();
+
// add an extra margin in both directions
const int MARGIN = 8;
if ( IsVertical() )
{
sizeTotal.x += MARGIN;
- sizeTotal.y += tabSize.y + MARGIN;
+ sizeTotal.y += tabSize.y * rows + MARGIN;
}
else // horizontal layout
{
- sizeTotal.x += tabSize.x + MARGIN;
+ sizeTotal.x += tabSize.x * rows + MARGIN;
sizeTotal.y += MARGIN;
}
MAKELPARAM(rc.right, rc.bottom));
s_isInOnSize = false;
}
+
+ // The best size depends on the number of rows of tabs, which can
+ // change when the notepad is resized.
+ InvalidateBestSize();
}
#if wxUSE_UXTHEME
event.Skip();
}
-void wxNotebook::OnSelChange(wxNotebookEvent& event)
+void wxNotebook::OnSelChange(wxBookCtrlEvent& event)
{
// is it our tab control?
if ( event.GetEventObject() == this )
bool wxNotebook::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM* result)
{
- wxNotebookEvent event(wxEVT_NULL, m_windowId);
+ wxBookCtrlEvent event(wxEVT_NULL, m_windowId);
NMHDR* hdr = (NMHDR *)lParam;
switch ( hdr->code ) {