]> git.saurik.com Git - wxWidgets.git/blame_incremental - src/common/nbkbase.cpp
Take basic style into account when applying style sheet
[wxWidgets.git] / src / common / nbkbase.cpp
... / ...
CommitLineData
1///////////////////////////////////////////////////////////////////////////////
2// Name: src/common/nbkbase.cpp
3// Purpose: common wxNotebook methods
4// Author: Vadim Zeitlin
5// Modified by:
6// Created: 02.07.01
7// RCS-ID: $Id$
8// Copyright: (c) 2001 Vadim Zeitlin
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20// For compilers that support precompilation, includes "wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
27#if wxUSE_NOTEBOOK
28
29#ifndef WX_PRECOMP
30#endif //WX_PRECOMP
31
32#include "wx/notebook.h"
33
34// ============================================================================
35// implementation
36// ============================================================================
37
38// ----------------------------------------------------------------------------
39// geometry
40// ----------------------------------------------------------------------------
41
42wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
43{
44 // this is, of course, totally bogus -- but we must do something by
45 // default because not all ports implement this
46 wxSize sizeTotal = sizePage;
47
48 if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) )
49 {
50 sizeTotal.x += 90;
51 sizeTotal.y += 10;
52 }
53 else // tabs on top/bottom side
54 {
55 sizeTotal.x += 10;
56 sizeTotal.y += 40;
57 }
58
59 return sizeTotal;
60}
61
62// ----------------------------------------------------------------------------
63// events
64// ----------------------------------------------------------------------------
65
66bool wxNotebookBase::SendPageChangingEvent(int nPage)
67{
68 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId());
69 event.SetSelection(nPage);
70 event.SetOldSelection(GetSelection());
71 event.SetEventObject(this);
72 return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();
73}
74
75void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew)
76{
77 wxNotebookEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId());
78 event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew);
79 event.SetOldSelection(nPageOld);
80 event.SetEventObject(this);
81 GetEventHandler()->ProcessEvent(event);
82}
83
84#endif // wxUSE_NOTEBOOK