Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 182 lines (153 sloc) 7.209 kb
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
1 /***********************************************************************
2 * FXRuby -- the Ruby language bindings for the FOX GUI toolkit.
b8219ec @lylejohnson Updated copyright notice for all SWIG interface files
lylejohnson authored
3 * Copyright (c) 2001-2009 by Lyle Johnson. All Rights Reserved.
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 *
19 * For further information please contact the author by e-mail
a934547 @lylejohnson Replaced e-mail address "lyle@users.sourceforge.net" with
lylejohnson authored
20 * at "lyle@lylejohnson.name".
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
21 ***********************************************************************/
22
23 /// Slider Control styles
24 enum {
25 SLIDER_HORIZONTAL = 0, /// Slider shown horizontally
26 SLIDER_VERTICAL = 0x00008000, /// Slider shown vertically
27 SLIDER_ARROW_UP = 0x00010000, /// Slider has arrow head pointing up
28 SLIDER_ARROW_DOWN = 0x00020000, /// Slider has arrow head pointing down
29 SLIDER_ARROW_LEFT = SLIDER_ARROW_UP, /// Slider has arrow head pointing left
30 SLIDER_ARROW_RIGHT = SLIDER_ARROW_DOWN, /// Slider has arrow head pointing right
31 SLIDER_INSIDE_BAR = 0x00040000, /// Slider is inside the slot rather than overhanging
32 SLIDER_TICKS_TOP = 0x00080000, /// Ticks on the top of horizontal slider
33 SLIDER_TICKS_BOTTOM = 0x00100000, /// Ticks on the bottom of horizontal slider
34 SLIDER_TICKS_LEFT = SLIDER_TICKS_TOP, /// Ticks on the left of vertical slider
35 SLIDER_TICKS_RIGHT = SLIDER_TICKS_BOTTOM, /// Ticks on the right of vertical slider
36 SLIDER_NORMAL = SLIDER_HORIZONTAL
37 };
38
39
40 /// Slider Control
41 class FXSlider : public FXFrame {
42 protected:
43 FXint range[2]; // Reported data range
44 FXint pos; // Reported data position
45 FXint incr; // Increment when auto-sliding
46 FXint delta; // Interval between ticks
47 FXint headpos; // Head position
48 FXint headsize; // Head size
49 FXint slotsize; // Slot size
50 FXColor slotColor; // Color of slot the head moves in
51 FXint dragpoint; // Where the head is grabbed
52 FXString help; // Help string
53 FXString tip; // Tip string
54 protected:
55 FXSlider();
56 FXint headPos(FXint v) const;
57 FXint headVal(FXint p) const;
58 void drawSliderHead(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
59 void drawHorzTicks(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
60 void drawVertTicks(FXDCWindow& dc,FXint x,FXint y,FXint w,FXint h);
61 public:
62 long onPaint(FXObject*,FXSelector,void* PTR_EVENT);
63 long onMotion(FXObject*,FXSelector,void* PTR_EVENT);
64 long onMouseWheel(FXObject*,FXSelector,void* PTR_EVENT);
65 long onLeftBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
66 long onLeftBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
67 long onMiddleBtnPress(FXObject*,FXSelector,void* PTR_EVENT);
68 long onMiddleBtnRelease(FXObject*,FXSelector,void* PTR_EVENT);
69 long onKeyPress(FXObject*,FXSelector,void* PTR_EVENT);
70 long onKeyRelease(FXObject*,FXSelector,void* PTR_EVENT);
71 long onUngrabbed(FXObject*,FXSelector,void* PTR_EVENT);
72 long onAutoSlide(FXObject*,FXSelector,void* PTR_INT);
73 long onCmdSetValue(FXObject*,FXSelector,void* PTR_INT);
74 long onCmdSetIntValue(FXObject*,FXSelector,void* PTR_PINT);
75 long onCmdGetIntValue(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
76 long onCmdSetRealValue(FXObject*,FXSelector,void* PTR_PDOUBLE);
77 long onCmdGetRealValue(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
78 long onCmdSetIntRange(FXObject*,FXSelector,void* PTR_INTRANGE_IN);
79 long onCmdGetIntRange(FXObject*,FXSelector,void* PTR_INTRANGE_OUT);
80 long onCmdSetRealRange(FXObject*,FXSelector,void* PTR_DBLRANGE_IN);
81 long onCmdGetRealRange(FXObject*,FXSelector,void* PTR_DBLRANGE_OUT);
82 long onCmdSetHelp(FXObject*,FXSelector,void* PTR_STRING);
83 long onCmdGetHelp(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
84 long onCmdSetTip(FXObject*,FXSelector,void* PTR_STRING);
85 long onCmdGetTip(FXObject*,FXSelector,void* PTR_IGNORE); // FIXME
86 long onQueryHelp(FXObject*,FXSelector,void* PTR_IGNORE);
87 long onQueryTip(FXObject*,FXSelector,void* PTR_IGNORE);
88 public:
89 enum{
90 ID_AUTOSLIDE=FXFrame::ID_LAST,
91 ID_LAST
92 };
93 public:
bea4cad @larskanis Strip all whitespaces on line endings
authored
94
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
95 /// Construct a slider widget
96 %extend {
97 FXSlider(FXComposite* p,FXObject* tgt=NULL,FXSelector sel=0,FXuint opts=SLIDER_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=0,FXint pr=0,FXint pt=0,FXint pb=0){
98 return new FXRbSlider(p,tgt,sel,opts,x,y,w,h,pl,pr,pt,pb);
99 }
100 }
101
102 /// Change slider value
103 void setValue(FXint value,FXbool notify=FALSE);
bea4cad @larskanis Strip all whitespaces on line endings
authored
104
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
105 /// Return slider value
106 FXint getValue() const;
107
108 %extend {
109 /// Change the slider's range
110 void setRange(VALUE range,FXbool notify=FALSE){
111 FXint lo,hi;
112 FXRbRange2LoHi(range,lo,hi);
113 self->setRange(lo,hi,notify);
114 }
bea4cad @larskanis Strip all whitespaces on line endings
authored
115
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
116 /// Get the slider's current range
117 VALUE getRange() const {
118 FXint lo,hi;
119 self->getRange(lo,hi);
120 return rb_range_new(INT2NUM(lo),INT2NUM(hi),0);
121 }
122 }
123
124 /// Change the slider style
125 FXuint getSliderStyle() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
126
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
127 /// Get the current slider style
128 void setSliderStyle(FXuint style);
bea4cad @larskanis Strip all whitespaces on line endings
authored
129
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
130 /// Get the slider's head size
131 FXint getHeadSize() const;
132
133 /// Change the slider's head size
134 void setHeadSize(FXint hs);
bea4cad @larskanis Strip all whitespaces on line endings
authored
135
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
136 /// Get the slider's current slot size
137 FXint getSlotSize() const;
138
139 /// Change the slider's slot size
140 void setSlotSize(FXint bs);
bea4cad @larskanis Strip all whitespaces on line endings
authored
141
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
142 /// Get the slider's auto-increment/decrement value
143 FXint getIncrement() const;
144
145 /// Change the slider's auto-increment/decrement value
146 void setIncrement(FXint inc);
147
148 /// Change the delta between ticks
149 void setTickDelta(FXint dist);
150
151 /// Get delta between ticks
152 FXint getTickDelta() const;
bea4cad @larskanis Strip all whitespaces on line endings
authored
153
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
154 /// Change the color of the slot the slider head moves in
155 void setSlotColor(FXColor clr);
bea4cad @larskanis Strip all whitespaces on line endings
authored
156
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
157 /// Get the current slot color
158 FXColor getSlotColor() const;
159
160 /// Set the help text to be displayed on the status line
161 void setHelpText(const FXString& text);
bea4cad @larskanis Strip all whitespaces on line endings
authored
162
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
163 /// Get the current help text
164 const FXString& getHelpText() const;
165
166 /// Set the tip text to be displayed in the tooltip
167 void setTipText(const FXString& text);
bea4cad @larskanis Strip all whitespaces on line endings
authored
168
45cf7d8 @lylejohnson initial checkin of r2610 from trunk
lylejohnson authored
169 /// Get the current tooltip text value
170 const FXString& getTipText() const;
171
172 /// Destroy the slider
173 virtual ~FXSlider();
174 };
175
176
177 DECLARE_FXOBJECT_VIRTUALS(FXSlider)
178 DECLARE_FXID_VIRTUALS(FXSlider)
179 DECLARE_FXDRAWABLE_VIRTUALS(FXSlider)
180 DECLARE_FXWINDOW_VIRTUALS(FXSlider)
181
Something went wrong with that request. Please try again.