]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/statbox.cpp
672b7eb6ff3683e90aa7e18e0a6464234b5401d6
   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" 
  40 #include "wx/msw/private.h" 
  42 // ---------------------------------------------------------------------------- 
  44 // ---------------------------------------------------------------------------- 
  46 #if wxUSE_EXTENDED_RTTI 
  47 WX_DEFINE_FLAGS( wxStaticBoxStyle 
) 
  49 wxBEGIN_FLAGS( wxStaticBoxStyle 
) 
  50     // new style border flags, we put them first to 
  51     // use them for streaming out 
  52     wxFLAGS_MEMBER(wxBORDER_SIMPLE
) 
  53     wxFLAGS_MEMBER(wxBORDER_SUNKEN
) 
  54     wxFLAGS_MEMBER(wxBORDER_DOUBLE
) 
  55     wxFLAGS_MEMBER(wxBORDER_RAISED
) 
  56     wxFLAGS_MEMBER(wxBORDER_STATIC
) 
  57     wxFLAGS_MEMBER(wxBORDER_NONE
) 
  59     // old style border flags 
  60     wxFLAGS_MEMBER(wxSIMPLE_BORDER
) 
  61     wxFLAGS_MEMBER(wxSUNKEN_BORDER
) 
  62     wxFLAGS_MEMBER(wxDOUBLE_BORDER
) 
  63     wxFLAGS_MEMBER(wxRAISED_BORDER
) 
  64     wxFLAGS_MEMBER(wxSTATIC_BORDER
) 
  65     wxFLAGS_MEMBER(wxBORDER
) 
  67     // standard window styles 
  68     wxFLAGS_MEMBER(wxTAB_TRAVERSAL
) 
  69     wxFLAGS_MEMBER(wxCLIP_CHILDREN
) 
  70     wxFLAGS_MEMBER(wxTRANSPARENT_WINDOW
) 
  71     wxFLAGS_MEMBER(wxWANTS_CHARS
) 
  72     wxFLAGS_MEMBER(wxFULL_REPAINT_ON_RESIZE
) 
  73     wxFLAGS_MEMBER(wxALWAYS_SHOW_SB 
) 
  74     wxFLAGS_MEMBER(wxVSCROLL
) 
  75     wxFLAGS_MEMBER(wxHSCROLL
) 
  77 wxEND_FLAGS( wxStaticBoxStyle 
) 
  79 IMPLEMENT_DYNAMIC_CLASS_XTI(wxStaticBox
, wxControl
,"wx/statbox.h") 
  81 wxBEGIN_PROPERTIES_TABLE(wxStaticBox
) 
  82     wxPROPERTY( Label
,wxString
, SetLabel
, GetLabel
, wxString() , 0 /*flags*/ , wxT("Helpstring") , wxT("group")) 
  83     wxPROPERTY_FLAGS( WindowStyle 
, wxStaticBoxStyle 
, long , SetWindowStyleFlag 
, GetWindowStyleFlag 
, EMPTY_MACROVALUE
, 0 /*flags*/ , wxT("Helpstring") , wxT("group")) // style 
  88 wxEND_PROPERTIES_TABLE() 
  90 wxBEGIN_HANDLERS_TABLE(wxStaticBox
) 
  91 wxEND_HANDLERS_TABLE() 
  93 wxCONSTRUCTOR_6( wxStaticBox 
, wxWindow
* , Parent 
, wxWindowID 
, Id 
, wxString 
, Label 
, wxPoint 
, Position 
, wxSize 
, Size 
, long , WindowStyle 
) 
  95 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
) 
  98 // ============================================================================ 
 100 // ============================================================================ 
 102 // ---------------------------------------------------------------------------- 
 104 // ---------------------------------------------------------------------------- 
 106 bool wxStaticBox::Create(wxWindow 
*parent
, 
 108                          const wxString
& label
, 
 112                          const wxString
& name
) 
 114     if ( !CreateControl(parent
, id
, pos
, size
, style
, wxDefaultValidator
, name
) ) 
 117     if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX
, pos
, size
, label
, 0) ) 
 123 wxSize 
wxStaticBox::DoGetBestSize() const 
 126     wxGetCharSize(GetHWND(), &cx
, &cy
, GetFont()); 
 129     GetTextExtent(wxGetWindowText(m_hWnd
), &wBox
, &cy
); 
 132     int hBox 
= EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy
); 
 134     return wxSize(wBox
, hBox
); 
 137 #endif // wxUSE_STATBOX