home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / wxos2233.zip / wxOS2-2_3_3.zip / wxWindows-2.3.3 / contrib / src / xrc / xh_slidr.cpp < prev    next >
C/C++ Source or Header  |  2001-12-31  |  3KB  |  93 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        xh_slidr.cpp
  3. // Purpose:     XRC resource for wxSlider
  4. // Author:      Bob Mitchell
  5. // Created:     2000/03/21
  6. // RCS-ID:      $Id: xh_slidr.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_slidr.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_slidr.h"
  23. #include "wx/slider.h"
  24.  
  25. #if wxUSE_SLIDER
  26.  
  27. wxSliderXmlHandler::wxSliderXmlHandler() 
  28. : wxXmlResourceHandler() 
  29. {
  30.     XRC_ADD_STYLE(wxSL_HORIZONTAL);
  31.     XRC_ADD_STYLE(wxSL_VERTICAL);
  32.     XRC_ADD_STYLE(wxSL_AUTOTICKS);
  33.     XRC_ADD_STYLE(wxSL_LABELS);
  34.     XRC_ADD_STYLE(wxSL_LEFT);
  35.     XRC_ADD_STYLE(wxSL_TOP);
  36.     XRC_ADD_STYLE(wxSL_RIGHT);
  37.     XRC_ADD_STYLE(wxSL_BOTTOM);
  38.     XRC_ADD_STYLE(wxSL_BOTH);
  39.     XRC_ADD_STYLE(wxSL_SELRANGE);
  40.     AddWindowStyles();
  41. }
  42.  
  43. wxObject *wxSliderXmlHandler::DoCreateResource()
  44.     XRC_MAKE_INSTANCE(control, wxSlider)
  45.  
  46.     control->Create(m_parentAsWindow,
  47.                     GetID(),
  48.                     GetLong(wxT("value"), wxSL_DEFAULT_VALUE), 
  49.                     GetLong(wxT("min"), wxSL_DEFAULT_MIN),
  50.                     GetLong(wxT("max"), wxSL_DEFAULT_MAX),
  51.                     GetPosition(), GetSize(),
  52.                     GetStyle(),
  53.                     wxDefaultValidator,
  54.                     GetName());
  55.  
  56.     if( HasParam(wxT("tickfreq")))
  57.     {
  58.         control->SetTickFreq(GetLong(wxT("tickfreq")), 0);
  59.     }
  60.     if( HasParam(wxT("pagesize")))
  61.     {
  62.         control->SetPageSize(GetLong(wxT("pagesize")));
  63.     }
  64.     if( HasParam(wxT("linesize")))
  65.     {
  66.         control->SetLineSize(GetLong(wxT("linesize")));
  67.     }
  68.     if( HasParam(wxT("thumb")))
  69.     {
  70.         control->SetThumbLength(GetLong(wxT("thumb")));
  71.     }
  72.     if( HasParam(wxT("tick")))
  73.     {
  74.         control->SetTick(GetLong(wxT("tick")));
  75.     }
  76.     if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
  77.     {
  78.         control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
  79.     }
  80.  
  81.     SetupWindow(control);
  82.     
  83.     return control;
  84. }
  85.  
  86. bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
  87. {
  88.     return IsOfClass(node, wxT("wxSlider"));
  89. }
  90.  
  91. #endif
  92.