]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/statbox.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: msw/statbox.cpp
3 // Purpose: wxStaticBox
4 // Author: Julian Smart
8 // Copyright: (c) Julian Smart and Markus Holzem
9 // Licence: wxWindows license
10 /////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
21 #pragma implementation "statbox.h"
24 // For compilers that support precompilation, includes "wx.h".
25 #include "wx/wxprec.h"
33 #include "wx/dcclient.h"
36 #include "wx/statbox.h"
38 #include "wx/msw/private.h"
40 // ----------------------------------------------------------------------------
42 // ----------------------------------------------------------------------------
44 #if !USE_SHARED_LIBRARY
45 IMPLEMENT_DYNAMIC_CLASS(wxStaticBox
, wxControl
)
48 // ============================================================================
50 // ============================================================================
52 // ----------------------------------------------------------------------------
54 // ----------------------------------------------------------------------------
56 bool wxStaticBox::Create(wxWindow
*parent
,
58 const wxString
& label
,
64 if ( !CreateControl(parent
, id
, pos
, size
, style
, name
) )
67 if ( !MSWCreateControl(wxT("BUTTON"), BS_GROUPBOX
, pos
, size
, label
, 0) )
73 wxSize
wxStaticBox::DoGetBestSize() const
76 wxGetCharSize(GetHWND(), &cx
, &cy
, &GetFont());
79 GetTextExtent(wxGetWindowText(m_hWnd
), &wBox
, &cy
);
82 int hBox
= EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy
);
84 return wxSize(wBox
, hBox
);
87 long wxStaticBox::MSWWindowProc(WXUINT nMsg
, WXWPARAM wParam
, WXLPARAM lParam
)
92 // FIXME: this hack is specific to dialog ed, shouldn't it be
93 // somehow disabled during normal operation?
95 int xPos
= LOWORD(lParam
); // horizontal position of cursor
96 int yPos
= HIWORD(lParam
); // vertical position of cursor
98 ScreenToClient(&xPos
, &yPos
);
100 // Make sure you can drag by the top of the groupbox, but let
101 // other (enclosed) controls get mouse events also
103 return (long)HTCLIENT
;
107 // VZ: I will remove (or change) this soon... (15.11.99)
110 // prevent wxControl from processing this message because it will
111 // erase the background incorrectly and there is no way for us to
112 // override this at wxWin event level (if we do process the event,
113 // we don't know how to do it properly - paint the background
114 // without painting over other controls - and if we don't,
115 // wxControl still gets it)
116 return MSWDefWindowProc(nMsg
, wParam
, lParam
);
120 return wxControl::MSWWindowProc(nMsg
, wParam
, lParam
);