]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/slider95.cpp
wxEVT_COMMAND_CHOICE_SELECTED => wxEVT_COMMAND_COMBOBOX_SELECTED
[wxWidgets.git] / src / msw / slider95.cpp
index 2197868d25ae47a79fe9b02947d1074725bd26a9..6981d0a1b09df8eabd119e0cb35ba23e487d5b83 100644 (file)
@@ -22,6 +22,8 @@
 
 #ifndef WX_PRECOMP
 #include <stdio.h>
 
 #ifndef WX_PRECOMP
 #include <stdio.h>
+#include <wx/utils.h>
+#include <wx/brush.h>
 #endif
 
 #ifdef __WIN95__
 #endif
 
 #ifdef __WIN95__
 #include "wx/msw/slider95.h"
 #include "wx/msw/private.h"
 
 #include "wx/msw/slider95.h"
 #include "wx/msw/private.h"
 
-#if defined(__WIN95__) && !defined(__GNUWIN32__)
+#if (defined(__WIN95__) && !defined(__GNUWIN32__)) || defined(__TWIN32__)
 #include <commctrl.h>
 #endif
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl)
 #include <commctrl.h>
 #endif
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl)
-
-#if WXWIN_COMPATIBILITY
-BEGIN_EVENT_TABLE(wxSlider95, wxControl)
-  EVT_SCROLL(wxSlider95::OnScroll)
-END_EVENT_TABLE()
-#endif
-
 #endif
 
 // Slider
 #endif
 
 // Slider
@@ -68,8 +63,8 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
   SetValidator(validator);
 
   if (parent) parent->AddChild(this);
   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;
 
   m_staticValue = 0;
   m_staticMin = 0;
@@ -156,7 +151,7 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
 
   SetWindowText((HWND) m_hWnd, "");
 
 
   SetWindowText((HWND) m_hWnd, "");
 
-  SetFont(parent->GetFont());
+  SetFont(parent->GetFont());
 
   if ( m_windowStyle & wxSL_LABELS )
   {
 
   if ( m_windowStyle & wxSL_LABELS )
   {
@@ -168,20 +163,19 @@ bool wxSlider95::Create(wxWindow *parent, wxWindowID id,
                              wxGetInstance(), NULL);
 
 
                              wxGetInstance(), NULL);
 
 
-      if (GetFont())
+      if (GetFont().Ok())
       {
       {
-//        GetFont()->RealizeResource();
-        if (GetFont()->GetResourceHandle())
+        if (GetFont().GetResourceHandle())
         {
                    if ( m_staticMin )
                    SendMessage((HWND)m_staticMin,WM_SETFONT,
         {
                    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,
                    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,
            if (m_staticValue)
                    SendMessage((HWND)m_staticValue,WM_SETFONT,
-                        (WPARAM)GetFont()->GetResourceHandle(),0L);
+                        (WPARAM)GetFont().GetResourceHandle(),0L);
         }
       }
   }
         }
       }
   }
@@ -256,6 +250,11 @@ void wxSlider95::MSWOnVScroll(WXWORD wParam, WXWORD pos, WXHWND control)
         event.SetPosition(newPos);
         event.SetEventObject( this );
         GetEventHandler()->ProcessEvent(event);
         event.SetPosition(newPos);
         event.SetEventObject( this );
         GetEventHandler()->ProcessEvent(event);
+
+        wxCommandEvent cevent( wxEVT_COMMAND_SLIDER_UPDATED, GetId() );
+        cevent.SetEventObject( this );
+        GetEventHandler()->ProcessEvent( cevent );
+
       }
     }
 }
       }
     }
 }
@@ -369,7 +368,7 @@ void wxSlider95::SetSize(int x, int y, int width, int height, int sizeFlags)
   int cy;
   int cyf;
 
   int cy;
   int cyf;
 
-  wxGetCharSize(GetHWND(), &cx, &cy,GetFont());
+  wxGetCharSize(GetHWND(), &cx, &cy, & this->GetFont());
 
   if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
   {
 
   if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
   {
@@ -378,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);
     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, & this->GetFont());
 
     int max_len = 0;
 
     GetWindowText((HWND) m_staticMax, buf, 300);
 
     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, & this->GetFont());
     if (m_staticValue)
     {
       int new_width = (int)(wxMax(min_len, max_len));
     if (m_staticValue)
     {
       int new_width = (int)(wxMax(min_len, max_len));
@@ -439,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);
        {
     int min_len;
     GetWindowText((HWND) m_staticMin, buf, 300);
-    GetTextExtent(buf, &min_len, &cyf,NULL,NULL,GetFont());
+    GetTextExtent(buf, &min_len, &cyf,NULL,NULL, & this->GetFont());
 
     int max_len;
     GetWindowText((HWND) m_staticMax, buf, 300);
 
     int max_len;
     GetWindowText((HWND) m_staticMax, buf, 300);
-    GetTextExtent(buf, &max_len, &cyf,NULL,NULL, GetFont());
+    GetTextExtent(buf, &max_len, &cyf,NULL,NULL, & this->GetFont());
 
     if (m_staticValue)
     {
 
     if (m_staticValue)
     {
@@ -615,21 +614,6 @@ bool wxSlider95::ContainsHWND(WXHWND hWnd) const
        return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
 }
 
        return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
 }
 
-#if WXWIN_COMPATIBILITY
-// Backward compatibility
-void wxSlider95::OnScroll(wxScrollEvent& event)
-{
-    wxEventType oldEvent = event.GetEventType();
-    event.SetEventType( wxEVT_COMMAND_SLIDER_UPDATED );
-    if ( !GetEventHandler()->ProcessEvent(event) )
-    {
-        event.SetEventType( oldEvent );
-        if (!GetParent()->GetEventHandler()->ProcessEvent(event))
-            event.Skip();
-    }
-}
-#endif
-
 void wxSlider95::Command (wxCommandEvent & event)
 {
   SetValue (event.GetInt());
 void wxSlider95::Command (wxCommandEvent & event)
 {
   SetValue (event.GetInt());