home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2240.zip / wxWindows-2.4.0 / contrib / src / xrc / xh_spin.cpp < prev    next >
C/C++ Source or Header  |  2001-12-29  |  3KB  |  98 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        xh_spin.cpp
  3. // Purpose:     XRC resource for wxSpinButton
  4. // Author:      Bob Mitchell
  5. // Created:     2000/03/21
  6. // RCS-ID:      $Id: xh_spin.cpp,v 1.4 2001/12/29 16:14:04 VS Exp $
  7. // Copyright:   (c) 2000 Bob Mitchell and Verant Interactive
  8. // Licence:     wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. #ifdef __GNUG__
  12. #pragma implementation "xh_spin.h"
  13. #endif
  14.  
  15. // For compilers that support precompilation, includes "wx.h".
  16. #include "wx/wxprec.h"
  17.  
  18. #ifdef __BORLANDC__
  19.     #pragma hdrstop
  20. #endif
  21.  
  22. #include "wx/xrc/xh_spin.h"
  23. #include "wx/spinctrl.h"
  24.  
  25. #if wxUSE_SPINBTN
  26.  
  27. wxSpinButtonXmlHandler::wxSpinButtonXmlHandler() 
  28. : wxXmlResourceHandler() 
  29. {
  30.     XRC_ADD_STYLE(wxSP_HORIZONTAL);
  31.     XRC_ADD_STYLE(wxSP_VERTICAL);
  32.     XRC_ADD_STYLE(wxSP_ARROW_KEYS);
  33.     XRC_ADD_STYLE(wxSP_WRAP);
  34.     AddWindowStyles();
  35. }
  36.  
  37. wxObject *wxSpinButtonXmlHandler::DoCreateResource()
  38.     XRC_MAKE_INSTANCE(control, wxSpinButton)
  39.  
  40.     control->Create(m_parentAsWindow,
  41.                     GetID(),
  42.                     GetPosition(), GetSize(),
  43.                     GetStyle(wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS),
  44.                     GetName());
  45.  
  46.     control->SetValue(GetLong( wxT("value"), wxSP_DEFAULT_VALUE));
  47.     control->SetRange(GetLong( wxT("min"), wxSP_DEFAULT_MIN),
  48.                       GetLong(wxT("max"), wxSP_DEFAULT_MAX));
  49.     SetupWindow(control);
  50.     
  51.     return control;
  52. }
  53.  
  54. bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
  55. {
  56.     return IsOfClass(node, wxT("wxSpinButton"));
  57. }
  58.  
  59. #endif // wxUSE_SPINBTN
  60.  
  61. #if wxUSE_SPINCTRL
  62.  
  63. wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler() 
  64. : wxXmlResourceHandler() 
  65. {
  66.     XRC_ADD_STYLE(wxSP_HORIZONTAL);
  67.     XRC_ADD_STYLE(wxSP_VERTICAL);
  68.     XRC_ADD_STYLE(wxSP_ARROW_KEYS);
  69.     XRC_ADD_STYLE(wxSP_WRAP);
  70. }
  71.  
  72. wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
  73.     XRC_MAKE_INSTANCE(control, wxSpinCtrl)
  74.     
  75.     control->Create(m_parentAsWindow,
  76.                     GetID(),
  77.                     GetText(wxT("value")),
  78.                     GetPosition(), GetSize(),
  79.                     GetStyle(wxT("style"), wxSP_ARROW_KEYS),
  80.                     GetLong(wxT("min"), wxSP_DEFAULT_MIN),
  81.                     GetLong(wxT("max"), wxSP_DEFAULT_MAX),
  82.                     GetLong(wxT("value"), wxSP_DEFAULT_VALUE),
  83.                     GetName());
  84.  
  85.     SetupWindow(control);
  86.     
  87.     return control;
  88. }
  89.  
  90. bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
  91. {
  92.     return IsOfClass(node, wxT("wxSpinCtrl"));
  93. }
  94.  
  95. #endif // wxUSE_SPINCTRL
  96.