]> git.saurik.com Git - wxWidgets.git/blame - src/generic/propdlg.cpp
Use wxFileSystem for left hand side. Patches 1169934 and 1173497 from Stas
[wxWidgets.git] / src / generic / propdlg.cpp
CommitLineData
3c9287bb
JS
1/////////////////////////////////////////////////////////////////////////////
2// Name: propdlg.cpp
3// Purpose: wxPropertySheetDialog
4// Author: Julian Smart
5// Modified by:
6// Created: 2005-03-12
7// RCS-ID: $Id$
8// Copyright: (c) Julian Smart
9// Licence: wxWindows licence
10/////////////////////////////////////////////////////////////////////////////
11
12#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
13#pragma implementation "propdlg.h"
14#endif
15
16// For compilers that support precompilation, includes "wx.h".
17#include "wx/wxprec.h"
18
19#ifdef __BORLANDC__
20#pragma hdrstop
21#endif
22
23#include "wx/defs.h"
24
25#ifndef WX_PRECOMP
26 #include "wx/button.h"
27 #include "wx/sizer.h"
28 #include "wx/intl.h"
29 #include "wx/log.h"
30 #include "wx/msgdlg.h"
31#endif
32
3be8026d 33#include "wx/bookctrl.h"
3c9287bb
JS
34#include "wx/generic/propdlg.h"
35
36//-----------------------------------------------------------------------------
37// wxPropertySheetDialog
38//-----------------------------------------------------------------------------
39
40IMPLEMENT_DYNAMIC_CLASS(wxPropertySheetDialog, wxDialog)
41
42bool wxPropertySheetDialog::Create(wxWindow* parent, wxWindowID id, const wxString& title,
43 const wxPoint& pos, const wxSize& sz, long style,
44 const wxString& name)
45{
0906c58d
JS
46#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
47 style = wxNO_BORDER;
48#endif
3c9287bb
JS
49 if (!wxDialog::Create(parent, id, title, pos, sz, style, name))
50 return false;
51
52 wxBoxSizer *topSizer = new wxBoxSizer( wxVERTICAL );
53 SetSizer(topSizer);
54
55 // This gives more space around the edges
56 m_innerSizer = new wxBoxSizer( wxVERTICAL );
57
58 int extraSpace = 5;
0906c58d 59#if defined(__SMARTPHONE__) || defined(__POCKETPC__)
3c9287bb
JS
60 extraSpace=0;
61#endif
62 topSizer->Add(m_innerSizer, 1, wxGROW|wxALL, extraSpace);
63
64 m_bookCtrl = CreateBookCtrl();
65 AddBookCtrl(m_innerSizer);
66
67 return true;
68}
69
70void wxPropertySheetDialog::Init()
71{
72 m_innerSizer = NULL;
73 m_bookCtrl = NULL;
74}
75
76// Layout the dialog, to be called after pages have been created
77void wxPropertySheetDialog::LayoutDialog()
78{
0906c58d 79#if !defined(__SMARTPHONE__) && !defined(__POCKETPC__)
3c9287bb
JS
80 GetSizer()->Fit(this);
81 Centre(wxBOTH);
82#endif
83}
84
85// Creates the buttons, if any
86void wxPropertySheetDialog::CreateButtons(int flags)
87{
53bc3491 88#if defined(__SMARTPHONE__)
0906c58d
JS
89 // TODO: create a right-click menu with all the other IDs available.
90 // Perhaps that could be embedded in CreateButtonSizer() directly.
53bc3491 91 SetRightMenu(wxID_CANCEL);
3be8026d 92 SetLeftMenu(wxID_OK);
0906c58d
JS
93#elif defined(__POCKETPC__)
94 // Do nothing
95#else
3c9287bb
JS
96 wxSizer* sizer = CreateButtonSizer(flags);
97 m_innerSizer->Add( sizer, 0, wxGROW|wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM, 5);
98#endif
99}
100
101// Creates the book control
102wxBookCtrlBase* wxPropertySheetDialog::CreateBookCtrl()
103{
104 int style = 0;
3be8026d 105#if defined(__POCKETPC__) && wxUSE_NOTEBOOK
3c9287bb 106 style |= wxNB_BOTTOM|wxNB_FLAT;
3be8026d
JS
107#else
108 style |= wxBC_DEFAULT;
3c9287bb 109#endif
3be8026d 110 return new wxBookCtrl(this, wxID_ANY, wxDefaultPosition, wxDefaultSize, style );
3c9287bb
JS
111}
112
113// Adds the book control to the inner sizer.
114void wxPropertySheetDialog::AddBookCtrl(wxSizer* sizer)
115{
3be8026d 116#if defined(__POCKETPC__) && wxUSE_NOTEBOOK
3c9287bb
JS
117 // The book control has to be sized larger than the dialog because of a border bug
118 // in WinCE
0906c58d
JS
119 int borderSize = -2;
120 sizer->Add( m_bookCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxLEFT|wxTOP|wxRIGHT, borderSize );
3c9287bb
JS
121#else
122 sizer->Add( m_bookCtrl, 1, wxGROW|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
123#endif
124}
125