2003-06-19 18:09:27 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: wx/cocoa/slider.h
|
|
|
|
// Purpose: wxSlider class
|
|
|
|
// Author: David Elliott
|
2007-08-10 15:25:08 -04:00
|
|
|
// Mark Oxenham
|
2003-06-19 18:09:27 -04:00
|
|
|
// Modified by:
|
|
|
|
// Created: 2003/06/19
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) 2003 David Elliott
|
2007-08-10 15:25:08 -04:00
|
|
|
// (c) 2007 Software 2000 Ltd.
|
2006-10-17 10:44:52 -04:00
|
|
|
// Licence: wxWindows licence
|
2003-06-19 18:09:27 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef __WX_COCOA_SLIDER_H__
|
|
|
|
#define __WX_COCOA_SLIDER_H__
|
|
|
|
|
2007-08-10 15:25:08 -04:00
|
|
|
#include "wx/cocoa/NSSlider.h"
|
2003-06-19 18:09:27 -04:00
|
|
|
|
|
|
|
// ========================================================================
|
|
|
|
// wxSlider
|
|
|
|
// ========================================================================
|
2008-03-26 11:06:00 -04:00
|
|
|
class WXDLLIMPEXP_CORE wxSlider: public wxSliderBase, protected wxCocoaNSSlider
|
2003-06-19 18:09:27 -04:00
|
|
|
{
|
|
|
|
DECLARE_DYNAMIC_CLASS(wxSlider)
|
|
|
|
DECLARE_EVENT_TABLE()
|
2007-08-10 15:25:08 -04:00
|
|
|
WX_DECLARE_COCOA_OWNER(NSSlider,NSControl,NSView)
|
2003-06-19 18:09:27 -04:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// initialization
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
|
|
|
wxSlider() { }
|
|
|
|
wxSlider(wxWindow *parent, wxWindowID winid,
|
|
|
|
int value, int minValue, int maxValue,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSL_HORIZONTAL,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2003-06-19 18:16:22 -04:00
|
|
|
const wxString& name = wxSliderNameStr)
|
2003-06-19 18:09:27 -04:00
|
|
|
{
|
|
|
|
Create(parent, winid, value, minValue, maxValue,
|
|
|
|
pos, size, style, validator, name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool Create(wxWindow *parent, wxWindowID winid,
|
|
|
|
int value, int minValue, int maxValue,
|
|
|
|
const wxPoint& pos = wxDefaultPosition,
|
|
|
|
const wxSize& size = wxDefaultSize,
|
|
|
|
long style = wxSL_HORIZONTAL,
|
|
|
|
const wxValidator& validator = wxDefaultValidator,
|
2003-06-19 18:16:22 -04:00
|
|
|
const wxString& name = wxSliderNameStr);
|
2003-06-19 18:09:27 -04:00
|
|
|
virtual ~wxSlider();
|
|
|
|
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Cocoa callbacks
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
protected:
|
2007-08-15 00:12:44 -04:00
|
|
|
// Override this so we can use wxCocoaNSControl's target
|
|
|
|
void AssociateNSSlider(WX_NSSlider theSlider);
|
|
|
|
|
|
|
|
// Helper method to do the real work
|
2007-08-10 15:25:08 -04:00
|
|
|
virtual void ProcessEventType(wxEventType commandType);
|
2007-08-15 00:12:44 -04:00
|
|
|
|
|
|
|
// from wxCocoaNSControl:
|
|
|
|
virtual void CocoaTarget_action();
|
|
|
|
|
|
|
|
// from wxCocoaNSSlider:
|
2007-08-10 15:25:08 -04:00
|
|
|
virtual void CocoaNotification_startTracking(WX_NSNotification notification);
|
|
|
|
virtual void CocoaNotification_continueTracking(WX_NSNotification notification);
|
|
|
|
virtual void CocoaNotification_stopTracking(WX_NSNotification notification);
|
2007-08-15 00:12:44 -04:00
|
|
|
|
2003-06-19 18:09:27 -04:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
// Implementation
|
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
public:
|
|
|
|
// Pure Virtuals
|
2007-08-10 15:25:08 -04:00
|
|
|
virtual int GetValue() const;
|
|
|
|
virtual void SetValue(int value);
|
2003-06-19 18:09:27 -04:00
|
|
|
|
|
|
|
// retrieve/change the range
|
2007-08-10 15:25:08 -04:00
|
|
|
virtual void SetRange(int minValue, int maxValue);
|
|
|
|
virtual int GetMin() const;
|
|
|
|
virtual int GetMax() const;
|
2003-06-19 18:09:27 -04:00
|
|
|
|
|
|
|
// the line/page size is the increment by which the slider moves when
|
|
|
|
// cursor arrow key/page up or down are pressed (clicking the mouse is like
|
|
|
|
// pressing PageUp/Down) and are by default set to 1 and 1/10 of the range
|
2007-08-10 15:25:08 -04:00
|
|
|
virtual void SetLineSize(int lineSize);
|
|
|
|
virtual void SetPageSize(int pageSize);
|
|
|
|
virtual int GetLineSize() const;
|
|
|
|
virtual int GetPageSize() const;
|
2003-06-19 18:09:27 -04:00
|
|
|
|
|
|
|
// these methods get/set the length of the slider pointer in pixels
|
2007-08-10 15:25:08 -04:00
|
|
|
virtual void SetThumbLength(int lenPixels);
|
|
|
|
virtual int GetThumbLength() const;
|
|
|
|
|
|
|
|
// copied from (wxSliderCocoa.h)
|
|
|
|
virtual void SetTickFreq(int n, int pos);
|
|
|
|
virtual int GetTickFreq() const;
|
|
|
|
virtual void ClearTicks() { SetTickFreq(0, 0); }
|
|
|
|
|
|
|
|
virtual void SetTickPos(int pos);
|
2003-06-19 18:09:27 -04:00
|
|
|
|
|
|
|
};
|
|
|
|
|
2006-10-17 10:44:52 -04:00
|
|
|
#endif
|
|
|
|
// __WX_COCOA_SLIDER_H__
|