]>
Commit | Line | Data |
---|---|---|
07b8d7ec VZ |
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 | |
65571936 | 9 | // Licence: wxWindows licence |
07b8d7ec VZ |
10 | /////////////////////////////////////////////////////////////////////////////// |
11 | ||
12 | // ============================================================================ | |
13 | // declarations | |
14 | // ============================================================================ | |
15 | ||
16 | // ---------------------------------------------------------------------------- | |
17 | // headers | |
18 | // ---------------------------------------------------------------------------- | |
19 | ||
07b8d7ec VZ |
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 | |
07b8d7ec VZ |
30 | #endif //WX_PRECOMP |
31 | ||
bd52bee1 JS |
32 | #include "wx/notebook.h" |
33 | ||
07b8d7ec VZ |
34 | // ============================================================================ |
35 | // implementation | |
36 | // ============================================================================ | |
37 | ||
07b8d7ec VZ |
38 | // ---------------------------------------------------------------------------- |
39 | // geometry | |
40 | // ---------------------------------------------------------------------------- | |
41 | ||
2ce7af35 | 42 | wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const |
07b8d7ec | 43 | { |
550e6c01 VZ |
44 | // this is, of course, totally bogus -- but we must do something by |
45 | // default because not all ports implement this | |
07b8d7ec | 46 | wxSize sizeTotal = sizePage; |
550e6c01 | 47 | |
2ddb4d13 | 48 | if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) ) |
eaf336e0 | 49 | { |
07b8d7ec | 50 | sizeTotal.x += 90; |
eaf336e0 | 51 | sizeTotal.y += 10; |
eaf336e0 | 52 | } |
550e6c01 | 53 | else // tabs on top/bottom side |
eaf336e0 | 54 | { |
eaf336e0 | 55 | sizeTotal.x += 10; |
07b8d7ec | 56 | sizeTotal.y += 40; |
eaf336e0 | 57 | } |
07b8d7ec VZ |
58 | |
59 | return sizeTotal; | |
60 | } | |
61 | ||
a570e8f8 VZ |
62 | // ---------------------------------------------------------------------------- |
63 | // events | |
64 | // ---------------------------------------------------------------------------- | |
65 | ||
66 | bool wxNotebookBase::SendPageChangingEvent(int nPage) | |
67 | { | |
3e97a905 | 68 | wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId()); |
a570e8f8 VZ |
69 | event.SetSelection(nPage); |
70 | event.SetOldSelection(GetSelection()); | |
71 | event.SetEventObject(this); | |
72 | return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed(); | |
73 | } | |
74 | ||
75 | void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew) | |
76 | { | |
3e97a905 | 77 | wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId()); |
a570e8f8 VZ |
78 | event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew); |
79 | event.SetOldSelection(nPageOld); | |
80 | event.SetEventObject(this); | |
81 | GetEventHandler()->ProcessEvent(event); | |
82 | } | |
83 | ||
07b8d7ec | 84 | #endif // wxUSE_NOTEBOOK |