X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/81d66cf39f810503baed79213bc3122fda0ccc7b..a6b0bd49c72e577a218bfe10fc1526cf2ad6293d:/src/msw/slider95.cpp?ds=sidebyside diff --git a/src/msw/slider95.cpp b/src/msw/slider95.cpp index 883951314d..6e5f9c4ba3 100644 --- a/src/msw/slider95.cpp +++ b/src/msw/slider95.cpp @@ -36,11 +36,11 @@ #if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl) -#if WXWIN_COMPATIBILITY BEGIN_EVENT_TABLE(wxSlider95, wxControl) +#if WXWIN_COMPATIBILITY EVT_SCROLL(wxSlider95::OnScroll) -END_EVENT_TABLE() #endif +END_EVENT_TABLE() #endif @@ -68,8 +68,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, SetValidator(validator); if (parent) parent->AddChild(this); - SetBackgroundColour(parent->GetDefaultBackgroundColour()) ; - SetForegroundColour(parent->GetDefaultForegroundColour()) ; + SetBackgroundColour(parent->GetBackgroundColour()) ; + SetForegroundColour(parent->GetForegroundColour()) ; m_staticValue = 0; m_staticMin = 0; @@ -154,6 +154,10 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, SubclassWin(GetHWND()); + SetWindowText((HWND) m_hWnd, ""); + + SetFont(parent->GetFont()); + if ( m_windowStyle & wxSL_LABELS ) { // Finally, create max value static item @@ -163,22 +167,20 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id, 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(), wxGetInstance(), NULL); - SetFont(parent->GetFont()); - if (GetFont()) + if (GetFont().Ok()) { -// GetFont()->RealizeResource(); - if (GetFont()->GetResourceHandle()) + if (GetFont().GetResourceHandle()) { if ( m_staticMin ) SendMessage((HWND)m_staticMin,WM_SETFONT, - (WPARAM)GetFont()->GetResourceHandle(),0L); + (WPARAM)GetFont().GetResourceHandle(),0L); if ( m_staticMax ) SendMessage((HWND)m_staticMax,WM_SETFONT, - (WPARAM)GetFont()->GetResourceHandle(),0L); + (WPARAM)GetFont().GetResourceHandle(),0L); if (m_staticValue) SendMessage((HWND)m_staticValue,WM_SETFONT, - (WPARAM)GetFont()->GetResourceHandle(),0L); + (WPARAM)GetFont().GetResourceHandle(),0L); } } } @@ -366,7 +368,7 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags) int cy; int cyf; - wxGetCharSize(GetHWND(), &cx, &cy,GetFont()); + wxGetCharSize(GetHWND(), &cx, &cy, & GetFont()); if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL) { @@ -375,12 +377,12 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags) int min_len = 0; GetWindowText((HWND) m_staticMin, buf, 300); - GetTextExtent(buf, &min_len, &cyf,NULL,NULL, GetFont()); + GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & GetFont()); int max_len = 0; GetWindowText((HWND) m_staticMax, buf, 300); - GetTextExtent(buf, &max_len, &cyf,NULL,NULL, GetFont()); + GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & GetFont()); if (m_staticValue) { int new_width = (int)(wxMax(min_len, max_len)); @@ -418,6 +420,11 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags) else { // No labels + // If we're prepared to use the existing size, then... + if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO)) + { + GetSize(&w1, &h1); + } if ( w1 < 0 ) w1 = 200; if ( h1 < 0 ) @@ -431,11 +438,11 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags) { int min_len; GetWindowText((HWND) m_staticMin, buf, 300); - GetTextExtent(buf, &min_len, &cyf,NULL,NULL,GetFont()); + GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & GetFont()); int max_len; GetWindowText((HWND) m_staticMax, buf, 300); - GetTextExtent(buf, &max_len, &cyf,NULL,NULL, GetFont()); + GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & GetFont()); if (m_staticValue) { @@ -479,6 +486,11 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags) else { // No labels + // If we're prepared to use the existing size, then... + if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO)) + { + GetSize(&w1, &h1); + } if ( w1 < 0 ) w1 = 20; if ( h1 < 0 )