]> git.saurik.com Git - wxWidgets.git/blame - src/common/nbkbase.cpp
use buffered streams to reduce the number of TCP packets used per IPC command from...
[wxWidgets.git] / src / common / nbkbase.cpp
CommitLineData
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
1e4db450
PC
38DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED)
39DEFINE_EVENT_TYPE(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING)
40
07b8d7ec
VZ
41// ----------------------------------------------------------------------------
42// geometry
43// ----------------------------------------------------------------------------
44
2ce7af35 45wxSize wxNotebookBase::CalcSizeFromPage(const wxSize& sizePage) const
07b8d7ec 46{
550e6c01
VZ
47 // this is, of course, totally bogus -- but we must do something by
48 // default because not all ports implement this
07b8d7ec 49 wxSize sizeTotal = sizePage;
550e6c01 50
2ddb4d13 51 if ( HasFlag(wxBK_LEFT) || HasFlag(wxBK_RIGHT) )
eaf336e0 52 {
07b8d7ec 53 sizeTotal.x += 90;
eaf336e0 54 sizeTotal.y += 10;
eaf336e0 55 }
550e6c01 56 else // tabs on top/bottom side
eaf336e0 57 {
eaf336e0 58 sizeTotal.x += 10;
07b8d7ec 59 sizeTotal.y += 40;
eaf336e0 60 }
07b8d7ec
VZ
61
62 return sizeTotal;
63}
64
a570e8f8
VZ
65// ----------------------------------------------------------------------------
66// events
67// ----------------------------------------------------------------------------
68
69bool wxNotebookBase::SendPageChangingEvent(int nPage)
70{
3e97a905 71 wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, GetId());
a570e8f8
VZ
72 event.SetSelection(nPage);
73 event.SetOldSelection(GetSelection());
74 event.SetEventObject(this);
75 return !GetEventHandler()->ProcessEvent(event) || event.IsAllowed();
76}
77
78void wxNotebookBase::SendPageChangedEvent(int nPageOld, int nPageNew)
79{
3e97a905 80 wxBookCtrlEvent event(wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGED, GetId());
a570e8f8
VZ
81 event.SetSelection(nPageNew == -1 ? GetSelection() : nPageNew);
82 event.SetOldSelection(nPageOld);
83 event.SetEventObject(this);
84 GetEventHandler()->ProcessEvent(event);
85}
86
07b8d7ec 87#endif // wxUSE_NOTEBOOK