1 /*=========================================================================
3 Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake
4 Module: $RCSfile: optionsdlg.cpp,v $
6 Date: $Date: 2005-06-30 19:54:14 $
7 Version: $Revision: 1.1 $
11 Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
12 See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
14 This software is distributed WITHOUT ANY WARRANTY; without even
15 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
16 PURPOSE. See the above copyright notices for more information.
18 =========================================================================*/
20 #if defined(__GNUG__) && !defined(__APPLE__)
21 #pragma implementation "optionsdlg.h"
24 // For compilers that support precompilation, includes "wx/wx.h".
25 #include "wx/wxprec.h"
38 #include "optionsdlg.h"
44 * CMOptionsDlg type definition
47 IMPLEMENT_DYNAMIC_CLASS( CMOptionsDlg
, wxDialog
)
50 * CMOptionsDlg event table definition
53 BEGIN_EVENT_TABLE( CMOptionsDlg
, wxDialog
)
55 ////@begin CMOptionsDlg event table entries
56 EVT_CHECKBOX( ID_CHECKBOX_CLOSECMAKE
, CMOptionsDlg::OnButtonOK
)
58 ////@end CMOptionsDlg event table entries
63 * CMOptionsDlg constructors
66 CMOptionsDlg::CMOptionsDlg( )
70 CMOptionsDlg::CMOptionsDlg( wxWindow
* parent
, wxWindowID id
, const wxString
& caption
, const wxPoint
& pos
, const wxSize
& size
, long style
)
72 Create(parent
, id
, caption
, pos
, size
, style
);
76 * CMOptionsDlg creator
79 bool CMOptionsDlg::Create( wxWindow
* parent
, wxWindowID id
, const wxString
& caption
, const wxPoint
& pos
, const wxSize
& size
, long style
)
81 ////@begin CMOptionsDlg member initialisation
82 m_closeAfterGenerate
= NULL
;
83 ////@end CMOptionsDlg member initialisation
85 ////@begin CMOptionsDlg creation
86 SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS
);
87 wxDialog::Create( parent
, id
, caption
, pos
, size
, style
);
91 ////@end CMOptionsDlg creation
96 * Control creation for CMOptionsDlg
99 void CMOptionsDlg::CreateControls()
101 ////@begin CMOptionsDlg content construction
102 CMOptionsDlg
* itemDialog1
= this;
104 wxBoxSizer
* itemBoxSizer2
= new wxBoxSizer(wxVERTICAL
);
105 itemDialog1
->SetSizer(itemBoxSizer2
);
107 wxNotebook
* itemNotebook3
= new wxNotebook( itemDialog1
, ID_NOTEBOOK
, wxDefaultPosition
, wxDefaultSize
, wxNB_TOP
);
109 wxPanel
* itemPanel4
= new wxPanel( itemNotebook3
, ID_PANEL
, wxDefaultPosition
, wxDefaultSize
, wxTAB_TRAVERSAL
);
110 wxBoxSizer
* itemBoxSizer5
= new wxBoxSizer(wxVERTICAL
);
111 itemPanel4
->SetSizer(itemBoxSizer5
);
113 itemBoxSizer5
->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL
|wxALL
, 5);
115 m_closeAfterGenerate
= new wxCheckBox( itemPanel4
, ID_CHECKBOX_CLOSECMAKE
, _("Close down CMakeSetup after generation of project"), wxDefaultPosition
, wxDefaultSize
, wxCHK_2STATE
);
116 m_closeAfterGenerate
->SetValue(FALSE
);
117 itemBoxSizer5
->Add(m_closeAfterGenerate
, 0, wxALIGN_LEFT
|wxALL
, 5);
119 itemNotebook3
->AddPage(itemPanel4
, _("General"));
121 itemBoxSizer2
->Add(itemNotebook3
, 1, wxGROW
|wxALL
|wxFIXED_MINSIZE
, 5);
123 wxBoxSizer
* itemBoxSizer8
= new wxBoxSizer(wxHORIZONTAL
);
124 itemBoxSizer2
->Add(itemBoxSizer8
, 0, wxALIGN_CENTER_HORIZONTAL
|wxLEFT
|wxRIGHT
|wxBOTTOM
, 5);
126 wxButton
* itemButton9
= new wxButton( itemDialog1
, wxID_OK
, _("&OK"), wxDefaultPosition
, wxDefaultSize
, 0 );
127 itemBoxSizer8
->Add(itemButton9
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
129 wxButton
* itemButton10
= new wxButton( itemDialog1
, wxID_CANCEL
, _("&Cancel"), wxDefaultPosition
, wxDefaultSize
, 0 );
130 itemBoxSizer8
->Add(itemButton10
, 0, wxALIGN_CENTER_VERTICAL
|wxALL
, 5);
132 ////@end CMOptionsDlg content construction
136 * Should we show tooltips?
139 bool CMOptionsDlg::ShowToolTips()
145 * Get bitmap resources
148 wxBitmap
CMOptionsDlg::GetBitmapResource( const wxString
& name
)
151 ////@begin CMOptionsDlg bitmap retrieval
153 ////@end CMOptionsDlg bitmap retrieval
160 wxIcon
CMOptionsDlg::GetIconResource( const wxString
& name
)
163 ////@begin CMOptionsDlg icon retrieval
165 ////@end CMOptionsDlg icon retrieval
168 void CMOptionsDlg::SetConfig(wxConfig
*cfg
)
172 // close after generation
173 cfg
->Read(CM_CLOSEAFTERGEN
, &boolval
, CM_CLOSEAFTERGEN_DEF
);
174 m_closeAfterGenerate
->SetValue(boolval
);
177 void CMOptionsDlg::GetConfig(wxConfig
*cfg
)
179 // close after generation
180 cfg
->Write(CM_CLOSEAFTERGEN
, m_closeAfterGenerate
->GetValue());
184 * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE
187 void CMOptionsDlg::OnButtonOK( wxCommandEvent
& event
)
189 ////@begin wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE in CMOptionsDlg.
190 // Before editing this code, remove the block markers.
192 ////@end wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE in CMOptionsDlg.