optionsdlg.cpp 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199
  1. /*=========================================================================
  2. Program: WXDialog - wxWidgets X-platform GUI Front-End for CMake
  3. Module: $RCSfile$
  4. Language: C++
  5. Date: $Date$
  6. Version: $Revision$
  7. Author: Jorgen Bodde
  8. Copyright (c) 2002 Kitware, Inc., Insight Consortium. All rights reserved.
  9. See Copyright.txt or http://www.cmake.org/HTML/Copyright.html for details.
  10. This software is distributed WITHOUT ANY WARRANTY; without even
  11. the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  12. PURPOSE. See the above copyright notices for more information.
  13. =========================================================================*/
  14. #if defined(__GNUG__) && !defined(__APPLE__)
  15. #pragma implementation "optionsdlg.h"
  16. #endif
  17. // For compilers that support precompilation, includes "wx/wx.h".
  18. #include "wx/wxprec.h"
  19. #ifdef __BORLANDC__
  20. #pragma hdrstop
  21. #endif
  22. #ifndef WX_PRECOMP
  23. #include "wx/wx.h"
  24. #endif
  25. ////@begin includes
  26. ////@end includes
  27. #include "optionsdlg.h"
  28. ////@begin XPM images
  29. ////@end XPM images
  30. /*!
  31. * CMOptionsDlg type definition
  32. */
  33. IMPLEMENT_DYNAMIC_CLASS( CMOptionsDlg, wxDialog )
  34. /*!
  35. * CMOptionsDlg event table definition
  36. */
  37. BEGIN_EVENT_TABLE( CMOptionsDlg, wxDialog )
  38. ////@begin CMOptionsDlg event table entries
  39. EVT_CHECKBOX( ID_CHECKBOX_CLOSECMAKE, CMOptionsDlg::OnButtonOK )
  40. ////@end CMOptionsDlg event table entries
  41. END_EVENT_TABLE()
  42. /*!
  43. * CMOptionsDlg constructors
  44. */
  45. CMOptionsDlg::CMOptionsDlg( )
  46. {
  47. }
  48. CMOptionsDlg::CMOptionsDlg( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  49. {
  50. Create(parent, id, caption, pos, size, style);
  51. }
  52. /*!
  53. * CMOptionsDlg creator
  54. */
  55. bool CMOptionsDlg::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
  56. {
  57. ////@begin CMOptionsDlg member initialisation
  58. m_closeAfterGenerate = NULL;
  59. ////@end CMOptionsDlg member initialisation
  60. ////@begin CMOptionsDlg creation
  61. SetExtraStyle(GetExtraStyle()|wxWS_EX_BLOCK_EVENTS);
  62. wxDialog::Create( parent, id, caption, pos, size, style );
  63. CreateControls();
  64. Centre();
  65. ////@end CMOptionsDlg creation
  66. return TRUE;
  67. }
  68. /*!
  69. * Control creation for CMOptionsDlg
  70. */
  71. void CMOptionsDlg::CreateControls()
  72. {
  73. ////@begin CMOptionsDlg content construction
  74. CMOptionsDlg* itemDialog1 = this;
  75. wxBoxSizer* itemBoxSizer2 = new wxBoxSizer(wxVERTICAL);
  76. itemDialog1->SetSizer(itemBoxSizer2);
  77. wxNotebook* itemNotebook3 = new wxNotebook( itemDialog1, ID_NOTEBOOK, wxDefaultPosition, wxDefaultSize, wxNB_TOP );
  78. wxPanel* itemPanel4 = new wxPanel( itemNotebook3, ID_PANEL, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL );
  79. wxBoxSizer* itemBoxSizer5 = new wxBoxSizer(wxVERTICAL);
  80. itemPanel4->SetSizer(itemBoxSizer5);
  81. itemBoxSizer5->Add(5, 5, 0, wxALIGN_CENTER_HORIZONTAL|wxALL, 5);
  82. m_closeAfterGenerate = new wxCheckBox( itemPanel4, ID_CHECKBOX_CLOSECMAKE, _("Close down CMakeSetup after generation of project"), wxDefaultPosition, wxDefaultSize, wxCHK_2STATE );
  83. m_closeAfterGenerate->SetValue(FALSE);
  84. itemBoxSizer5->Add(m_closeAfterGenerate, 0, wxALIGN_LEFT|wxALL, 5);
  85. itemNotebook3->AddPage(itemPanel4, _("General"));
  86. itemBoxSizer2->Add(itemNotebook3, 1, wxGROW|wxALL|wxFIXED_MINSIZE, 5);
  87. wxBoxSizer* itemBoxSizer8 = new wxBoxSizer(wxHORIZONTAL);
  88. itemBoxSizer2->Add(itemBoxSizer8, 0, wxALIGN_CENTER_HORIZONTAL|wxLEFT|wxRIGHT|wxBOTTOM, 5);
  89. wxButton* itemButton9 = new wxButton( itemDialog1, wxID_OK, _("&OK"), wxDefaultPosition, wxDefaultSize, 0 );
  90. itemBoxSizer8->Add(itemButton9, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  91. wxButton* itemButton10 = new wxButton( itemDialog1, wxID_CANCEL, _("&Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
  92. itemBoxSizer8->Add(itemButton10, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5);
  93. ////@end CMOptionsDlg content construction
  94. }
  95. /*!
  96. * Should we show tooltips?
  97. */
  98. bool CMOptionsDlg::ShowToolTips()
  99. {
  100. return TRUE;
  101. }
  102. /*!
  103. * Get bitmap resources
  104. */
  105. wxBitmap CMOptionsDlg::GetBitmapResource( const wxString& name )
  106. {
  107. // Bitmap retrieval
  108. ////@begin CMOptionsDlg bitmap retrieval
  109. return wxNullBitmap;
  110. ////@end CMOptionsDlg bitmap retrieval
  111. }
  112. /*!
  113. * Get icon resources
  114. */
  115. wxIcon CMOptionsDlg::GetIconResource( const wxString& name )
  116. {
  117. // Icon retrieval
  118. ////@begin CMOptionsDlg icon retrieval
  119. return wxNullIcon;
  120. ////@end CMOptionsDlg icon retrieval
  121. }
  122. void CMOptionsDlg::SetConfig(wxConfig *cfg)
  123. {
  124. bool boolval;
  125. // close after generation
  126. cfg->Read(CM_CLOSEAFTERGEN, &boolval, CM_CLOSEAFTERGEN_DEF);
  127. m_closeAfterGenerate->SetValue(boolval);
  128. }
  129. void CMOptionsDlg::GetConfig(wxConfig *cfg)
  130. {
  131. // close after generation
  132. cfg->Write(CM_CLOSEAFTERGEN, m_closeAfterGenerate->GetValue());
  133. }
  134. /*!
  135. * wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE
  136. */
  137. void CMOptionsDlg::OnButtonOK( wxCommandEvent& event )
  138. {
  139. ////@begin wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE in CMOptionsDlg.
  140. // Before editing this code, remove the block markers.
  141. event.Skip();
  142. ////@end wxEVT_COMMAND_CHECKBOX_CLICKED event handler for ID_CHECKBOX_CLOSECMAKE in CMOptionsDlg.
  143. }