Advertisement
Guest User

Untitled

a guest
Jan 19th, 2014
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.70 KB | None | 0 0
  1. <<<<<mychoice.h>>>>
  2. #define MYCHOICE_H
  3. #include <wx/choice.h>
  4.  
  5. class mychoice : wxChoice
  6. {
  7.     public:
  8.     mychoice(wxWindow *parent,
  9.                wxWindowID id,
  10.                const wxPoint& pos = wxDefaultPosition,
  11.                const wxSize& size = wxDefaultSize,
  12.                int n = 0, const wxString choices[] = NULL,
  13.                long style = 0,
  14.                const wxValidator& validator = wxDefaultValidator,
  15.                const wxString& name = wxChoiceNameStr )
  16.         : wxChoice(parent, id, pos, size, n, choices,
  17.                      style, validator, name) { }
  18.  
  19. protected:
  20.     void OnFocusGot(wxFocusEvent& event)
  21.     {
  22. //        wxLogMessage(_T("MyChoice::OnFocusGot"));
  23.  
  24.         event.Skip();
  25.     }
  26.  
  27.     void OnFocusLost(wxFocusEvent& event)
  28.     {
  29.    //     wxLogMessage(_T("MyChoice::OnFocusLost"));
  30.  
  31.         event.Skip();
  32.     }
  33.  
  34. private:
  35.     DECLARE_EVENT_TABLE()
  36.  
  37. };
  38.  
  39. #endif // MYCHOICE_H
  40.  
  41.  
  42.  
  43. <<<<file test.h>>>
  44. #ifndef TEST_H
  45. #define TEST_H
  46. #include "mychoice.h"
  47. //(*Headers(test)
  48. #include <wx/sizer.h>
  49. #include <wx/panel.h>
  50. #include <wx/dialog.h>
  51. //*)
  52.  
  53. class test.: public wxDialog
  54. {
  55.     public:
  56.  
  57.         test(wxWindow* parent,wxWindowID id=wxID_ANY,const wxPoint& pos=wxDefaultPosition,const wxSize& size=wxDefaultSize);
  58.         virtual ~test();
  59.  
  60.         //(*Declarations(test)
  61.         wxPanel* Panel1;
  62.         //*)
  63.         mychoice * Choice1;
  64.     protected:
  65.  
  66.         //(*Identifiers(test)
  67.         static const long ID_PANEL1;
  68.         //*)
  69.  
  70.         static const long ID_CHOICE1;
  71.  
  72.     private:
  73.  
  74.         //(*Handlers(test)
  75.         //*)
  76.  
  77.         DECLARE_EVENT_TABLE()
  78. };
  79.  
  80. #endif
  81.  
  82.  
  83. <<<<<<test.cpp>>>>>>>>
  84. #include "test.h"
  85. #include "mychoice.h"
  86. //(*InternalHeaders(test)
  87. #include <wx/intl.h>
  88. #include <wx/string.h>
  89. //*)
  90.  
  91. //(*IdInit(test)
  92. const long test::ID_PANEL1 = wxNewId();
  93. //*)
  94. const long test::ID_CHOICE1 = wxNewId();
  95. BEGIN_EVENT_TABLE(test,wxDialog)
  96.     //(*EventTable(test)
  97.     //*)
  98. END_EVENT_TABLE()
  99.  
  100. test::test(wxWindow* parent,wxWindowID id,const wxPoint& pos,const wxSize& size)
  101. {
  102.     //(*Initialize(test)
  103.     wxBoxSizer* BoxSizer1;
  104.  
  105.     Create(parent, id, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxDEFAULT_DIALOG_STYLE, _T("id"));
  106.     SetClientSize(wxDefaultSize);
  107.     Move(wxDefaultPosition);
  108.     BoxSizer1 = new wxBoxSizer(wxHORIZONTAL);
  109.     Panel1 = new wxPanel(this, ID_PANEL1, wxDefaultPosition, wxDefaultSize, wxTAB_TRAVERSAL, _T("ID_PANEL1"));
  110.     BoxSizer1->Add(Panel1, 1, wxALL|wxALIGN_CENTER_HORIZONTAL|wxALIGN_CENTER_VERTICAL, 5);
  111.     SetSizer(BoxSizer1);
  112.     BoxSizer1->Fit(this);
  113.     BoxSizer1->SetSizeHints(this);
  114.     //*)
  115.     Choice1 = new mychoice(Panel1, ID_CHOICE1, wxDefaultPosition, wxDefaultSize, 0, 0, 0, wxDefaultValidator, _T("ID_CHOICE1"));
  116.  
  117.  
  118.  
  119. }
  120.  
  121. test::~test()
  122. {
  123.     //(*Destroy(test)
  124.     //*)
  125. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement