Advertisement
AntonioVillanueva

DialogoPersonal I wxWidgets *.h

Jul 24th, 2018
269
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.09 KB | None | 0 0
  1. /*
  2.  * Declaracion de la clase DialogoPersonal Antonio Villanueva
  3.  * se tiene que utilizar con DialogoPersonal.cpp donde estan las declaraciones https://pastebin.com/z4qxVWRm
  4.  * g++ -Wall -static-libstdc++ -std=c++11 -Wunused-but-set-variable `wx-config --cxxflags` -o DialogPers *.cpp `wx-config --libs`
  5.  * A veces tenemos  que crear dialogos personificados fuera de los clasicos , para ello derivamos de wxDialog
  6.  */
  7. #ifndef _DIALOGO_PERSONAL_H
  8. #define _DIALOGO_PERSONAL_H
  9.  
  10. //INCLUDEs
  11. #include "wx/spinctrl.h"
  12. #include "wx/statline.h"
  13. #include <wx/dialog.h>
  14. #include <wx/sizer.h> //wxBoxSizer
  15. #include <wx/stattext.h> // wxStaticText
  16. #include <wx/textctrl.h> //wxTextCtrl
  17. #include <wx/choice.h>//wxChoice
  18. #include <wx/checkbox.h> //Check V
  19. #include <wx/button.h>//Botones
  20. #include <wx/msgdlg.h> //wxMessageBox
  21. #include <wx/app.h> //wxWidgets app
  22. //IDs
  23. enum {
  24.     ID_DIALOGO_PERSO= 10000,
  25.     ID_NOMBRE=10001,
  26.     ID_EDAD=10002,
  27.     ID_SEXO=10003,
  28.     ID_VOTO=10006,
  29.     ID_RESET=10004,
  30.     ID_OK=10007,
  31.     ID_CANCELAR=10008,
  32.     ID_HELP=10009,
  33. };
  34.  
  35. //Arranque de wxWidgets
  36.  
  37. class DialogoPersonalApp : public wxApp
  38. {
  39.     public:
  40.         virtual bool OnInit();//Llama a nuestro "main" wxWidgets
  41. };
  42.  
  43. //Declaracion de la clase DialogoPersonal
  44. class DialogoPersonal:public wxDialog{
  45.     DECLARE_CLASS(DialogoPersonal)
  46.    
  47.     DECLARE_EVENT_TABLE()
  48.     public:
  49.    
  50.     DialogoPersonal();
  51.     DialogoPersonal(wxWindow* parent,
  52.     wxWindowID id = ID_DIALOGO_PERSO,
  53.     const wxString& caption = wxT("Dialogo Personal"),
  54.     const wxPoint& pos = wxDefaultPosition,
  55.     const wxSize& size = wxDefaultSize,
  56.     long style =wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU);  
  57.     virtual ~DialogoPersonal();
  58.  
  59. //Inicializando las variables miembro m_variables
  60. void Init();
  61.  
  62. //Creacion
  63. bool Crea(wxWindow* parent,
  64.     wxWindowID id = ID_DIALOGO_PERSO,
  65.     const wxString& caption = wxT("Dialogo Personal"),
  66.     const wxPoint& pos = wxDefaultPosition,
  67.     const wxSize& size = wxDefaultSize,
  68.     long style =wxCAPTION|wxRESIZE_BORDER|wxSYSTEM_MENU);
  69.  
  70. //Crea wxSizers y Controles
  71. void CreaControles();
  72.  
  73. //Set Validators para el control de Dialogo
  74. void SetDialogValidators();
  75.  
  76. //Set Help Text para el control de Dialogo
  77. void SetDialogHelp();
  78.  
  79. //Accesores
  80. void SetNombre(const wxString& nombre){m_nombre=nombre;}
  81. wxString GetNombre()const {return m_nombre;}
  82.  
  83. void SetSexo(bool sexo){m_sexo= sexo ? 1:0;}
  84. bool GetSexo(){return m_sexo;}
  85.  
  86. void SetVoto(bool voto){m_voto=voto ? 1:0;}
  87. bool GetVoto(){return m_voto;}
  88.  
  89. //Declaraciones de los manipuladores de eventos "event handlers"
  90.  
  91. //wxEVT_UPDATE_UI event handler  para ID_VOTO
  92. void OnVotoUpdate(wxUpdateUIEvent& event);
  93.  
  94. //wxEVT_COMMAND_BUTTON_CLICKED event handler para ID_RESET
  95. void OnResetClick(wxCommandEvent& event);
  96.  
  97. //wxEVT_COMMAND_BUTTON_CLICKED event handler para ID_HELP
  98. void OnHelpClick(wxCommandEvent& event);
  99.  
  100. //wxEVT_COMMAND_BUTTON_CLICKED event handler para ID_OK
  101. void OnOK(wxCommandEvent& event);
  102.  
  103. //wxEVT_COMMAND_BUTTON_CLICKED event handler para ID_CANCEL
  104. void OnCancelar(wxCommandEvent& event);
  105.  
  106. //Variables miembro
  107. wxString m_nombre;
  108. int m_edad;
  109. int m_sexo;
  110. bool m_voto;
  111.  
  112. };
  113.  
  114. #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement