- /* This is overloaded in wxSlider so that the proper width/height will always be used
- * for the slider different values would cause redrawing and mouse detection problems */
- void wxSlider::SetSizeHints( int minW, int minH,
- int maxW , int maxH ,
- int incW , int incH )
- {
- wxSize size = GetBestSize();
-
- if(GetWindowStyle() & wxSL_VERTICAL) {
- wxWindow::SetSizeHints(size.x, minH, size.x, maxH, incW, incH);
- }
- else {
- wxWindow::SetSizeHints(minW, size.y, maxW, size.y, incW, incH);
- }
- }
-
- wxSize wxSlider::DoGetBestSize() const
- {
- wxSize size;
- int textwidth, textheight;
-
- if(GetWindowStyle() & wxSL_LABELS)
- {
- wxString text;
- int ht, wd;
-
- // Get maximum text label width and height
- text.Printf("%d", m_rangeMin);
- GetTextExtent(text, &textwidth, &textheight);
- text.Printf("%d", m_rangeMax);
- GetTextExtent(text, &wd, &ht);
- if(ht > textheight) {
- textheight = ht;
- }
- if (wd > textwidth) {
- textwidth = wd;
- }
- }
-
- if(GetWindowStyle() & wxSL_VERTICAL)
- {
- if(GetWindowStyle() & wxSL_AUTOTICKS) {
- size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
- }
- else {
- size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
- }
- if(GetWindowStyle() & wxSL_LABELS) {
- size.x += textwidth + wxSLIDER_BORDERTEXT;
- }
- size.y = 150;
- }
- else
- {
- if(GetWindowStyle() & wxSL_AUTOTICKS) {
- size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
- }
- else {
- size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
- }
- if(GetWindowStyle() & wxSL_LABELS) {
- size.y += textheight + wxSLIDER_BORDERTEXT;
- }
- size.x = 150;
- }
- return size;
- }
-
- void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
- {
+wxSize wxSlider::DoGetBestSize() const
+{
+ wxSize size;
+ int textwidth, textheight;
+
+ if(GetWindowStyle() & wxSL_LABELS)
+ {
+ wxString text;
+ int ht, wd;
+
+ // Get maximum text label width and height
+ text.Printf(wxT("%d"), m_rangeMin);
+ GetTextExtent(text, &textwidth, &textheight);
+ text.Printf(wxT("%d"), m_rangeMax);
+ GetTextExtent(text, &wd, &ht);
+ if(ht > textheight) {
+ textheight = ht;
+ }
+ if (wd > textwidth) {
+ textwidth = wd;
+ }
+ }
+
+ if(GetWindowStyle() & wxSL_VERTICAL)
+ {
+ if(GetWindowStyle() & wxSL_AUTOTICKS) {
+ size.x = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+ }
+ else {
+ size.x = wxSLIDER_DIMENSIONACROSS_ARROW;
+ }
+ if(GetWindowStyle() & wxSL_LABELS) {
+ size.x += textwidth + wxSLIDER_BORDERTEXT;
+ }
+ size.y = 150;
+ }
+ else
+ {
+ if(GetWindowStyle() & wxSL_AUTOTICKS) {
+ size.y = wxSLIDER_DIMENSIONACROSS_WITHTICKMARKS;
+ }
+ else {
+ size.y = wxSLIDER_DIMENSIONACROSS_ARROW;
+ }
+ if(GetWindowStyle() & wxSL_LABELS) {
+ size.y += textheight + wxSLIDER_BORDERTEXT;
+ }
+ size.x = 150;
+ }
+ return size;
+}
+
+void wxSlider::DoSetSize(int x, int y, int width, int height, int sizeFlags)
+{