- SetName(name);
- SetValidator(validator);
-
- if (parent) parent->AddChild(this);
- SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
- SetForegroundColour(parent->GetDefaultForegroundColour()) ;
-
- m_staticValue = 0;
- m_staticMin = 0;
- m_staticMax = 0;
- m_pageSize = 1;
- m_lineSize = 1;
- m_windowStyle = style;
- m_tickFreq = 0;
-
- if ( id == -1 )
- m_windowId = (int)NewControlId();
- else
- m_windowId = id;
-
- int x = pos.x;
- int y = pos.y;
- int width = size.x;
- int height = size.y;
-
- long msStyle ;
-
- if ( m_windowStyle & wxSL_LABELS )
- {
- msStyle = WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER;
-
- bool want3D;
- WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
-
- m_staticValue = (WXHWND) CreateWindowEx(exStyle, "STATIC", NULL,
- msStyle,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
- wxGetInstance(), NULL);
-
- // Now create min static control
- sprintf(wxBuffer, "%d", minValue);
- m_staticMin = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
- STATIC_FLAGS,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
- wxGetInstance(), NULL);
- }
-
- msStyle = 0;
- if (m_windowStyle & wxSL_VERTICAL)
- msStyle = TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
- else
- msStyle = TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
-
- if ( m_windowStyle & wxSL_AUTOTICKS )
- msStyle |= TBS_AUTOTICKS ;
-
- if ( m_windowStyle & wxSL_LEFT )
- msStyle |= TBS_LEFT;
- else if ( m_windowStyle & wxSL_RIGHT )
- msStyle |= TBS_RIGHT;
- else if ( m_windowStyle & wxSL_TOP )
- msStyle |= TBS_TOP;
- else if ( m_windowStyle & wxSL_BOTTOM )
- msStyle |= TBS_BOTTOM;
- else if ( m_windowStyle & wxSL_BOTH )
- msStyle |= TBS_BOTH;
- else if ( ! (m_windowStyle & wxSL_AUTOTICKS) )
- msStyle |= TBS_NOTICKS;
-
- if ( m_windowStyle & wxSL_SELRANGE )
- msStyle |= TBS_ENABLESELRANGE ;
-
- HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxBuffer,
- msStyle,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
- wxGetInstance(), NULL);
-
- m_rangeMax = maxValue;
- m_rangeMin = minValue;
-
- m_pageSize = (int)((maxValue-minValue)/10);
-
- ::SendMessage(scroll_bar, TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
- ::SendMessage(scroll_bar, TBM_SETPOS, TRUE, (LPARAM)value);
- ::SendMessage(scroll_bar, TBM_SETPAGESIZE, 0, (LPARAM)m_pageSize);
-
- m_hWnd = (WXHWND)scroll_bar;
-
- SubclassWin(GetHWND());
-
- if ( m_windowStyle & wxSL_LABELS )
- {
- // Finally, create max value static item
- sprintf(wxBuffer, "%d", maxValue);
- m_staticMax = (WXHWND) CreateWindowEx(0, "STATIC", wxBuffer,
- STATIC_FLAGS,
- 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
- wxGetInstance(), NULL);
-
- SetFont(parent->GetFont());
-
- if (GetFont())
- {
-// GetFont()->RealizeResource();
- if (GetFont()->GetResourceHandle())
+ SetName(name);
+#if wxUSE_VALIDATORS
+ SetValidator(validator);
+#endif // wxUSE_VALIDATORS
+
+ if (parent) parent->AddChild(this);
+
+ SetBackgroundColour(parent->GetBackgroundColour()) ;
+ SetForegroundColour(parent->GetForegroundColour()) ;
+
+ m_staticValue = (WXHWND) NULL;;
+ m_staticMin = (WXHWND) NULL;;
+ m_staticMax = (WXHWND) NULL;;
+ m_pageSize = 1;
+ m_lineSize = 1;
+ m_windowStyle = style;
+ m_tickFreq = 0;
+
+ if ( id == -1 )
+ m_windowId = (int)NewControlId();
+ else
+ m_windowId = id;
+
+ int x = pos.x;
+ int y = pos.y;
+ int width = size.x;
+ int height = size.y;
+
+ long msStyle = 0;
+ long wstyle = 0;
+
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+
+ if ( m_windowStyle & wxSL_LABELS )
+ {
+ msStyle |= WS_CHILD | WS_VISIBLE | WS_BORDER | SS_CENTER;
+
+ bool want3D;
+ WXDWORD exStyle = Determine3DEffects(WS_EX_CLIENTEDGE, &want3D) ;
+
+ m_staticValue = (WXHWND) CreateWindowEx
+ (
+ exStyle, wxT("STATIC"), NULL,
+ msStyle,
+ 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
+ wxGetInstance(), NULL
+ );
+
+ // Now create min static control
+ wxSprintf(wxBuffer, wxT("%d"), minValue);
+ wstyle = STATIC_FLAGS;
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+ m_staticMin = (WXHWND) CreateWindowEx
+ (
+ 0, wxT("STATIC"), wxBuffer,
+ wstyle,
+ 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
+ wxGetInstance(), NULL
+ );
+ }
+
+ msStyle = 0;
+
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+
+ if (m_windowStyle & wxSL_VERTICAL)
+ msStyle = TBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
+ else
+ msStyle = TBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
+
+ if ( m_windowStyle & wxSL_AUTOTICKS )
+ msStyle |= TBS_AUTOTICKS ;
+
+ if ( m_windowStyle & wxSL_LEFT )
+ msStyle |= TBS_LEFT;
+ else if ( m_windowStyle & wxSL_RIGHT )
+ msStyle |= TBS_RIGHT;
+ else if ( m_windowStyle & wxSL_TOP )
+ msStyle |= TBS_TOP;
+ else if ( m_windowStyle & wxSL_BOTTOM )
+ msStyle |= TBS_BOTTOM;
+ else if ( m_windowStyle & wxSL_BOTH )
+ msStyle |= TBS_BOTH;
+ else if ( ! (m_windowStyle & wxSL_AUTOTICKS) )
+ msStyle |= TBS_NOTICKS;
+
+ if ( m_windowStyle & wxSL_SELRANGE )
+ msStyle |= TBS_ENABLESELRANGE;
+
+ HWND scroll_bar = CreateWindowEx
+ (
+ MakeExtendedStyle(m_windowStyle), TRACKBAR_CLASS, wxBuffer,
+ msStyle,
+ 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
+ wxGetInstance(), NULL
+ );
+
+ m_rangeMax = maxValue;
+ m_rangeMin = minValue;
+
+ m_pageSize = (int)((maxValue-minValue)/10);
+
+ ::SendMessage(scroll_bar, TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
+ ::SendMessage(scroll_bar, TBM_SETPOS, TRUE, (LPARAM)value);
+ ::SendMessage(scroll_bar, TBM_SETPAGESIZE, 0, (LPARAM)m_pageSize);
+
+ m_hWnd = (WXHWND)scroll_bar;
+
+ SubclassWin(GetHWND());
+
+ ::SetWindowText((HWND) m_hWnd, wxT(""));
+
+ SetFont(parent->GetFont());
+
+ if ( m_windowStyle & wxSL_LABELS )
+ {
+ // Finally, create max value static item
+ wxSprintf(wxBuffer, wxT("%d"), maxValue);
+ wstyle = STATIC_FLAGS;
+
+ if ( m_windowStyle & wxCLIP_SIBLINGS )
+ msStyle |= WS_CLIPSIBLINGS;
+
+ m_staticMax = (WXHWND) CreateWindowEx
+ (
+ 0, wxT("STATIC"), wxBuffer,
+ wstyle,
+ 0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
+ wxGetInstance(), NULL
+ );
+
+
+ if (GetFont().Ok())