]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/statbox.cpp
eede3a9705d8a0b4154d835177a994050eff76c2
   1 ///////////////////////////////////////////////////////////////////////////// 
   2 // Name:        msw/statbox.cpp 
   3 // Purpose:     wxStaticBox 
   4 // Author:      Julian Smart 
   8 // Copyright:   (c) Julian Smart 
   9 // Licence:     wxWindows licence 
  10 ///////////////////////////////////////////////////////////////////////////// 
  12 // ============================================================================ 
  14 // ============================================================================ 
  16 // ---------------------------------------------------------------------------- 
  18 // ---------------------------------------------------------------------------- 
  20 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) 
  21     #pragma implementation "statbox.h" 
  24 // For compilers that support precompilation, includes "wx.h". 
  25 #include "wx/wxprec.h" 
  35     #include "wx/dcclient.h" 
  38 #include "wx/statbox.h" 
  39 #include "wx/notebook.h" 
  41 #include "wx/msw/private.h" 
  43 // under CE this style is not defined but we don't need to make static boxes 
  44 // transparent there neither 
  45 #ifndef WS_EX_TRANSPARENT 
  46     #define WS_EX_TRANSPARENT 0 
  49 // ---------------------------------------------------------------------------- 
  51 // ---------------------------------------------------------------------------- 
  53 #if wxUSE_EXTENDED_RTTI 
  54 WX_DEFINE_FLAGS( wxStaticBoxStyle 
) 
  56 wxBEGIN_FLAGS( wxStaticBoxStyle 
) 
  57     // new style border flags, we put them first to 
  58     // use them for streaming out 
  59     wxFLAGS_MEMBER(wxBORDER_SIMPLE
) 
  60     wxFLAGS_MEMBER(wxBORDER_SUNKEN
) 
  61     wxFLAGS_MEMBER(wxBORDER_DOUBLE
) 
  62     wxFLAGS_MEMBER(wxBORDER_RAISED
) 
  63     wxFLAGS_MEMBER(wxBORDER_STATIC
) 
  64     wxFLAGS_MEMBER(wxBORDER_NONE
) 
  66     // old style border flags 
  67     wxFLAGS_MEMBER(wxSIMPLE_BORDER
) 
  68     wxFLAGS_MEMBER(wxSUNKEN_BORDER
) 
  69     wxFLAGS_MEMBER(wxDOUBLE_BORDER
) 
  70     wxFLAGS_MEMBER(wxRAISED_BORDER
) 
  71     wxFLAGS_MEMBER(wxSTATIC_BORDER
) 
  72     wxFLAGS_MEMBER(wxBORDER
) 
  74     // standard window styles 
  75     wxFLAGS_MEMBER(wxTAB_TRAVERSAL
) 
  76     wxFLAGS_MEMBER(wxCLIP_CHILDREN
) 
  77     wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
) 
  78     wxFLAGS_MEMBER(wxWANTS_CHARS
) 
  79     wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
) 
  80     wxFLAGS_MEMBER(wxALWAYS_SHOW_SB 
) 
  81     wxFLAGS_MEMBER(wxVSCROLL
) 
  82     wxFLAGS_MEMBER(wxHSCROLL
) 
  84 wxEND_FLAGS( wxStaticBoxStyle 
) 
  86 IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox
, wxControl
,"wx/statbox.h") 
  88 wxBEGIN_PROPERTIES_TABLE(wxStaticBox
) 
  89     wxPROPERTY( Label
,wxString
, SetLabel
, GetLabel
, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) 
  90     wxPROPERTY_FLAGS( WindowStyle 
, wxStaticBoxStyle 
, long , SetWindowStyleFlag 
, GetWindowStyleFlag 
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style 
  95 wxEND_PROPERTIES_TABLE() 
  97 wxBEGIN_HANDLERS_TABLE(wxStaticBox
) 
  98 wxEND_HANDLERS_TABLE() 
 100 wxCONSTRUCTOR_6( wxStaticBox 
, wxWindow
* , Parent 
, wxWindowID 
, Id 
, wxString 
, Label 
, wxPoint 
, Position 
, wxSize 
, Size 
, long , WindowStyle 
) 
 102 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
) 
 105 // ============================================================================ 
 107 // ============================================================================ 
 109 // ---------------------------------------------------------------------------- 
 111 // ---------------------------------------------------------------------------- 
 113 bool wxStaticBox::Create(wxWindow 
*parent
, 
 115                          const wxString
& label
, 
 119                          const wxString
& name
) 
 121     if ( !CreateControl(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) ) 
 124     if ( !MSWCreateControl(wxT("BUTTON"), label
, pos
, size
) ) 
 130 WXDWORD 
wxStaticBox::MSWGetStyle(long style
, WXDWORD 
*exstyle
) const 
 132     long styleWin 
= wxStaticBoxBase::MSWGetStyle(style
, exstyle
); 
 135         *exstyle 
= WS_EX_TRANSPARENT
; 
 137     return styleWin 
| BS_GROUPBOX
; 
 140 wxSize 
wxStaticBox::DoGetBestSize() const 
 143     wxGetCharSize(GetHWND(), &cx
, &cy
, GetFont()); 
 146     GetTextExtent(wxGetWindowText(m_hWnd
), &wBox
, &cy
); 
 149     int hBox 
= EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy
); 
 151     return wxSize(wBox
, hBox
); 
 154 #endif // wxUSE_STATBOX