xh_slidrcombo.cpp

Go to the documentation of this file.
00001 
00002 // Name:        src/xrc/xh_slidrcombo.cpp
00003 // Purpose:     XRC resource for wxSliderCombo
00004 // Author:      Mart Raudsepp - Based on src/xrc/xh_odcombo.cpp
00005 // Created:     2006/07/24
00006 // RCS-ID:      $Id: $
00007 // Copyright:   (c) 2006 Mart Raudsepp
00008 // Licence:     wxWindows licence
00010 
00011 // For compilers that support precompilation, includes "wx.h".
00012 #include "wx/wxprec.h"
00013 
00014 #ifdef __BORLANDC__
00015     #pragma hdrstop
00016 #endif
00017 
00018 #if wxUSE_XRC //&& wxUSE_SLIDERCOMBO
00019 
00020 #include "xh_slidrcombo.h"
00021 #include <wx/intl.h>
00022 #include <wx/textctrl.h>
00023 
00024 #include "slidercombo.h"
00025 #include <wx/slider.h> // For wxSL_* styles
00026 
00027 IMPLEMENT_DYNAMIC_CLASS(wxSliderComboXmlHandler, wxXmlResourceHandler)
00028 
00029 wxSliderComboXmlHandler::wxSliderComboXmlHandler()
00030                         :wxXmlResourceHandler()
00031 {
00032     XRC_ADD_STYLE(wxCB_READONLY);
00033     XRC_ADD_STYLE(wxTE_PROCESS_ENTER);
00034     XRC_ADD_STYLE(wxSL_HORIZONTAL);
00035     XRC_ADD_STYLE(wxSL_VERTICAL);
00036     XRC_ADD_STYLE(wxSL_LABELS);
00037     XRC_ADD_STYLE(wxSL_INVERSE);
00038     AddWindowStyles();
00039 }
00040 
00041 wxObject *wxSliderComboXmlHandler::DoCreateResource()
00042 {
00043     XRC_MAKE_INSTANCE(control, wxSliderCombo)
00044 
00045     control->Create(m_parentAsWindow,
00046                     GetID(),
00047                     GetLong(wxT("value")),
00048                     GetPosition(), GetSize(),
00049                     GetStyle(),
00050                     GetName());
00051 
00052     // Slider like stuff
00053     if( HasParam(wxT("tickfreq")))
00054     {
00055         control->SetTickFreq(GetLong(wxT("tickfreq")), 0);
00056     }
00057     if( HasParam(wxT("pagesize")))
00058     {
00059         control->SetPageSize(GetLong(wxT("pagesize")));
00060     }
00061     if( HasParam(wxT("linesize")))
00062     {
00063         control->SetLineSize(GetLong(wxT("linesize")));
00064     }
00065     if( HasParam(wxT("thumb")))
00066     {
00067         control->SetThumbLength(GetLong(wxT("thumb")));
00068     }
00069     if( HasParam(wxT("tick")))
00070     {
00071         control->SetTick(GetLong(wxT("tick")));
00072     }
00073     if( HasParam(wxT("selmin")) && HasParam(wxT("selmax")))
00074     {
00075         control->SetSelection(GetLong(wxT("selmin")), GetLong(wxT("selmax")));
00076     }
00077 
00078     // ComboCtrl like stuff
00079     wxSize ButtonSize=GetSize(wxT("buttonsize"));
00080     if (ButtonSize != wxDefaultSize)
00081     control->SetButtonPosition(ButtonSize.GetWidth(), ButtonSize.GetHeight());
00082 
00083     SetupWindow(control);
00084 
00085     return control;
00086 }
00087 
00088 bool wxSliderComboXmlHandler::CanHandle(wxXmlNode *node)
00089 {
00090 #if wxCHECK_VERSION(2,7,0)
00091 
00092     return (IsOfClass(node, wxT("wxSliderCombo")));
00093 
00094 #else
00095 
00096 //  Avoid GCC bug - this fails on certain GCC 3.3 and 3.4 builds for an unknown reason
00097 //  it is believed to be related to the fact IsOfClass is inline, and node->GetPropVal
00098 //  gets passed an invalid "this" pointer. On 2.7, the function is out of line, so the
00099 //  above should work fine. This code is left in here so this file can easily be used
00100 //  in a version backported to 2.6. All we are doing here is expanding the macro
00101 
00102     bool fOurClass = node->GetPropVal(wxT("class"), wxEmptyString) == wxT("wxSliderCombo");
00103     return (fOurClass);
00104 #endif
00105 }
00106 
00107 #endif // wxUSE_XRC //&& wxUSE_SLIDERCOMBO

Generated on Sat Nov 10 03:49:02 2007 for Camelot by  doxygen 1.4.4