X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/983162bd54600a8e72e32128b0ee92479c1475c0..89077ebcc8990c84d94a601b221210d3ff7a8ec7:/src/msw/radiobox.cpp diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 82ecdf8600..87a1f95af0 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -6,7 +6,7 @@ // Created: 04/01/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -23,6 +23,8 @@ #ifndef WX_PRECOMP #include #include "wx/setup.h" +#include "wx/bitmap.h" +#include "wx/brush.h" #include "wx/radiobox.h" #endif @@ -98,8 +100,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, SetValidator(val); parent->AddChild(this); - m_backgroundColour = parent->GetDefaultBackgroundColour() ; - m_foregroundColour = parent->GetDefaultForegroundColour() ; + m_backgroundColour = parent->GetBackgroundColour() ; + m_foregroundColour = parent->GetForegroundColour() ; m_windowStyle = (long&)style; @@ -125,27 +127,36 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, WXDWORD exStyle = Determine3DEffects(0, &want3D) ; // Even with extended styles, need to combine with WS_BORDER // for them to look right. - if (want3D && ((m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) || - (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))) +/* + if ( want3D || wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; +*/ - m_hWnd = (WXHWND) CreateWindowEx((DWORD) exStyle, GROUP_CLASS, (title == "" ? NULL : (const char *)title), - msStyle, - 0,0,0,0, - (HWND) parent->GetHWND(), (HMENU) m_windowId, wxGetInstance(), NULL) ; - HWND the_handle = (HWND) parent->GetHWND() ; + m_hWnd = (WXHWND)::CreateWindowEx + ( + (DWORD)exStyle, + GROUP_CLASS, + title, + msStyle, + 0, 0, 0, 0, + the_handle, + (HMENU)m_windowId, + wxGetInstance(), + NULL + ); + #if CTL3D if (want3D) { - Ctl3dSubclassCtl((HWND) m_hWnd); - m_useCtl3D = TRUE; + Ctl3dSubclassCtl((HWND)m_hWnd); + m_useCtl3D = TRUE; } #endif - SetFont(* parent->GetFont()); + SetFont(parent->GetFont()); SubclassWin((WXHWND)m_hWnd); @@ -171,13 +182,13 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, if (want3D) { Ctl3dSubclassCtl((HWND) m_hWnd); - m_useCtl3D = TRUE; + m_useCtl3D = TRUE; } #endif - if (GetFont()) + if (GetFont().Ok()) { SendMessage((HWND)m_radioButtons[i],WM_SETFONT, - (WPARAM)GetFont()->GetResourceHandle(),0L); + (WPARAM)GetFont().GetResourceHandle(),0L); } m_subControls.Append((wxObject *)newId); } @@ -207,8 +218,8 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, SetValidator(val); parent->AddChild(this); - m_backgroundColour = parent->GetDefaultBackgroundColour() ; - m_foregroundColour = parent->GetDefaultForegroundColour() ; + m_backgroundColour = parent->GetBackgroundColour() ; + m_foregroundColour = parent->GetForegroundColour() ; m_windowStyle = (long&)style; @@ -235,8 +246,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, WXDWORD exStyle = Determine3DEffects(0, &want3D) ; // Even with extended styles, need to combine with WS_BORDER // for them to look right. - if (want3D && ((m_windowStyle & wxSIMPLE_BORDER) || (m_windowStyle & wxRAISED_BORDER) || - (m_windowStyle & wxSUNKEN_BORDER) || (m_windowStyle & wxDOUBLE_BORDER))) + if ( want3D || wxStyleHasBorder(m_windowStyle) ) msStyle |= WS_BORDER; m_hWnd = (WXHWND) CreateWindowEx((DWORD) exStyle, GROUP_CLASS, (title == "" ? NULL : (const char *)title), @@ -250,11 +260,11 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, if (want3D) { Ctl3dSubclassCtl((HWND) m_hWnd); - m_useCtl3D = TRUE; + m_useCtl3D = TRUE; } #endif - SetFont(* parent->GetFont()); + SetFont(parent->GetFont()); // Subclass again for purposes of dialog editing mode SubclassWin((WXHWND)m_hWnd); @@ -283,7 +293,7 @@ bool wxRadioBox::Create(wxWindow *parent, wxWindowID id, const wxString& title, if (want3D) { Ctl3dSubclassCtl((HWND) m_hWnd); - m_useCtl3D = TRUE; + m_useCtl3D = TRUE; } #endif m_subControls.Append((wxObject *)newId); @@ -399,7 +409,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) int current_width, cyf; int cx1,cy1 ; - wxGetCharSize(m_hWnd, &cx1, &cy1, GetFont()); + wxGetCharSize(m_hWnd, &cx1, &cy1, & this->GetFont()); // Attempt to have a look coherent with other platforms: // We compute the biggest toggle dim, then we align all // items according this value. @@ -415,7 +425,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) { // It's a labelled toggle GetWindowText((HWND) m_radioButtons[i], buf, 300); - GetTextExtent(buf, ¤t_width, &cyf,NULL,NULL, GetFont()); + GetTextExtent(buf, ¤t_width, &cyf,NULL,NULL, & this->GetFont()); eachWidth = (int)(current_width + RADIO_SIZE); eachHeight = (int)((3*cyf)/2); } @@ -495,7 +505,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags) { // It's a labeled item GetWindowText((HWND) m_radioButtons[i], buf, 300); - GetTextExtent(buf, ¤t_width, &cyf,NULL,NULL,GetFont()); + GetTextExtent(buf, ¤t_width, &cyf,NULL,NULL, & this->GetFont()); // How do we find out radio button bitmap size!! // By adjusting them carefully, manually :-) @@ -584,7 +594,7 @@ wxString wxRadioBox::GetLabel(void) const void wxRadioBox::SetLabel(const wxString& label) { - if (m_hWnd && label) + if (m_hWnd) SetWindowText((HWND) m_hWnd, label); } @@ -651,7 +661,7 @@ void wxRadioBox::Show(int item, bool show) } WXHBRUSH wxRadioBox::OnCtlColor(WXHDC pDC, WXHWND pWnd, WXUINT nCtlColor, - WXUINT message, WXWPARAM wParam, WXLPARAM lParam) + WXUINT message, WXWPARAM wParam, WXLPARAM lParam) { #if CTL3D if ( m_useCtl3D ) @@ -701,11 +711,11 @@ bool wxRadioBox::SetStringSelection (const wxString& s) bool wxRadioBox::ContainsHWND(WXHWND hWnd) const { - int i; + int i; for (i = 0; i < Number(); i++) if (GetRadioButtons()[i] == hWnd) return TRUE; - return FALSE; + return FALSE; } void wxRadioBox::Command (wxCommandEvent & event) @@ -716,7 +726,7 @@ void wxRadioBox::Command (wxCommandEvent & event) long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) { - if (nMsg == WM_NCHITTEST) + if (nMsg == WM_NCHITTEST) { int xPos = LOWORD(lParam); // horizontal position of cursor int yPos = HIWORD(lParam); // vertical position of cursor @@ -729,6 +739,6 @@ long wxRadioBox::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) return (long)HTCLIENT; } - return wxControl::MSWWindowProc(nMsg, wParam, lParam); + return wxControl::MSWWindowProc(nMsg, wParam, lParam); }