]>
git.saurik.com Git - wxWidgets.git/blob - include/wx/msw/private/button.h
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: msw/private/button.h
3 // Purpose: helper functions used with native BUTTON control
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwidgets.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 #ifndef _WX_MSW_PRIVATE_BUTTON_H_
12 #define _WX_MSW_PRIVATE_BUTTON_H_
17 // returns BS_MULTILINE if the label contains new lines or 0 otherwise
18 inline int GetMultilineStyle(const wxString
& label
)
20 return label
.find(_T('\n')) == wxString::npos
? 0 : BS_MULTILINE
;
23 // update the style of the specified HWND to include or exclude BS_MULTILINE
24 // depending on whether the label contains the new lines
25 inline void UpdateMultilineStyle(HWND hwnd
, const wxString
& label
)
27 // update BS_MULTILINE style depending on the new label (resetting it
28 // doesn't seem to do anything very useful but it shouldn't hurt and we do
29 // have to set it whenever the label becomes multi line as otherwise it
30 // wouldn't be shown correctly as we don't use BS_MULTILINE when creating
31 // the control unless it already has new lines in its label)
32 long styleOld
= ::GetWindowLong(hwnd
, GWL_STYLE
),
34 if ( label
.find(_T('\n')) != wxString::npos
)
35 styleNew
= styleOld
| BS_MULTILINE
;
37 styleNew
= styleOld
& ~BS_MULTILINE
;
39 if ( styleNew
!= styleOld
)
40 ::SetWindowLong(hwnd
, GWL_STYLE
, styleNew
);
43 } // namespace wxMSWButton
45 #endif // _WX_MSW_PRIVATE_BUTTON_H_