Separated out Win95 versions of gauge, slider; added wxTabCtrl::GetCurFocus
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@153 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: gauge.h
|
// Name: gauge.h
|
||||||
// Purpose: wxGauge class
|
// Purpose: wxGauge header, includes gauge class headers as appropriate
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -16,66 +16,15 @@
|
|||||||
#pragma interface "gauge.h"
|
#pragma interface "gauge.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/control.h"
|
#ifdef __WIN95__
|
||||||
|
#include "wx/msw/gauge95.h"
|
||||||
WXDLLEXPORT_DATA(extern const char*) wxGaugeNameStr;
|
#define wxGauge wxGauge95
|
||||||
|
#define classwxGauge classwxGauge95
|
||||||
// Group box
|
#else
|
||||||
class WXDLLEXPORT wxGauge: public wxControl
|
#include "wx/msw/gaugemsw.h
|
||||||
{
|
#define wxGauge wxGaugeMSW
|
||||||
DECLARE_DYNAMIC_CLASS(wxGauge)
|
#define classwxGauge classwxGaugeMSW
|
||||||
public:
|
|
||||||
inline wxGauge(void) { m_rangeMax = 0; m_gaugePos = 0; m_useProgressBar = FALSE; }
|
|
||||||
|
|
||||||
inline wxGauge(wxWindow *parent, const wxWindowID id,
|
|
||||||
const int range,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
const long style = wxGA_HORIZONTAL,
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxGaugeNameStr)
|
|
||||||
{
|
|
||||||
Create(parent, id, range, pos, size, style, validator, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Create(wxWindow *parent, const wxWindowID id,
|
|
||||||
const int range,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
const long style = wxGA_HORIZONTAL,
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxGaugeNameStr);
|
|
||||||
|
|
||||||
void SetShadowWidth(const int w);
|
|
||||||
void SetBezelFace(const int w);
|
|
||||||
void SetRange(const int r);
|
|
||||||
void SetValue(const int pos);
|
|
||||||
|
|
||||||
int GetShadowWidth(void) const ;
|
|
||||||
int GetBezelFace(void) const ;
|
|
||||||
int GetRange(void) const ;
|
|
||||||
int GetValue(void) const ;
|
|
||||||
|
|
||||||
void SetForegroundColour(const wxColour& col);
|
|
||||||
void SetBackgroundColour(const wxColour& col);
|
|
||||||
|
|
||||||
// Backward compatibility
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
inline void SetButtonColour(const wxColour& col) { SetForegroundColour(col); }
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO);
|
|
||||||
|
|
||||||
// Are we a Win95 progress bar, or a normal gauge?
|
|
||||||
inline bool GetProgressBar(void) const { return m_useProgressBar; }
|
|
||||||
|
|
||||||
virtual void Command(wxCommandEvent& WXUNUSED(event)) {} ;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
int m_rangeMax;
|
|
||||||
int m_gaugePos;
|
|
||||||
bool m_useProgressBar;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// __GAUGEH__
|
// __GAUGEH__
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: slider.h
|
// Name: slider.h
|
||||||
// Purpose: wxSlider class
|
// Purpose: wxSlider header, includes slider class headers as appropriate
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -9,102 +9,22 @@
|
|||||||
// Licence: wxWindows license
|
// Licence: wxWindows license
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifndef __SLIDERH__
|
#ifndef _SLIDER_H_
|
||||||
#define __SLIDERH__
|
#define _SLIDER_H_
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface "slider.h"
|
#pragma interface "slider.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/control.h"
|
#ifdef __WIN95__
|
||||||
|
#include "wx/msw/slider95.h"
|
||||||
WXDLLEXPORT_DATA(extern const char*) wxSliderNameStr;
|
#define wxSlider wxSlider95
|
||||||
|
#define classwxSlider classwxSlider95
|
||||||
// Slider
|
#else
|
||||||
class WXDLLEXPORT wxSlider: public wxControl
|
#include "wx/msw/slidrmsw.h"
|
||||||
{
|
#define wxSlider wxSliderMSW
|
||||||
DECLARE_DYNAMIC_CLASS(wxSlider)
|
#define classwxSlider classwxSliderMSW
|
||||||
|
|
||||||
public:
|
|
||||||
wxSlider(void);
|
|
||||||
|
|
||||||
inline wxSlider(wxWindow *parent, const wxWindowID id,
|
|
||||||
const int value, const int minValue, const int maxValue,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
const long style = wxSL_HORIZONTAL,
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxSliderNameStr)
|
|
||||||
{
|
|
||||||
Create(parent, id, value, minValue, maxValue, pos, size, style, validator, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
~wxSlider(void);
|
|
||||||
|
|
||||||
bool Create(wxWindow *parent, const wxWindowID id,
|
|
||||||
const int value, const int minValue, const int maxValue,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
const long style = wxSL_HORIZONTAL,
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxSliderNameStr);
|
|
||||||
|
|
||||||
virtual int GetValue(void) const ;
|
|
||||||
virtual void SetValue(const int);
|
|
||||||
void GetSize(int *x, int *y) const ;
|
|
||||||
void SetSize(const int x, const int y, const int width, const int height, const int sizeFlags = wxSIZE_AUTO);
|
|
||||||
void GetPosition(int *x, int *y) const ;
|
|
||||||
bool Show(const bool show);
|
|
||||||
|
|
||||||
void SetRange(const int minValue, const int maxValue);
|
|
||||||
|
|
||||||
inline int GetMin(void) const { return m_rangeMin; }
|
|
||||||
inline int GetMax(void) const { return m_rangeMax; }
|
|
||||||
|
|
||||||
// For trackbars only
|
|
||||||
void SetTickFreq(const int n, const int pos);
|
|
||||||
inline int GetTickFreq(void) const { return m_tickFreq; }
|
|
||||||
void SetPageSize(const int pageSize);
|
|
||||||
int GetPageSize(void) const ;
|
|
||||||
void ClearSel(void) ;
|
|
||||||
void ClearTicks(void) ;
|
|
||||||
void SetLineSize(const int lineSize);
|
|
||||||
int GetLineSize(void) const ;
|
|
||||||
int GetSelEnd(void) const ;
|
|
||||||
int GetSelStart(void) const ;
|
|
||||||
void SetSelection(const int minPos, const int maxPos);
|
|
||||||
void SetThumbLength(const int len) ;
|
|
||||||
int GetThumbLength(void) const ;
|
|
||||||
void SetTick(const int tickPos) ;
|
|
||||||
|
|
||||||
// IMPLEMENTATION
|
|
||||||
inline WXHWND GetStaticMin() const { return m_staticMin; }
|
|
||||||
inline WXHWND GetStaticMax() const { return m_staticMax; }
|
|
||||||
inline WXHWND GetEditValue() const { return m_staticValue; }
|
|
||||||
virtual bool ContainsHWND(WXHWND hWnd) const;
|
|
||||||
|
|
||||||
// Backward compatibility: translate to familiar wxEVT_COMMAND_SLIDER_UPDATED
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
void OnScroll(wxScrollEvent& event);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void Command(wxCommandEvent& event);
|
|
||||||
virtual WXHBRUSH OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT nCtlColor,
|
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam);
|
|
||||||
void MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control);
|
|
||||||
void MSWOnHScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
WXHWND m_staticMin;
|
|
||||||
WXHWND m_staticMax;
|
|
||||||
WXHWND m_staticValue;
|
|
||||||
int m_rangeMin;
|
|
||||||
int m_rangeMax;
|
|
||||||
int m_pageSize;
|
|
||||||
int m_lineSize;
|
|
||||||
int m_tickFreq;
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// __SLIDERH__
|
// _SLIDER_H_
|
||||||
|
@@ -51,6 +51,9 @@ class WXDLLEXPORT wxTabCtrl: public wxControl
|
|||||||
// Get the selection
|
// Get the selection
|
||||||
int GetSelection() const;
|
int GetSelection() const;
|
||||||
|
|
||||||
|
// Get the tab with the current keyboard focus
|
||||||
|
int GetCurFocus() const;
|
||||||
|
|
||||||
// Get the associated image list
|
// Get the associated image list
|
||||||
wxImageList* GetImageList() const;
|
wxImageList* GetImageList() const;
|
||||||
|
|
||||||
|
@@ -1,11 +1,18 @@
|
|||||||
#ifndef __TOOLBARH_BASE__
|
#ifndef _TOOLBAR_H_BASE_
|
||||||
#define __TOOLBARH_BASE__
|
#define _TOOLBAR_H_BASE_
|
||||||
|
|
||||||
#if defined(__WINDOWS__)
|
#if defined(__WINDOWS__) && defined(__WIN95__)
|
||||||
#include "wx/tbar95.h"
|
# include "wx/tbar95.h"
|
||||||
|
# define wxToolBar wxToolBar95
|
||||||
|
# define classwxToolBar classwxToolBar95
|
||||||
|
#elif defined(__WINDOWS__)
|
||||||
|
# include "wx/tbarmsw.h"
|
||||||
|
# define wxToolBar wxToolBarMSW
|
||||||
|
# define classwxToolBar classwxToolBarMSW
|
||||||
#elif defined(__GTK__)
|
#elif defined(__GTK__)
|
||||||
#include "wx/gtk/tbargtk.h"
|
# include "wx/gtk/tbargtk.h"
|
||||||
|
# define classwxToolBar wxToolBarGTK
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
// __TOOLBARH_BASE__
|
// _TOOLBAR_H_BASE_
|
||||||
|
@@ -20,10 +20,12 @@
|
|||||||
#pragma hdrstop
|
#pragma hdrstop
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// #define __GOOD_COMPILER__
|
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
#define __GOOD_COMPILER__
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include "wx/utils.h"
|
#include "wx/utils.h"
|
||||||
#include "wx/dc.h"
|
#include "wx/dc.h"
|
||||||
|
186
src/msw/gauge95.cpp
Normal file
186
src/msw/gauge95.cpp
Normal file
@@ -0,0 +1,186 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: gauge95.cpp
|
||||||
|
// Purpose: wxGauge95 class
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 01/02/97
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
|
// Licence: wxWindows licence
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "gauge95.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include "wx/defs.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if USE_GAUGE && defined(__WIN95__)
|
||||||
|
|
||||||
|
#include "wx/msw/gauge95.h"
|
||||||
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
|
#if defined(__WIN95__) && !defined(__GNUWIN32__)
|
||||||
|
#include <commctrl.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if !USE_SHARED_LIBRARY
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxGauge95, wxControl)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool wxGauge95::Create(wxWindow *parent, const wxWindowID id,
|
||||||
|
const int range,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size,
|
||||||
|
const long style,
|
||||||
|
const wxValidator& validator,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
SetName(name);
|
||||||
|
SetValidator(validator);
|
||||||
|
|
||||||
|
if (parent) parent->AddChild(this);
|
||||||
|
m_rangeMax = range;
|
||||||
|
|
||||||
|
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||||
|
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||||
|
|
||||||
|
m_windowStyle = style;
|
||||||
|
|
||||||
|
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 msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
|
||||||
|
|
||||||
|
HWND wx_button =
|
||||||
|
CreateWindowEx(MakeExtendedStyle(m_windowStyle), PROGRESS_CLASS, NULL, msFlags,
|
||||||
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
|
wxGetInstance(), NULL);
|
||||||
|
|
||||||
|
m_hWnd = (WXHWND)wx_button;
|
||||||
|
|
||||||
|
// Subclass again for purposes of dialog editing mode
|
||||||
|
SubclassWin((WXHWND) wx_button);
|
||||||
|
|
||||||
|
SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, range));
|
||||||
|
|
||||||
|
SetFont(* parent->GetFont());
|
||||||
|
|
||||||
|
if (width == -1)
|
||||||
|
width = 50;
|
||||||
|
if (height == -1)
|
||||||
|
height = 50;
|
||||||
|
SetSize(x, y, width, height);
|
||||||
|
|
||||||
|
ShowWindow((HWND) GetHWND(), SW_SHOW);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
|
||||||
|
{
|
||||||
|
int currentX, currentY;
|
||||||
|
GetPosition(¤tX, ¤tY);
|
||||||
|
int x1 = x;
|
||||||
|
int y1 = y;
|
||||||
|
int w1 = width;
|
||||||
|
int h1 = height;
|
||||||
|
|
||||||
|
if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
|
x1 = currentX;
|
||||||
|
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
|
y1 = currentY;
|
||||||
|
|
||||||
|
// If we're prepared to use the existing size, then...
|
||||||
|
if (width == -1 && height == -1 && ((sizeFlags & wxSIZE_AUTO) != wxSIZE_AUTO))
|
||||||
|
{
|
||||||
|
GetSize(&w1, &h1);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Deal with default size (using -1 values)
|
||||||
|
if (w1<=0)
|
||||||
|
w1 = DEFAULT_ITEM_WIDTH;
|
||||||
|
|
||||||
|
if (h1<=0)
|
||||||
|
h1 = DEFAULT_ITEM_HEIGHT;
|
||||||
|
|
||||||
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY
|
||||||
|
GetEventHandler()->OldOnSize(width, height);
|
||||||
|
#else
|
||||||
|
wxSizeEvent event(wxSize(width, height), m_windowId);
|
||||||
|
event.eventObject = this;
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetShadowWidth(const int w)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetBezelFace(const int w)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetRange(const int r)
|
||||||
|
{
|
||||||
|
m_rangeMax = r;
|
||||||
|
|
||||||
|
SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetValue(const int pos)
|
||||||
|
{
|
||||||
|
m_gaugePos = pos;
|
||||||
|
|
||||||
|
SendMessage((HWND) GetHWND(), PBM_SETPOS, pos, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxGauge95::GetShadowWidth(void) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxGauge95::GetBezelFace(void) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxGauge95::GetRange(void) const
|
||||||
|
{
|
||||||
|
return m_rangeMax;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxGauge95::GetValue(void) const
|
||||||
|
{
|
||||||
|
return m_gaugePos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetForegroundColour(const wxColour& col)
|
||||||
|
{
|
||||||
|
m_foregroundColour = col ;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxGauge95::SetBackgroundColour(const wxColour& col)
|
||||||
|
{
|
||||||
|
m_backgroundColour = col ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // USE_GAUGE
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: gauge.cpp
|
// Name: gaugemsw.cpp
|
||||||
// Purpose: wxGauge class
|
// Purpose: wxGaugeMSW class
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 01/02/97
|
// Created: 01/02/97
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
|
|
||||||
#if USE_GAUGE
|
#if USE_GAUGE
|
||||||
|
|
||||||
#include "wx/gauge.h"
|
#include "wx/msw/gaugemsw.h"
|
||||||
#include "wx/msw/private.h"
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
/* gas gauge graph control messages--class "zYzGauge" */
|
/* gas gauge graph control messages--class "zYzGauge" */
|
||||||
@@ -53,24 +53,17 @@
|
|||||||
#define ZYZG_ORIENT_BOTTOMTOTOP 2
|
#define ZYZG_ORIENT_BOTTOMTOTOP 2
|
||||||
#define ZYZG_ORIENT_TOPTOBOTTOM 3
|
#define ZYZG_ORIENT_TOPTOBOTTOM 3
|
||||||
|
|
||||||
|
|
||||||
/* gauge styles */
|
/* gauge styles */
|
||||||
#define ZYZGS_3D 0x8000L /* control will be 3D */
|
#define ZYZGS_3D 0x8000L /* control will be 3D */
|
||||||
|
|
||||||
/* public function prototypes */
|
/* public function prototypes */
|
||||||
BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance);
|
BOOL FAR PASCAL gaugeInit(HINSTANCE hInstance);
|
||||||
|
|
||||||
#define USE_PROGRESS_BAR 1
|
|
||||||
|
|
||||||
#if defined(__WIN95__) && !defined(__GNUWIN32__)
|
|
||||||
#include <commctrl.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxGauge, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxGaugeMSW, wxControl)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool wxGauge::Create(wxWindow *parent, const wxWindowID id,
|
bool wxGaugeMSW::Create(wxWindow *parent, const wxWindowID id,
|
||||||
const int range,
|
const int range,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
@@ -78,13 +71,13 @@ bool wxGauge::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
static bool wxGaugeInitialised = FALSE;
|
static bool wxGaugeMSWInitialised = FALSE;
|
||||||
|
|
||||||
if ( !wxGaugeInitialised )
|
if ( !wxGaugeMSWInitialised )
|
||||||
{
|
{
|
||||||
if (!gaugeInit((HWND) wxGetInstance()))
|
if (!gaugeInit((HWND) wxGetInstance()))
|
||||||
wxFatalError("Cannot initalize Gauge library");
|
wxFatalError("Cannot initalize Gauge library");
|
||||||
wxGaugeInitialised = TRUE;
|
wxGaugeMSWInitialised = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetName(name);
|
SetName(name);
|
||||||
@@ -96,7 +89,6 @@ bool wxGauge::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
SetBackgroundColour(parent->GetDefaultBackgroundColour()) ;
|
||||||
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
SetForegroundColour(parent->GetDefaultForegroundColour()) ;
|
||||||
|
|
||||||
m_useProgressBar = FALSE;
|
|
||||||
m_windowStyle = style;
|
m_windowStyle = style;
|
||||||
|
|
||||||
if ( id == -1 )
|
if ( id == -1 )
|
||||||
@@ -109,60 +101,31 @@ bool wxGauge::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
|
|
||||||
// Use the Win95 progress bar if possible, but not if
|
long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
|
||||||
// we request a vertical gauge.
|
msFlags |= ZYZGS_3D;
|
||||||
#if defined(__WIN95__) && USE_PROGRESS_BAR
|
|
||||||
if ((m_windowStyle & wxGA_PROGRESSBAR) && ((m_windowStyle & wxGA_HORIZONTAL) == wxGA_HORIZONTAL))
|
|
||||||
m_useProgressBar = TRUE;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (m_useProgressBar)
|
HWND wx_button =
|
||||||
{
|
|
||||||
#if defined(__WIN95__) && USE_PROGRESS_BAR
|
|
||||||
long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
|
|
||||||
|
|
||||||
HWND wx_button =
|
|
||||||
CreateWindowEx(MakeExtendedStyle(m_windowStyle), PROGRESS_CLASS, NULL, msFlags,
|
|
||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
|
||||||
wxGetInstance(), NULL);
|
|
||||||
|
|
||||||
m_hWnd = (WXHWND)wx_button;
|
|
||||||
|
|
||||||
// Subclass again for purposes of dialog editing mode
|
|
||||||
SubclassWin((WXHWND) wx_button);
|
|
||||||
|
|
||||||
SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, range));
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
long msFlags = WS_CHILD | WS_VISIBLE | WS_TABSTOP;
|
|
||||||
/* if (m_windowStyle & wxTHREED) */
|
|
||||||
msFlags |= ZYZGS_3D;
|
|
||||||
|
|
||||||
HWND wx_button =
|
|
||||||
CreateWindowEx(MakeExtendedStyle(m_windowStyle), "zYzGauge", NULL, msFlags,
|
CreateWindowEx(MakeExtendedStyle(m_windowStyle), "zYzGauge", NULL, msFlags,
|
||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
wxGetInstance(), NULL);
|
wxGetInstance(), NULL);
|
||||||
|
|
||||||
m_hWnd = (WXHWND)wx_button;
|
m_hWnd = (WXHWND)wx_button;
|
||||||
|
|
||||||
// Subclass again for purposes of dialog editing mode
|
// Subclass again for purposes of dialog editing mode
|
||||||
SubclassWin((WXHWND)wx_button);
|
SubclassWin((WXHWND)wx_button);
|
||||||
|
|
||||||
int wOrient = 0;
|
int wOrient = 0;
|
||||||
|
|
||||||
if (m_windowStyle & wxGA_HORIZONTAL)
|
if (m_windowStyle & wxGA_HORIZONTAL)
|
||||||
wOrient = ZYZG_ORIENT_LEFTTORIGHT;
|
wOrient = ZYZG_ORIENT_LEFTTORIGHT;
|
||||||
else
|
else
|
||||||
wOrient = ZYZG_ORIENT_BOTTOMTOTOP;
|
wOrient = ZYZG_ORIENT_BOTTOMTOTOP;
|
||||||
|
|
||||||
SendMessage(wx_button, ZYZG_SETORIENTATION, wOrient, 0);
|
SendMessage(wx_button, ZYZG_SETORIENTATION, wOrient, 0);
|
||||||
SendMessage(wx_button, ZYZG_SETRANGE, range, 0);
|
SendMessage(wx_button, ZYZG_SETRANGE, range, 0);
|
||||||
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
SendMessage((HWND) GetHWND(), ZYZG_SETFGCOLOR, 0, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
SendMessage((HWND) GetHWND(), ZYZG_SETBKCOLOR, 0, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
||||||
}
|
|
||||||
|
|
||||||
SetFont(* parent->GetFont());
|
SetFont(* parent->GetFont());
|
||||||
|
|
||||||
@@ -177,7 +140,7 @@ bool wxGauge::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
|
void wxGaugeMSW::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
|
||||||
{
|
{
|
||||||
int currentX, currentY;
|
int currentX, currentY;
|
||||||
GetPosition(¤tX, ¤tY);
|
GetPosition(¤tX, ¤tY);
|
||||||
@@ -215,98 +178,60 @@ void wxGauge::SetSize(const int x, const int y, const int width, const int heigh
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetShadowWidth(const int w)
|
void wxGaugeMSW::SetShadowWidth(const int w)
|
||||||
{
|
{
|
||||||
if (m_useProgressBar)
|
SendMessage((HWND) GetHWND(), ZYZG_SETWIDTH3D, w, 0);
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETWIDTH3D, w, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetBezelFace(const int w)
|
void wxGaugeMSW::SetBezelFace(const int w)
|
||||||
{
|
{
|
||||||
if (m_useProgressBar)
|
SendMessage((HWND) GetHWND(), ZYZG_SETBEZELFACE, w, 0);
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETBEZELFACE, w, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetRange(const int r)
|
void wxGaugeMSW::SetRange(const int r)
|
||||||
{
|
{
|
||||||
m_rangeMax = r;
|
m_rangeMax = r;
|
||||||
|
|
||||||
#if defined(__WIN95__) && USE_PROGRESS_BAR
|
SendMessage((HWND) GetHWND(), ZYZG_SETRANGE, r, 0);
|
||||||
if (m_useProgressBar)
|
|
||||||
SendMessage((HWND) GetHWND(), PBM_SETRANGE, 0, MAKELPARAM(0, r));
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETRANGE, r, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetValue(const int pos)
|
void wxGaugeMSW::SetValue(const int pos)
|
||||||
{
|
{
|
||||||
m_gaugePos = pos;
|
m_gaugePos = pos;
|
||||||
|
|
||||||
#if defined(__WIN95__) && USE_PROGRESS_BAR
|
SendMessage((HWND) GetHWND(), ZYZG_SETPOSITION, pos, 0);
|
||||||
if (m_useProgressBar)
|
|
||||||
SendMessage((HWND) GetHWND(), PBM_SETPOS, pos, 0);
|
|
||||||
else
|
|
||||||
#endif
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETPOSITION, pos, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGauge::GetShadowWidth(void) const
|
int wxGaugeMSW::GetShadowWidth(void) const
|
||||||
{
|
{
|
||||||
if (m_useProgressBar)
|
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETWIDTH3D, 0, 0);
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETWIDTH3D, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGauge::GetBezelFace(void) const
|
int wxGaugeMSW::GetBezelFace(void) const
|
||||||
{
|
{
|
||||||
if (m_useProgressBar)
|
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETBEZELFACE, 0, 0);
|
||||||
return 0;
|
|
||||||
else
|
|
||||||
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETBEZELFACE, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGauge::GetRange(void) const
|
int wxGaugeMSW::GetRange(void) const
|
||||||
{
|
{
|
||||||
if (m_useProgressBar)
|
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETRANGE, 0, 0);
|
||||||
return m_rangeMax;
|
|
||||||
else
|
|
||||||
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETRANGE, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxGauge::GetValue(void) const
|
int wxGaugeMSW::GetValue(void) const
|
||||||
{
|
{
|
||||||
if (m_useProgressBar)
|
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETPOSITION, 0, 0);
|
||||||
return m_gaugePos;
|
|
||||||
else
|
|
||||||
return (int) SendMessage((HWND) GetHWND(), ZYZG_GETPOSITION, 0, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetForegroundColour(const wxColour& col)
|
void wxGaugeMSW::SetForegroundColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
m_foregroundColour = col ;
|
m_foregroundColour = col ;
|
||||||
if (m_useProgressBar)
|
SendMessage((HWND) GetHWND(), ZYZG_SETFGCOLOR, 0, RGB(col.Red(), col.Green(), col.Blue()));
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETFGCOLOR, 0, RGB(col.Red(), col.Green(), col.Blue()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxGauge::SetBackgroundColour(const wxColour& col)
|
void wxGaugeMSW::SetBackgroundColour(const wxColour& col)
|
||||||
{
|
{
|
||||||
m_backgroundColour = col ;
|
m_backgroundColour = col ;
|
||||||
if (m_useProgressBar)
|
SendMessage((HWND) GetHWND(), ZYZG_SETBKCOLOR, 0, RGB(col.Red(), col.Green(), col.Blue()));
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
SendMessage((HWND) GetHWND(), ZYZG_SETBKCOLOR, 0, RGB(col.Red(), col.Green(), col.Blue()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@@ -902,8 +902,6 @@ long wxListCtrl::HitTest(const wxPoint& point, int& flags)
|
|||||||
|
|
||||||
// Inserts an item, returning the index of the new item if successful,
|
// Inserts an item, returning the index of the new item if successful,
|
||||||
// -1 otherwise.
|
// -1 otherwise.
|
||||||
// TOD: Should also have some further convenience functions
|
|
||||||
// which don't require setting a wxListItem object
|
|
||||||
long wxListCtrl::InsertItem(wxListItem& info)
|
long wxListCtrl::InsertItem(wxListItem& info)
|
||||||
{
|
{
|
||||||
LV_ITEM item;
|
LV_ITEM item;
|
||||||
|
@@ -139,6 +139,8 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\fontdlg.obj \
|
$(MSWDIR)\fontdlg.obj \
|
||||||
$(MSWDIR)\frame.obj \
|
$(MSWDIR)\frame.obj \
|
||||||
$(MSWDIR)\gauge.obj \
|
$(MSWDIR)\gauge.obj \
|
||||||
|
$(MSWDIR)\gauge95.obj \
|
||||||
|
$(MSWDIR)\gaugemsw.obj \
|
||||||
$(MSWDIR)\gdiobj.obj \
|
$(MSWDIR)\gdiobj.obj \
|
||||||
$(MSWDIR)\helpwin.obj \
|
$(MSWDIR)\helpwin.obj \
|
||||||
$(MSWDIR)\icon.obj \
|
$(MSWDIR)\icon.obj \
|
||||||
@@ -166,7 +168,8 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\registry.obj \
|
$(MSWDIR)\registry.obj \
|
||||||
$(MSWDIR)\scrolbar.obj \
|
$(MSWDIR)\scrolbar.obj \
|
||||||
$(MSWDIR)\settings.obj \
|
$(MSWDIR)\settings.obj \
|
||||||
$(MSWDIR)\slider.obj \
|
$(MSWDIR)\slidrmsw.obj \
|
||||||
|
$(MSWDIR)\slider95.obj \
|
||||||
$(MSWDIR)\spinbutt.obj \
|
$(MSWDIR)\spinbutt.obj \
|
||||||
$(MSWDIR)\statbmp.obj \
|
$(MSWDIR)\statbmp.obj \
|
||||||
$(MSWDIR)\statbox.obj \
|
$(MSWDIR)\statbox.obj \
|
||||||
@@ -278,7 +281,9 @@ $(MSWDIR)\fontdlg.obj: $(MSWDIR)\fontdlg.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\frame.obj: $(MSWDIR)\frame.$(SRCSUFF)
|
$(MSWDIR)\frame.obj: $(MSWDIR)\frame.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\gauge.obj: $(MSWDIR)\gauge.$(SRCSUFF)
|
$(MSWDIR)\gaugemsw.obj: $(MSWDIR)\gaugemsw.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\gauge95.obj: $(MSWDIR)\gauge95.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\gdiobj.obj: $(MSWDIR)\gdiobj.$(SRCSUFF)
|
$(MSWDIR)\gdiobj.obj: $(MSWDIR)\gdiobj.$(SRCSUFF)
|
||||||
|
|
||||||
@@ -332,7 +337,9 @@ $(MSWDIR)\scrolbar.obj: $(MSWDIR)\scrolbar.$(SRCSUFF)
|
|||||||
|
|
||||||
$(MSWDIR)\settings.obj: $(MSWDIR)\settings.$(SRCSUFF)
|
$(MSWDIR)\settings.obj: $(MSWDIR)\settings.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\slider.obj: $(MSWDIR)\slider.$(SRCSUFF)
|
$(MSWDIR)\slidrmsw.obj: $(MSWDIR)\slidrmsw.$(SRCSUFF)
|
||||||
|
|
||||||
|
$(MSWDIR)\slider95.obj: $(MSWDIR)\slider95.$(SRCSUFF)
|
||||||
|
|
||||||
$(MSWDIR)\spinbutt.obj: $(MSWDIR)\spinbutt.$(SRCSUFF)
|
$(MSWDIR)\spinbutt.obj: $(MSWDIR)\spinbutt.$(SRCSUFF)
|
||||||
|
|
||||||
|
@@ -139,7 +139,7 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\font.obj \
|
$(MSWDIR)\font.obj \
|
||||||
$(MSWDIR)\fontdlg.obj \
|
$(MSWDIR)\fontdlg.obj \
|
||||||
$(MSWDIR)\frame.obj \
|
$(MSWDIR)\frame.obj \
|
||||||
$(MSWDIR)\gauge.obj \
|
$(MSWDIR)\gaugemsw.obj \
|
||||||
$(MSWDIR)\gdiobj.obj \
|
$(MSWDIR)\gdiobj.obj \
|
||||||
$(MSWDIR)\helpwin.obj \
|
$(MSWDIR)\helpwin.obj \
|
||||||
$(MSWDIR)\icon.obj \
|
$(MSWDIR)\icon.obj \
|
||||||
@@ -166,12 +166,11 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\region.obj \
|
$(MSWDIR)\region.obj \
|
||||||
$(MSWDIR)\scrolbar.obj \
|
$(MSWDIR)\scrolbar.obj \
|
||||||
$(MSWDIR)\settings.obj \
|
$(MSWDIR)\settings.obj \
|
||||||
$(MSWDIR)\slider.obj \
|
$(MSWDIR)\slidrmsw.obj \
|
||||||
$(MSWDIR)\spinbutt.obj \
|
$(MSWDIR)\spinbutt.obj \
|
||||||
$(MSWDIR)\statbmp.obj \
|
$(MSWDIR)\statbmp.obj \
|
||||||
$(MSWDIR)\statbox.obj \
|
$(MSWDIR)\statbox.obj \
|
||||||
$(MSWDIR)\stattext.obj \
|
$(MSWDIR)\stattext.obj \
|
||||||
$(MSWDIR)\tbar95.obj \
|
|
||||||
$(MSWDIR)\tbarmsw.obj \
|
$(MSWDIR)\tbarmsw.obj \
|
||||||
$(MSWDIR)\textctrl.obj \
|
$(MSWDIR)\textctrl.obj \
|
||||||
$(MSWDIR)\timer.obj \
|
$(MSWDIR)\timer.obj \
|
||||||
@@ -394,7 +393,7 @@ $(MSWDIR)/frame.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/gauge.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/gaugemsw.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
@@ -534,7 +533,7 @@ $(MSWDIR)/settings.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/slider.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/slidrmsw.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
@@ -559,11 +558,6 @@ $(MSWDIR)/stattext.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
<<
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/tbar95.obj: $*.$(SRCSUFF)
|
|
||||||
cl @<<
|
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
|
||||||
<<
|
|
||||||
|
|
||||||
$(MSWDIR)/tbarmsw.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/tbarmsw.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
$(CPPFLAGS) /Fo$@ /c /Tp $*.$(SRCSUFF)
|
||||||
|
@@ -144,7 +144,8 @@ MSWOBJS = \
|
|||||||
font.$(OBJSUFF) \
|
font.$(OBJSUFF) \
|
||||||
fontdlg.$(OBJSUFF) \
|
fontdlg.$(OBJSUFF) \
|
||||||
frame.$(OBJSUFF) \
|
frame.$(OBJSUFF) \
|
||||||
gauge.$(OBJSUFF) \
|
gaugemsw.$(OBJSUFF) \
|
||||||
|
gauge95.$(OBJSUFF) \
|
||||||
gdiobj.$(OBJSUFF) \
|
gdiobj.$(OBJSUFF) \
|
||||||
helpwin.$(OBJSUFF) \
|
helpwin.$(OBJSUFF) \
|
||||||
icon.$(OBJSUFF) \
|
icon.$(OBJSUFF) \
|
||||||
@@ -172,7 +173,8 @@ MSWOBJS = \
|
|||||||
registry.$(OBJSUFF) \
|
registry.$(OBJSUFF) \
|
||||||
scrolbar.$(OBJSUFF) \
|
scrolbar.$(OBJSUFF) \
|
||||||
settings.$(OBJSUFF) \
|
settings.$(OBJSUFF) \
|
||||||
slider.$(OBJSUFF) \
|
slidrmsw.$(OBJSUFF) \
|
||||||
|
slider95.$(OBJSUFF) \
|
||||||
spinbutt.$(OBJSUFF) \
|
spinbutt.$(OBJSUFF) \
|
||||||
statbmp.$(OBJSUFF) \
|
statbmp.$(OBJSUFF) \
|
||||||
statbox.$(OBJSUFF) \
|
statbox.$(OBJSUFF) \
|
||||||
|
@@ -143,7 +143,8 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\font.obj \
|
$(MSWDIR)\font.obj \
|
||||||
$(MSWDIR)\fontdlg.obj \
|
$(MSWDIR)\fontdlg.obj \
|
||||||
$(MSWDIR)\frame.obj \
|
$(MSWDIR)\frame.obj \
|
||||||
$(MSWDIR)\gauge.obj \
|
$(MSWDIR)\gauge95.obj \
|
||||||
|
$(MSWDIR)\gaugemsw.obj \
|
||||||
$(MSWDIR)\gdiobj.obj \
|
$(MSWDIR)\gdiobj.obj \
|
||||||
$(MSWDIR)\helpwin.obj \
|
$(MSWDIR)\helpwin.obj \
|
||||||
$(MSWDIR)\icon.obj \
|
$(MSWDIR)\icon.obj \
|
||||||
@@ -172,7 +173,8 @@ MSWOBJS = \
|
|||||||
$(MSWDIR)\registry.obj \
|
$(MSWDIR)\registry.obj \
|
||||||
$(MSWDIR)\scrolbar.obj \
|
$(MSWDIR)\scrolbar.obj \
|
||||||
$(MSWDIR)\settings.obj \
|
$(MSWDIR)\settings.obj \
|
||||||
$(MSWDIR)\slider.obj \
|
$(MSWDIR)\slidrmsw.obj \
|
||||||
|
$(MSWDIR)\slider95.obj \
|
||||||
$(MSWDIR)\spinbutt.obj \
|
$(MSWDIR)\spinbutt.obj \
|
||||||
$(MSWDIR)\statbmp.obj \
|
$(MSWDIR)\statbmp.obj \
|
||||||
$(MSWDIR)\statbox.obj \
|
$(MSWDIR)\statbox.obj \
|
||||||
@@ -414,7 +416,12 @@ $(MSWDIR)/frame.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/gauge.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/gauge95.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(MSWDIR)/gaugemsw.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
@@ -559,7 +566,12 @@ $(MSWDIR)/settings.obj: $*.$(SRCSUFF)
|
|||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
|
|
||||||
$(MSWDIR)/slider.obj: $*.$(SRCSUFF)
|
$(MSWDIR)/slidrmsw.obj: $*.$(SRCSUFF)
|
||||||
|
cl @<<
|
||||||
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
|
<<
|
||||||
|
|
||||||
|
$(MSWDIR)/slider95.obj: $*.$(SRCSUFF)
|
||||||
cl @<<
|
cl @<<
|
||||||
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
$(CPPFLAGS) /c /Tp $*.$(SRCSUFF) /Fo$@
|
||||||
<<
|
<<
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// Name: slider.cpp
|
// Name: slider95.cpp
|
||||||
// Purpose: wxSlider
|
// Purpose: wxSlider95, using the Win95 trackbar control
|
||||||
// Author: Julian Smart
|
// Author: Julian Smart
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 04/01/98
|
// Created: 04/01/98
|
||||||
@@ -10,7 +10,7 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma implementation "slider.h"
|
#pragma implementation "slider95.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For compilers that support precompilation, includes "wx.h".
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
@@ -22,31 +22,30 @@
|
|||||||
|
|
||||||
#ifndef WX_PRECOMP
|
#ifndef WX_PRECOMP
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "wx/slider.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "wx/msw/private.h"
|
#ifdef __WIN95__
|
||||||
|
|
||||||
// Can opt to not use track bar under Win95 if you prefer it - set to 0
|
#include "wx/msw/slider95.h"
|
||||||
#define USE_TRACK_BAR 1
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
#if defined(__WIN95__) && !defined(__GNUWIN32__)
|
#if defined(__WIN95__) && !defined(__GNUWIN32__)
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !USE_SHARED_LIBRARY
|
#if !USE_SHARED_LIBRARY
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxSlider, wxControl)
|
IMPLEMENT_DYNAMIC_CLASS(wxSlider95, wxControl)
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
BEGIN_EVENT_TABLE(wxSlider, wxControl)
|
BEGIN_EVENT_TABLE(wxSlider95, wxControl)
|
||||||
EVT_SCROLL(wxSlider::OnScroll)
|
EVT_SCROLL(wxSlider95::OnScroll)
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Slider
|
// Slider
|
||||||
wxSlider::wxSlider(void)
|
wxSlider95::wxSlider95(void)
|
||||||
{
|
{
|
||||||
m_staticValue = 0;
|
m_staticValue = 0;
|
||||||
m_staticMin = 0;
|
m_staticMin = 0;
|
||||||
@@ -58,7 +57,7 @@ wxSlider::wxSlider(void)
|
|||||||
m_tickFreq = 0;
|
m_tickFreq = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
|
bool wxSlider95::Create(wxWindow *parent, const wxWindowID id,
|
||||||
const int value, const int minValue, const int maxValue,
|
const int value, const int minValue, const int maxValue,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size, const long style,
|
const wxSize& size, const long style,
|
||||||
@@ -90,7 +89,6 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
int width = size.x;
|
int width = size.x;
|
||||||
int height = size.y;
|
int height = size.y;
|
||||||
|
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
long msStyle ;
|
long msStyle ;
|
||||||
|
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
@@ -156,8 +154,6 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
|
|
||||||
SubclassWin(GetHWND());
|
SubclassWin(GetHWND());
|
||||||
|
|
||||||
SetFont(parent->GetFont());
|
|
||||||
|
|
||||||
if ( m_windowStyle & wxSL_LABELS )
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
{
|
{
|
||||||
// Finally, create max value static item
|
// Finally, create max value static item
|
||||||
@@ -167,6 +163,8 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)NewControlId(),
|
||||||
wxGetInstance(), NULL);
|
wxGetInstance(), NULL);
|
||||||
|
|
||||||
|
SetFont(parent->GetFont());
|
||||||
|
|
||||||
if (GetFont())
|
if (GetFont())
|
||||||
{
|
{
|
||||||
// GetFont()->RealizeResource();
|
// GetFont()->RealizeResource();
|
||||||
@@ -184,79 +182,6 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
// non-Win95 implementation
|
|
||||||
|
|
||||||
long 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);
|
|
||||||
|
|
||||||
// Now create slider
|
|
||||||
m_windowId = (int)NewControlId();
|
|
||||||
|
|
||||||
msStyle = 0;
|
|
||||||
if (m_windowStyle & wxSL_VERTICAL)
|
|
||||||
msStyle = SBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
|
||||||
else
|
|
||||||
msStyle = SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
|
||||||
|
|
||||||
HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), "SCROLLBAR", wxBuffer,
|
|
||||||
msStyle,
|
|
||||||
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
|
||||||
wxGetInstance(), NULL);
|
|
||||||
|
|
||||||
m_pageSize = (int)((maxValue-minValue)/10);
|
|
||||||
m_rangeMax = maxValue;
|
|
||||||
m_rangeMin = minValue;
|
|
||||||
|
|
||||||
::SetScrollRange(scroll_bar, SB_CTL, minValue, maxValue, FALSE);
|
|
||||||
::SetScrollPos(scroll_bar, SB_CTL, value, FALSE);
|
|
||||||
ShowWindow(scroll_bar, SW_SHOW);
|
|
||||||
|
|
||||||
m_hWnd = (WXHWND)scroll_bar;
|
|
||||||
|
|
||||||
// Subclass again for purposes of dialog editing mode
|
|
||||||
SubclassWin(GetHWND());
|
|
||||||
|
|
||||||
// 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())
|
|
||||||
{
|
|
||||||
if ( m_staticMin )
|
|
||||||
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
|
||||||
(WPARAM)GetFont()->GetResourceHandle(),0L);
|
|
||||||
if ( m_staticMax )
|
|
||||||
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
|
||||||
(WPARAM)GetFont()->GetResourceHandle(),0L);
|
|
||||||
if (m_staticValue)
|
|
||||||
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
|
||||||
(WPARAM)GetFont()->GetResourceHandle(),0L);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SetSize(x, y, width, height);
|
SetSize(x, y, width, height);
|
||||||
SetValue(value);
|
SetValue(value);
|
||||||
@@ -264,13 +189,9 @@ bool wxSlider::Create(wxWindow *parent, const wxWindowID id,
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control)
|
void wxSlider95::MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
int position = 0; // Dummy - not used in this mode
|
int position = 0; // Dummy - not used in this mode
|
||||||
#else
|
|
||||||
int position = ::GetScrollPos((HWND)control, SB_CTL);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
int nScrollInc;
|
int nScrollInc;
|
||||||
wxEventType scrollEvent = wxEVT_NULL;
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
@@ -321,16 +242,9 @@ void wxSlider::MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WIN95 && USE_TRACK_BAR)
|
|
||||||
if (nScrollInc != 0)
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
|
int newPos = (int)::SendMessage((HWND) control, TBM_GETPOS, 0, 0);
|
||||||
#else
|
|
||||||
int newPos = position + nScrollInc;
|
|
||||||
#endif
|
|
||||||
if (!(newPos < GetMin() || newPos > GetMax()))
|
if (!(newPos < GetMin() || newPos > GetMax()))
|
||||||
{
|
{
|
||||||
SetValue(newPos);
|
SetValue(newPos);
|
||||||
@@ -343,12 +257,12 @@ void wxSlider::MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::MSWOnHScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control)
|
void wxSlider95::MSWOnHScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control)
|
||||||
{
|
{
|
||||||
MSWOnVScroll(wParam, pos, control);
|
MSWOnVScroll(wParam, pos, control);
|
||||||
}
|
}
|
||||||
|
|
||||||
wxSlider::~wxSlider(void)
|
wxSlider95::~wxSlider95(void)
|
||||||
{
|
{
|
||||||
if (m_staticMin)
|
if (m_staticMin)
|
||||||
DestroyWindow((HWND) m_staticMin);
|
DestroyWindow((HWND) m_staticMin);
|
||||||
@@ -358,22 +272,14 @@ wxSlider::~wxSlider(void)
|
|||||||
DestroyWindow((HWND) m_staticValue);
|
DestroyWindow((HWND) m_staticValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetValue(void) const
|
int wxSlider95::GetValue(void) const
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
return ::SendMessage((HWND) GetHWND(), TBM_GETPOS, 0, 0);
|
return ::SendMessage((HWND) GetHWND(), TBM_GETPOS, 0, 0);
|
||||||
#else
|
|
||||||
return ::GetScrollPos((HWND) GetHWND(), SB_CTL);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetValue(const int value)
|
void wxSlider95::SetValue(const int value)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage((HWND) GetHWND(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)value);
|
::SendMessage((HWND) GetHWND(), TBM_SETPOS, (WPARAM)TRUE, (LPARAM)value);
|
||||||
#else
|
|
||||||
::SetScrollPos((HWND) GetHWND(), SB_CTL, value, TRUE);
|
|
||||||
#endif
|
|
||||||
if (m_staticValue)
|
if (m_staticValue)
|
||||||
{
|
{
|
||||||
sprintf(wxBuffer, "%d", value);
|
sprintf(wxBuffer, "%d", value);
|
||||||
@@ -381,7 +287,7 @@ void wxSlider::SetValue(const int value)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::GetSize(int *width, int *height) const
|
void wxSlider95::GetSize(int *width, int *height) const
|
||||||
{
|
{
|
||||||
RECT rect;
|
RECT rect;
|
||||||
rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
|
rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
|
||||||
@@ -399,7 +305,7 @@ void wxSlider::GetSize(int *width, int *height) const
|
|||||||
*height = rect.bottom - rect.top;
|
*height = rect.bottom - rect.top;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::GetPosition(int *x, int *y) const
|
void wxSlider95::GetPosition(int *x, int *y) const
|
||||||
{
|
{
|
||||||
wxWindow *parent = GetParent();
|
wxWindow *parent = GetParent();
|
||||||
RECT rect;
|
RECT rect;
|
||||||
@@ -426,7 +332,7 @@ void wxSlider::GetPosition(int *x, int *y) const
|
|||||||
*y = point.y;
|
*y = point.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
|
void wxSlider95::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
|
||||||
{
|
{
|
||||||
int x1 = x;
|
int x1 = x;
|
||||||
int y1 = y;
|
int y1 = y;
|
||||||
@@ -473,11 +379,9 @@ void wxSlider::SetSize(const int x, const int y, const int width, const int heig
|
|||||||
// a lot of space before the first character
|
// a lot of space before the first character
|
||||||
new_width += 3*cx;
|
new_width += 3*cx;
|
||||||
#endif
|
#endif
|
||||||
#if defined(__WIN95__)
|
|
||||||
// The height needs to be a bit bigger under Win95 if using native
|
// The height needs to be a bit bigger under Win95 if using native
|
||||||
// 3D effects.
|
// 3D effects.
|
||||||
valueHeight = (int) (valueHeight * 1.5) ;
|
valueHeight = (int) (valueHeight * 1.5) ;
|
||||||
#endif
|
|
||||||
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||||
x_offset += new_width + cx;
|
x_offset += new_width + cx;
|
||||||
}
|
}
|
||||||
@@ -487,13 +391,9 @@ void wxSlider::SetSize(const int x, const int y, const int width, const int heig
|
|||||||
|
|
||||||
int slider_length = (int)(w1 - x_offset - max_len - cx);
|
int slider_length = (int)(w1 - x_offset - max_len - cx);
|
||||||
|
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
int slider_height = h1;
|
int slider_height = h1;
|
||||||
if (slider_height < 0 )
|
if (slider_height < 0 )
|
||||||
slider_height = 20;
|
slider_height = 20;
|
||||||
#else
|
|
||||||
int slider_height = cy;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Slider must have a minimum/default length/height
|
// Slider must have a minimum/default length/height
|
||||||
if (slider_length < 100)
|
if (slider_length < 100)
|
||||||
@@ -539,11 +439,9 @@ void wxSlider::SetSize(const int x, const int y, const int width, const int heig
|
|||||||
... and replace with following line: */
|
... and replace with following line: */
|
||||||
new_width += cx;
|
new_width += cx;
|
||||||
|
|
||||||
#if defined(__WIN95__)
|
|
||||||
// The height needs to be a bit bigger under Win95 if using native
|
// The height needs to be a bit bigger under Win95 if using native
|
||||||
// 3D effects.
|
// 3D effects.
|
||||||
valueHeight = (int) (valueHeight * 1.5) ;
|
valueHeight = (int) (valueHeight * 1.5) ;
|
||||||
#endif
|
|
||||||
|
|
||||||
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||||
y_offset += valueHeight;
|
y_offset += valueHeight;
|
||||||
@@ -553,14 +451,10 @@ void wxSlider::SetSize(const int x, const int y, const int width, const int heig
|
|||||||
y_offset += cy;
|
y_offset += cy;
|
||||||
|
|
||||||
int slider_length = (int)(h1 - y_offset - cy - cy);
|
int slider_length = (int)(h1 - y_offset - cy - cy);
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
int slider_width = w1;
|
int slider_width = w1;
|
||||||
if (slider_width < 0 )
|
if (slider_width < 0 )
|
||||||
slider_width = 20;
|
slider_width = 20;
|
||||||
#else
|
|
||||||
// Use character height as an estimate of slider width (yes, width)
|
|
||||||
int slider_width = cy;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// Slider must have a minimum/default length
|
// Slider must have a minimum/default length
|
||||||
if (slider_length < 100)
|
if (slider_length < 100)
|
||||||
@@ -581,29 +475,15 @@ void wxSlider::SetSize(const int x, const int y, const int width, const int heig
|
|||||||
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
#if WXWIN_COMPATIBILITY
|
|
||||||
GetEventHandler()->OldOnSize(width, height);
|
|
||||||
#else
|
|
||||||
wxSizeEvent event(wxSize(width, height), m_windowId);
|
|
||||||
event.eventObject = this;
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetRange(const int minValue, const int maxValue)
|
void wxSlider95::SetRange(const int minValue, const int maxValue)
|
||||||
{
|
{
|
||||||
m_rangeMin = minValue;
|
m_rangeMin = minValue;
|
||||||
m_rangeMax = maxValue;
|
m_rangeMax = maxValue;
|
||||||
|
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage((HWND) GetHWND(), TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
|
::SendMessage((HWND) GetHWND(), TBM_SETRANGE, TRUE, MAKELONG(minValue, maxValue));
|
||||||
#else
|
|
||||||
::SetScrollRange((HWND) GetHWND(), SB_CTL, m_rangeMin, m_rangeMax, TRUE);
|
|
||||||
#endif
|
|
||||||
char buf[40];
|
char buf[40];
|
||||||
if ( m_staticMin )
|
if ( m_staticMin )
|
||||||
{
|
{
|
||||||
@@ -618,7 +498,7 @@ void wxSlider::SetRange(const int minValue, const int maxValue)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WXHBRUSH wxSlider::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT nCtlColor,
|
WXHBRUSH wxSlider95::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT nCtlColor,
|
||||||
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
{
|
{
|
||||||
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
||||||
@@ -634,122 +514,86 @@ WXHBRUSH wxSlider::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT n
|
|||||||
::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
||||||
|
|
||||||
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
||||||
|
|
||||||
// Note that this will be cleaned up in wxApp::OnIdle, if backgroundBrush
|
|
||||||
// has a zero usage count.
|
|
||||||
// backgroundBrush->RealizeResource();
|
|
||||||
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
|
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
|
||||||
}
|
}
|
||||||
|
|
||||||
// For trackbars only
|
// For trackbars only
|
||||||
void wxSlider::SetTickFreq(const int n, const int pos)
|
void wxSlider95::SetTickFreq(const int n, const int pos)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
m_tickFreq = n;
|
m_tickFreq = n;
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_SETTICFREQ, (WPARAM) n, (LPARAM) pos );
|
::SendMessage( (HWND) GetHWND(), TBM_SETTICFREQ, (WPARAM) n, (LPARAM) pos );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetPageSize(const int pageSize)
|
void wxSlider95::SetPageSize(const int pageSize)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_SETPAGESIZE, (WPARAM) 0, (LPARAM) pageSize );
|
::SendMessage( (HWND) GetHWND(), TBM_SETPAGESIZE, (WPARAM) 0, (LPARAM) pageSize );
|
||||||
#endif
|
|
||||||
m_pageSize = pageSize;
|
m_pageSize = pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetPageSize(void) const
|
int wxSlider95::GetPageSize(void) const
|
||||||
{
|
{
|
||||||
return m_pageSize;
|
return m_pageSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::ClearSel(void)
|
void wxSlider95::ClearSel(void)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_CLEARSEL, (WPARAM) TRUE, (LPARAM) 0 );
|
::SendMessage( (HWND) GetHWND(), TBM_CLEARSEL, (WPARAM) TRUE, (LPARAM) 0 );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::ClearTicks(void)
|
void wxSlider95::ClearTicks(void)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_CLEARTICS, (WPARAM) TRUE, (LPARAM) 0 );
|
::SendMessage( (HWND) GetHWND(), TBM_CLEARTICS, (WPARAM) TRUE, (LPARAM) 0 );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetLineSize(const int lineSize)
|
void wxSlider95::SetLineSize(const int lineSize)
|
||||||
{
|
{
|
||||||
m_lineSize = lineSize;
|
m_lineSize = lineSize;
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_SETLINESIZE, (WPARAM) 0, (LPARAM) lineSize );
|
::SendMessage( (HWND) GetHWND(), TBM_SETLINESIZE, (WPARAM) 0, (LPARAM) lineSize );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetLineSize(void) const
|
int wxSlider95::GetLineSize(void) const
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETLINESIZE, (WPARAM) 0, (LPARAM) 0 );
|
return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETLINESIZE, (WPARAM) 0, (LPARAM) 0 );
|
||||||
#else
|
|
||||||
return m_lineSize;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetSelEnd(void) const
|
int wxSlider95::GetSelEnd(void) const
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
return (int) ::SendMessage( (HWND) GetHWND(), TBM_SETSELEND, (WPARAM) 0, (LPARAM) 0 );
|
return (int) ::SendMessage( (HWND) GetHWND(), TBM_SETSELEND, (WPARAM) 0, (LPARAM) 0 );
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetSelStart(void) const
|
int wxSlider95::GetSelStart(void) const
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETSELSTART, (WPARAM) 0, (LPARAM) 0 );
|
return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETSELSTART, (WPARAM) 0, (LPARAM) 0 );
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetSelection(const int minPos, const int maxPos)
|
void wxSlider95::SetSelection(const int minPos, const int maxPos)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_SETSEL, (WPARAM) TRUE, (LPARAM) MAKELONG( minPos, maxPos) );
|
::SendMessage( (HWND) GetHWND(), TBM_SETSEL, (WPARAM) TRUE, (LPARAM) MAKELONG( minPos, maxPos) );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetThumbLength(const int len)
|
void wxSlider95::SetThumbLength(const int len)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_SETTHUMBLENGTH, (WPARAM) len, (LPARAM) 0 );
|
::SendMessage( (HWND) GetHWND(), TBM_SETTHUMBLENGTH, (WPARAM) len, (LPARAM) 0 );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxSlider::GetThumbLength(void) const
|
int wxSlider95::GetThumbLength(void) const
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETTHUMBLENGTH, (WPARAM) 0, (LPARAM) 0 );
|
return (int) ::SendMessage( (HWND) GetHWND(), TBM_GETTHUMBLENGTH, (WPARAM) 0, (LPARAM) 0 );
|
||||||
#else
|
|
||||||
return 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxSlider::SetTick(const int tickPos)
|
void wxSlider95::SetTick(const int tickPos)
|
||||||
{
|
{
|
||||||
#if defined(__WIN95__) && USE_TRACK_BAR
|
|
||||||
::SendMessage( (HWND) GetHWND(), TBM_SETTIC, (WPARAM) 0, (LPARAM) tickPos );
|
::SendMessage( (HWND) GetHWND(), TBM_SETTIC, (WPARAM) 0, (LPARAM) tickPos );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSlider::ContainsHWND(WXHWND hWnd) const
|
bool wxSlider95::ContainsHWND(WXHWND hWnd) const
|
||||||
{
|
{
|
||||||
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
||||||
}
|
}
|
||||||
|
|
||||||
#if WXWIN_COMPATIBILITY
|
#if WXWIN_COMPATIBILITY
|
||||||
// Backward compatibility
|
// Backward compatibility
|
||||||
void wxSlider::OnScroll(wxScrollEvent& event)
|
void wxSlider95::OnScroll(wxScrollEvent& event)
|
||||||
{
|
{
|
||||||
wxEventType oldEvent = event.GetEventType();
|
wxEventType oldEvent = event.GetEventType();
|
||||||
event.SetEventType( wxEVT_COMMAND_SLIDER_UPDATED );
|
event.SetEventType( wxEVT_COMMAND_SLIDER_UPDATED );
|
||||||
@@ -762,13 +606,13 @@ void wxSlider::OnScroll(wxScrollEvent& event)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void wxSlider::Command (wxCommandEvent & event)
|
void wxSlider95::Command (wxCommandEvent & event)
|
||||||
{
|
{
|
||||||
SetValue (event.GetInt());
|
SetValue (event.GetInt());
|
||||||
ProcessCommand (event);
|
ProcessCommand (event);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxSlider::Show(const bool show)
|
bool wxSlider95::Show(const bool show)
|
||||||
{
|
{
|
||||||
wxWindow::Show(show);
|
wxWindow::Show(show);
|
||||||
|
|
||||||
@@ -787,4 +631,6 @@ bool wxSlider::Show(const bool show)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
// __WIN95__
|
||||||
|
|
589
src/msw/slidrmsw.cpp
Normal file
589
src/msw/slidrmsw.cpp
Normal file
@@ -0,0 +1,589 @@
|
|||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
// Name: slidermsw.cpp
|
||||||
|
// Purpose: wxSliderMSW
|
||||||
|
// Author: Julian Smart
|
||||||
|
// Modified by:
|
||||||
|
// Created: 04/01/98
|
||||||
|
// RCS-ID: $Id$
|
||||||
|
// Copyright: (c) Julian Smart and Markus Holzem
|
||||||
|
// Licence: wxWindows license
|
||||||
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifdef __GNUG__
|
||||||
|
#pragma implementation "slidrmsw.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// For compilers that support precompilation, includes "wx.h".
|
||||||
|
#include "wx/wxprec.h"
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#pragma hdrstop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef WX_PRECOMP
|
||||||
|
#include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "wx/msw/slidrmsw.h"
|
||||||
|
#include "wx/msw/private.h"
|
||||||
|
|
||||||
|
#if !USE_SHARED_LIBRARY
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxSliderMSW, wxControl)
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY
|
||||||
|
BEGIN_EVENT_TABLE(wxSliderMSW, wxControl)
|
||||||
|
EVT_SCROLL(wxSliderMSW::OnScroll)
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Slider
|
||||||
|
wxSliderMSW::wxSliderMSW(void)
|
||||||
|
{
|
||||||
|
m_staticValue = 0;
|
||||||
|
m_staticMin = 0;
|
||||||
|
m_staticMax = 0;
|
||||||
|
m_pageSize = 1;
|
||||||
|
m_lineSize = 1;
|
||||||
|
m_rangeMax = 0;
|
||||||
|
m_rangeMin = 0;
|
||||||
|
m_tickFreq = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSliderMSW::Create(wxWindow *parent, const wxWindowID id,
|
||||||
|
const int value, const int minValue, const int maxValue,
|
||||||
|
const wxPoint& pos,
|
||||||
|
const wxSize& size, const long style,
|
||||||
|
const wxValidator& validator,
|
||||||
|
const wxString& name)
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
|
||||||
|
// non-Win95 implementation
|
||||||
|
|
||||||
|
long 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);
|
||||||
|
|
||||||
|
// Now create slider
|
||||||
|
m_windowId = (int)NewControlId();
|
||||||
|
|
||||||
|
msStyle = 0;
|
||||||
|
if (m_windowStyle & wxSL_VERTICAL)
|
||||||
|
msStyle = SBS_VERT | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
||||||
|
else
|
||||||
|
msStyle = SBS_HORZ | WS_CHILD | WS_VISIBLE | WS_TABSTOP ;
|
||||||
|
|
||||||
|
HWND scroll_bar = CreateWindowEx(MakeExtendedStyle(m_windowStyle), "SCROLLBAR", wxBuffer,
|
||||||
|
msStyle,
|
||||||
|
0, 0, 0, 0, (HWND) parent->GetHWND(), (HMENU)m_windowId,
|
||||||
|
wxGetInstance(), NULL);
|
||||||
|
|
||||||
|
m_pageSize = (int)((maxValue-minValue)/10);
|
||||||
|
m_rangeMax = maxValue;
|
||||||
|
m_rangeMin = minValue;
|
||||||
|
|
||||||
|
::SetScrollRange(scroll_bar, SB_CTL, minValue, maxValue, FALSE);
|
||||||
|
::SetScrollPos(scroll_bar, SB_CTL, value, FALSE);
|
||||||
|
ShowWindow(scroll_bar, SW_SHOW);
|
||||||
|
|
||||||
|
m_hWnd = (WXHWND)scroll_bar;
|
||||||
|
|
||||||
|
// Subclass again for purposes of dialog editing mode
|
||||||
|
SubclassWin(GetHWND());
|
||||||
|
|
||||||
|
// 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())
|
||||||
|
{
|
||||||
|
if ( m_staticMin )
|
||||||
|
SendMessage((HWND)m_staticMin,WM_SETFONT,
|
||||||
|
(WPARAM)GetFont()->GetResourceHandle(),0L);
|
||||||
|
if ( m_staticMax )
|
||||||
|
SendMessage((HWND)m_staticMax,WM_SETFONT,
|
||||||
|
(WPARAM)GetFont()->GetResourceHandle(),0L);
|
||||||
|
if (m_staticValue)
|
||||||
|
SendMessage((HWND)m_staticValue,WM_SETFONT,
|
||||||
|
(WPARAM)GetFont()->GetResourceHandle(),0L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SetSize(x, y, width, height);
|
||||||
|
SetValue(value);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::MSWOnVScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control)
|
||||||
|
{
|
||||||
|
int position = ::GetScrollPos((HWND)control, SB_CTL);
|
||||||
|
|
||||||
|
int nScrollInc;
|
||||||
|
wxEventType scrollEvent = wxEVT_NULL;
|
||||||
|
switch ( wParam )
|
||||||
|
{
|
||||||
|
case SB_TOP:
|
||||||
|
nScrollInc = m_rangeMax - position;
|
||||||
|
scrollEvent = wxEVT_SCROLL_TOP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SB_BOTTOM:
|
||||||
|
nScrollInc = - position;
|
||||||
|
scrollEvent = wxEVT_SCROLL_BOTTOM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SB_LINEUP:
|
||||||
|
nScrollInc = - GetLineSize();
|
||||||
|
scrollEvent = wxEVT_SCROLL_LINEUP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SB_LINEDOWN:
|
||||||
|
nScrollInc = GetLineSize();
|
||||||
|
scrollEvent = wxEVT_SCROLL_LINEDOWN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SB_PAGEUP:
|
||||||
|
nScrollInc = -GetPageSize();
|
||||||
|
scrollEvent = wxEVT_SCROLL_PAGEUP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SB_PAGEDOWN:
|
||||||
|
nScrollInc = GetPageSize();
|
||||||
|
scrollEvent = wxEVT_SCROLL_PAGEDOWN;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case SB_THUMBTRACK:
|
||||||
|
case SB_THUMBPOSITION:
|
||||||
|
#ifdef __WIN32__
|
||||||
|
nScrollInc = (signed short)pos - position;
|
||||||
|
#else
|
||||||
|
nScrollInc = pos - position;
|
||||||
|
#endif
|
||||||
|
scrollEvent = wxEVT_SCROLL_THUMBTRACK;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
nScrollInc = 0;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nScrollInc != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
int newPos = position + nScrollInc;
|
||||||
|
|
||||||
|
if (!(newPos < GetMin() || newPos > GetMax()))
|
||||||
|
{
|
||||||
|
SetValue(newPos);
|
||||||
|
|
||||||
|
wxScrollEvent event(scrollEvent, m_windowId);
|
||||||
|
event.SetPosition(newPos);
|
||||||
|
event.SetEventObject( this );
|
||||||
|
GetEventHandler()->ProcessEvent(event);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::MSWOnHScroll(const WXWORD wParam, const WXWORD pos, const WXHWND control)
|
||||||
|
{
|
||||||
|
MSWOnVScroll(wParam, pos, control);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxSliderMSW::~wxSliderMSW(void)
|
||||||
|
{
|
||||||
|
if (m_staticMin)
|
||||||
|
DestroyWindow((HWND) m_staticMin);
|
||||||
|
if (m_staticMax)
|
||||||
|
DestroyWindow((HWND) m_staticMax);
|
||||||
|
if (m_staticValue)
|
||||||
|
DestroyWindow((HWND) m_staticValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSliderMSW::GetValue(void) const
|
||||||
|
{
|
||||||
|
return ::GetScrollPos((HWND) GetHWND(), SB_CTL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetValue(const int value)
|
||||||
|
{
|
||||||
|
::SetScrollPos((HWND) GetHWND(), SB_CTL, value, TRUE);
|
||||||
|
if (m_staticValue)
|
||||||
|
{
|
||||||
|
sprintf(wxBuffer, "%d", value);
|
||||||
|
SetWindowText((HWND) m_staticValue, wxBuffer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::GetSize(int *width, int *height) const
|
||||||
|
{
|
||||||
|
RECT rect;
|
||||||
|
rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
|
||||||
|
|
||||||
|
wxFindMaxSize(GetHWND(), &rect);
|
||||||
|
|
||||||
|
if (m_staticMin)
|
||||||
|
wxFindMaxSize(m_staticMin, &rect);
|
||||||
|
if (m_staticMax)
|
||||||
|
wxFindMaxSize(m_staticMax, &rect);
|
||||||
|
if (m_staticValue)
|
||||||
|
wxFindMaxSize(m_staticValue, &rect);
|
||||||
|
|
||||||
|
*width = rect.right - rect.left;
|
||||||
|
*height = rect.bottom - rect.top;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::GetPosition(int *x, int *y) const
|
||||||
|
{
|
||||||
|
wxWindow *parent = GetParent();
|
||||||
|
RECT rect;
|
||||||
|
rect.left = -1; rect.right = -1; rect.top = -1; rect.bottom = -1;
|
||||||
|
|
||||||
|
wxFindMaxSize(GetHWND(), &rect);
|
||||||
|
|
||||||
|
if (m_staticMin)
|
||||||
|
wxFindMaxSize(m_staticMin, &rect);
|
||||||
|
if (m_staticMax)
|
||||||
|
wxFindMaxSize(m_staticMax, &rect);
|
||||||
|
if (m_staticValue)
|
||||||
|
wxFindMaxSize(m_staticValue, &rect);
|
||||||
|
|
||||||
|
// Since we now have the absolute screen coords,
|
||||||
|
// if there's a parent we must subtract its top left corner
|
||||||
|
POINT point;
|
||||||
|
point.x = rect.left;
|
||||||
|
point.y = rect.top;
|
||||||
|
if (parent)
|
||||||
|
::ScreenToClient((HWND) parent->GetHWND(), &point);
|
||||||
|
|
||||||
|
*x = point.x;
|
||||||
|
*y = point.y;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetSize(const int x, const int y, const int width, const int height, const int sizeFlags)
|
||||||
|
{
|
||||||
|
int x1 = x;
|
||||||
|
int y1 = y;
|
||||||
|
int w1 = width;
|
||||||
|
int h1 = height;
|
||||||
|
|
||||||
|
int currentX, currentY;
|
||||||
|
GetPosition(¤tX, ¤tY);
|
||||||
|
if (x == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
|
x1 = currentX;
|
||||||
|
if (y == -1 || (sizeFlags & wxSIZE_ALLOW_MINUS_ONE))
|
||||||
|
y1 = currentY;
|
||||||
|
|
||||||
|
char buf[300];
|
||||||
|
|
||||||
|
int x_offset = x;
|
||||||
|
int y_offset = y;
|
||||||
|
|
||||||
|
int cx; // slider,min,max sizes
|
||||||
|
int cy;
|
||||||
|
float cyf;
|
||||||
|
|
||||||
|
wxGetCharSize(GetHWND(), &cx, &cy,GetFont());
|
||||||
|
|
||||||
|
if ((m_windowStyle & wxSL_VERTICAL) != wxSL_VERTICAL)
|
||||||
|
{
|
||||||
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
|
{
|
||||||
|
float min_len = 0.0;
|
||||||
|
|
||||||
|
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||||
|
GetTextExtent(buf, &min_len, &cyf,NULL,NULL, GetFont());
|
||||||
|
|
||||||
|
float max_len = 0.0;
|
||||||
|
|
||||||
|
GetWindowText((HWND) m_staticMax, buf, 300);
|
||||||
|
GetTextExtent(buf, &max_len, &cyf,NULL,NULL, GetFont());
|
||||||
|
if (m_staticValue)
|
||||||
|
{
|
||||||
|
int new_width = (int)(wxMax(min_len, max_len));
|
||||||
|
int valueHeight = (int)cyf;
|
||||||
|
#ifdef __WIN32__
|
||||||
|
// For some reason, under Win95, the text edit control has
|
||||||
|
// a lot of space before the first character
|
||||||
|
new_width += 3*cx;
|
||||||
|
#endif
|
||||||
|
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||||
|
x_offset += new_width + cx;
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveWindow((HWND) m_staticMin, x_offset, y_offset, (int)min_len, cy, TRUE);
|
||||||
|
x_offset += (int)(min_len + cx);
|
||||||
|
|
||||||
|
int slider_length = (int)(w1 - x_offset - max_len - cx);
|
||||||
|
|
||||||
|
int slider_height = cy;
|
||||||
|
|
||||||
|
// Slider must have a minimum/default length/height
|
||||||
|
if (slider_length < 100)
|
||||||
|
slider_length = 100;
|
||||||
|
|
||||||
|
MoveWindow((HWND) GetHWND(), x_offset, y_offset, slider_length, slider_height, TRUE);
|
||||||
|
x_offset += slider_length + cx;
|
||||||
|
|
||||||
|
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No labels
|
||||||
|
if ( w1 < 0 )
|
||||||
|
w1 = 200;
|
||||||
|
if ( h1 < 0 )
|
||||||
|
h1 = 20;
|
||||||
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ( m_windowStyle & wxSL_LABELS )
|
||||||
|
{
|
||||||
|
float min_len;
|
||||||
|
GetWindowText((HWND) m_staticMin, buf, 300);
|
||||||
|
GetTextExtent(buf, &min_len, &cyf,NULL,NULL,GetFont());
|
||||||
|
|
||||||
|
float max_len;
|
||||||
|
GetWindowText((HWND) m_staticMax, buf, 300);
|
||||||
|
GetTextExtent(buf, &max_len, &cyf,NULL,NULL, GetFont());
|
||||||
|
|
||||||
|
if (m_staticValue)
|
||||||
|
{
|
||||||
|
int new_width = (int)(wxMax(min_len, max_len));
|
||||||
|
int valueHeight = (int)cyf;
|
||||||
|
/*** Suggested change by George Tasker - remove this block...
|
||||||
|
#ifdef __WIN32__
|
||||||
|
// For some reason, under Win95, the text edit control has
|
||||||
|
// a lot of space before the first character
|
||||||
|
new_width += 3*cx;
|
||||||
|
#endif
|
||||||
|
... and replace with following line: */
|
||||||
|
new_width += cx;
|
||||||
|
|
||||||
|
MoveWindow((HWND) m_staticValue, x_offset, y_offset, new_width, valueHeight, TRUE);
|
||||||
|
y_offset += valueHeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
MoveWindow((HWND) m_staticMin, x_offset, y_offset, (int)min_len, cy, TRUE);
|
||||||
|
y_offset += cy;
|
||||||
|
|
||||||
|
int slider_length = (int)(h1 - y_offset - cy - cy);
|
||||||
|
|
||||||
|
// Use character height as an estimate of slider width (yes, width)
|
||||||
|
int slider_width = cy;
|
||||||
|
|
||||||
|
// Slider must have a minimum/default length
|
||||||
|
if (slider_length < 100)
|
||||||
|
slider_length = 100;
|
||||||
|
|
||||||
|
MoveWindow((HWND) GetHWND(), x_offset, y_offset, slider_width, slider_length, TRUE);
|
||||||
|
y_offset += slider_length;
|
||||||
|
|
||||||
|
MoveWindow((HWND) m_staticMax, x_offset, y_offset, (int)max_len, cy, TRUE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// No labels
|
||||||
|
if ( w1 < 0 )
|
||||||
|
w1 = 20;
|
||||||
|
if ( h1 < 0 )
|
||||||
|
h1 = 200;
|
||||||
|
MoveWindow((HWND) GetHWND(), x1, y1, w1, h1, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetRange(const int minValue, const int maxValue)
|
||||||
|
{
|
||||||
|
m_rangeMin = minValue;
|
||||||
|
m_rangeMax = maxValue;
|
||||||
|
|
||||||
|
::SetScrollRange((HWND) GetHWND(), SB_CTL, m_rangeMin, m_rangeMax, TRUE);
|
||||||
|
char buf[40];
|
||||||
|
if ( m_staticMin )
|
||||||
|
{
|
||||||
|
sprintf(buf, "%d", m_rangeMin);
|
||||||
|
SetWindowText((HWND) m_staticMin, buf);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( m_staticMax )
|
||||||
|
{
|
||||||
|
sprintf(buf, "%d", m_rangeMax);
|
||||||
|
SetWindowText((HWND) m_staticMax, buf);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
WXHBRUSH wxSliderMSW::OnCtlColor(const WXHDC pDC, const WXHWND pWnd, const WXUINT nCtlColor,
|
||||||
|
WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
|
||||||
|
{
|
||||||
|
if ( nCtlColor == CTLCOLOR_SCROLLBAR )
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
// Otherwise, it's a static
|
||||||
|
if (GetParent()->GetTransparentBackground())
|
||||||
|
SetBkMode((HDC) pDC, TRANSPARENT);
|
||||||
|
else
|
||||||
|
SetBkMode((HDC) pDC, OPAQUE);
|
||||||
|
|
||||||
|
::SetBkColor((HDC) pDC, RGB(GetBackgroundColour().Red(), GetBackgroundColour().Green(), GetBackgroundColour().Blue()));
|
||||||
|
::SetTextColor((HDC) pDC, RGB(GetForegroundColour().Red(), GetForegroundColour().Green(), GetForegroundColour().Blue()));
|
||||||
|
|
||||||
|
wxBrush *backgroundBrush = wxTheBrushList->FindOrCreateBrush(GetBackgroundColour(), wxSOLID);
|
||||||
|
|
||||||
|
return (WXHBRUSH) backgroundBrush->GetResourceHandle();
|
||||||
|
}
|
||||||
|
|
||||||
|
// For trackbars only
|
||||||
|
void wxSliderMSW::SetTickFreq(const int n, const int pos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetPageSize(const int pageSize)
|
||||||
|
{
|
||||||
|
m_pageSize = pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSliderMSW::GetPageSize(void) const
|
||||||
|
{
|
||||||
|
return m_pageSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::ClearSel(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::ClearTicks(void)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetLineSize(const int lineSize)
|
||||||
|
{
|
||||||
|
m_lineSize = lineSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSliderMSW::GetLineSize(void) const
|
||||||
|
{
|
||||||
|
return m_lineSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSliderMSW::GetSelEnd(void) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSliderMSW::GetSelStart(void) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetSelection(const int minPos, const int maxPos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetThumbLength(const int len)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
int wxSliderMSW::GetThumbLength(void) const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxSliderMSW::SetTick(const int tickPos)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSliderMSW::ContainsHWND(WXHWND hWnd) const
|
||||||
|
{
|
||||||
|
return ( hWnd == GetStaticMin() || hWnd == GetStaticMax() || hWnd == GetEditValue() );
|
||||||
|
}
|
||||||
|
|
||||||
|
#if WXWIN_COMPATIBILITY
|
||||||
|
// Backward compatibility
|
||||||
|
void wxSliderMSW::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 wxSliderMSW::Command (wxCommandEvent & event)
|
||||||
|
{
|
||||||
|
SetValue (event.GetInt());
|
||||||
|
ProcessCommand (event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxSliderMSW::Show(const bool show)
|
||||||
|
{
|
||||||
|
wxWindow::Show(show);
|
||||||
|
|
||||||
|
int cshow;
|
||||||
|
if (show)
|
||||||
|
cshow = SW_SHOW;
|
||||||
|
else
|
||||||
|
cshow = SW_HIDE;
|
||||||
|
|
||||||
|
if(m_staticValue)
|
||||||
|
ShowWindow((HWND) m_staticValue, (BOOL)cshow);
|
||||||
|
if(m_staticMin)
|
||||||
|
ShowWindow((HWND) m_staticMin, (BOOL)cshow);
|
||||||
|
if(m_staticMax)
|
||||||
|
ShowWindow((HWND) m_staticMax, (BOOL)cshow);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@@ -228,6 +228,12 @@ int wxTabCtrl::GetSelection() const
|
|||||||
return (int) TabCtrl_GetCurSel( (HWND) GetHWND() );
|
return (int) TabCtrl_GetCurSel( (HWND) GetHWND() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get the tab with the current keyboard focus
|
||||||
|
int wxTabCtrl::GetCurFocus() const
|
||||||
|
{
|
||||||
|
return (int) TabCtrl_GetCurFocus( (HWND) GetHWND() );
|
||||||
|
}
|
||||||
|
|
||||||
// Get the associated image list
|
// Get the associated image list
|
||||||
wxImageList* wxTabCtrl::GetImageList() const
|
wxImageList* wxTabCtrl::GetImageList() const
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user