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_bmpbt.cpp < prev    next >
C/C++ Source or Header  |  2001-12-31  |  2KB  |  65 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. // Name:        xh_bmpbt.cpp
  3. // Purpose:     XRC resource for bitmap buttons
  4. // Author:      Brian Gavin
  5. // Created:     2000/09/09
  6. // RCS-ID:      $Id: xh_bmpbt.cpp,v 1.3 2001/12/29 16:14:04 VS Exp $
  7. // Copyright:   (c) 2000 Brian Gavin
  8. // Licence:     wxWindows licence
  9. /////////////////////////////////////////////////////////////////////////////
  10.  
  11. #ifdef __GNUG__
  12. #pragma implementation "xh_bmpbt.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_bmpbt.h"
  23. #include <wx/bmpbuttn.h>
  24.  
  25. wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler() 
  26. : wxXmlResourceHandler() 
  27. {
  28.     XRC_ADD_STYLE(wxBU_AUTODRAW);
  29.     XRC_ADD_STYLE(wxBU_LEFT);
  30.     XRC_ADD_STYLE(wxBU_RIGHT);
  31.     XRC_ADD_STYLE(wxBU_TOP);
  32.     XRC_ADD_STYLE(wxBU_BOTTOM);
  33.     AddWindowStyles();
  34. }
  35.  
  36. wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
  37.     XRC_MAKE_INSTANCE(button, wxBitmapButton)
  38.  
  39.     button->Create(m_parentAsWindow,
  40.                    GetID(),
  41.                    GetBitmap(wxT("bitmap")),
  42.                    GetPosition(), GetSize(),
  43.                    GetStyle(wxT("style"), wxBU_AUTODRAW),
  44.                    wxDefaultValidator,
  45.                    GetName());
  46.     if (GetBool(wxT("default"), 0))
  47.         button->SetDefault();
  48.     SetupWindow(button);
  49.     
  50.     if (!GetParamValue(wxT("selected")).IsEmpty())
  51.         button->SetBitmapSelected(GetBitmap(wxT("selected")));
  52.     if (!GetParamValue(wxT("focus")).IsEmpty())
  53.         button->SetBitmapFocus(GetBitmap(wxT("focus")));
  54.     if (!GetParamValue(wxT("disabled")).IsEmpty())
  55.         button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
  56.     
  57.     return button;
  58. }
  59.  
  60. bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
  61. {
  62.     return IsOfClass(node, wxT("wxBitmapButton"));
  63. }
  64.