1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
|
//-----------------------------------------------------------------------------
// VST Plug-Ins SDK
// VSTGUI: Graphical User Interface Framework for VST plugins :
// Standard Control Objects
//
// Version 3.0 $Date: 2006/02/08 17:29:59 $
//
//-----------------------------------------------------------------------------
// VSTGUI LICENSE
// � 2004, Steinberg Media Technologies, All Rights Reserved
//-----------------------------------------------------------------------------
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
// * Neither the name of the Steinberg Media Technologies nor the names of its
// contributors may be used to endorse or promote products derived from this
// software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
// INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
// BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
// LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
// OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
// OF THE POSSIBILITY OF SUCH DAMAGE.
//-----------------------------------------------------------------------------
#ifndef __vstcontrols__
#define __vstcontrols__
#ifndef __vstgui__
#include "vstgui.h"
#endif
//------------------
// defines
//------------------
#ifndef kPI
#define kPI 3.14159265358979323846
#endif
#ifndef k2PI
#define k2PI 6.28318530717958647692
#endif
#ifndef kPI_2
#define kPI_2 1.57079632679489661923f
#endif
#ifndef kPI_4
#define kPI_4 0.78539816339744830962
#endif
#ifndef kE
#define kE 2.7182818284590452354
#endif
#ifndef kLN2
#define kLN2 0.69314718055994530942
#endif
#ifndef kSQRT2
#define kSQRT2 1.41421356237309504880
#endif
//------------------
// CControlEnum type
//------------------
enum CControlEnum
{
kHorizontal = 1 << 0,
kVertical = 1 << 1,
kShadowText = 1 << 2,
kLeft = 1 << 3,
kRight = 1 << 4,
kTop = 1 << 5,
kBottom = 1 << 6,
k3DIn = 1 << 7,
k3DOut = 1 << 8,
kPopupStyle = 1 << 9,
kCheckStyle = 1 << 10,
kMultipleCheckStyle,
kNoTextStyle = 1 << 11,
kNoDrawStyle = 1 << 12,
kDoubleClickStyle = 1 << 13,
kNoFrame = 1 << 14
};
//---------------------------
// Some defines for Menu item
//---------------------------
#define kMenuTitle "-T"
#define kMenuSeparator "-"
#define kMenuDisable "-G"
#define kMenuSubMenu "-M"
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
class CControlListener
{
public:
#if USE_NAMESPACE
virtual void valueChanged (VSTGUI::CDrawContext *pContext, VSTGUI::CControl *pControl) = 0;
virtual long controlModifierClicked (VSTGUI::CDrawContext *pContext, VSTGUI::CControl *pControl, long button) { return 0; } // return 1 if you want the control to not handle it, otherwise 0
#else
virtual void valueChanged (CDrawContext *pContext, CControl *pControl) = 0;
virtual long controlModifierClicked (CDrawContext *pContext, CControl *pControl, long button) { return 0; } // return 1 if you want the control to not handle it, otherwise 0
#endif
};
class AudioEffectX;
//-----------------------------------------------------------------------------
BEGIN_NAMESPACE_VSTGUI
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------
// CControl Declaration
//! base class of all VSTGUI controls
//-----------------------------------------------------------------------------
class CControl : public CView
{
public:
CControl (const CRect &size, CControlListener *listener = 0, long tag = 0,
CBitmap *pBackground = 0);
virtual ~CControl ();
virtual void draw (CDrawContext *pContext) = 0;
virtual void doIdleStuff () { if (pParentFrame) pParentFrame->doIdleStuff (); }
virtual void setValue (float val) { value = val; }
virtual float getValue () const { return value; };
virtual void setMin (float val) { vmin = val; }
virtual float getMin () const { return vmin; }
virtual void setMax (float val) { vmax = val; }
virtual float getMax () const { return vmax; }
virtual void setOldValue (float val) { oldValue = val; }
virtual float getOldValue (void) const { return oldValue; }
virtual void setDefaultValue (float val) { defaultValue = val; }
virtual float getDefaultValue (void) const { return defaultValue; }
virtual void setTag (long val) { tag = val; }
virtual long getTag () const { return tag; }
virtual bool isDirty () const;
virtual void setDirty (const bool val = true);
virtual void beginEdit ();
virtual void endEdit ();
virtual void setBackOffset (CPoint &offset);
virtual void copyBackOffset ();
virtual void setWheelInc (float val) { wheelInc = val; }
virtual float getWheelInc () const { return wheelInc; }
virtual void bounceValue ();
virtual bool checkDefaultValue (CDrawContext *pContext, long button);
CControlListener* getListener () const { return listener; }
void setListener (CControlListener* l) { listener = l; }
bool isDoubleClick ();
CLASS_METHODS(CControl, CView)
protected:
CControlListener *listener;
long tag;
float oldValue;
float defaultValue;
float value;
float vmin;
float vmax;
float wheelInc;
long lastTicks;
long delta;
CPoint backOffset;
};
//-----------------------------------------------------------------------------
// COnOffButton Declaration
//! a button control with 2 states
//-----------------------------------------------------------------------------
class COnOffButton : public CControl
{
public:
COnOffButton (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, long style = kPreListenerUpdate);
virtual ~COnOffButton ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual long getStyle () const { return style; }
virtual void setStyle (long newStyle) { style = newStyle; }
enum {
kPreListenerUpdate, ///< listener will be called after doIdleStuff was called
kPostListenerUpdate, ///< listener will be called before doIdleStuff is called
};
CLASS_METHODS(COnOffButton, CControl)
protected:
long style;
};
//-----------------------------------------------------------------------------
// CParamDisplay Declaration
//! a parameter display control
//-----------------------------------------------------------------------------
class CParamDisplay : public CControl
{
public:
CParamDisplay (const CRect &size, CBitmap *background = 0, const long style = 0);
virtual ~CParamDisplay ();
virtual void setFont (CFont fontID);
CFont getFont () const { return fontID; }
virtual void setFontColor (CColor color);
CColor getFontColor () const { return fontColor; }
virtual void setBackColor (CColor color);
CColor getBackColor () const { return backColor; }
virtual void setFrameColor (CColor color);
CColor getFrameColor () const { return frameColor; }
virtual void setShadowColor (CColor color);
CColor getShadowColor () const { return shadowColor; }
virtual void setHoriAlign (CHoriTxtAlign hAlign);
virtual void setStringConvert (void (*convert) (float value, char *string));
virtual void setStringConvert (void (*convert) (float value, char *string, void *userDta),
void *userData);
virtual void setString2FloatConvert (void (*convert) (char *string, float &output));
virtual void setStyle (long val);
long getStyle () const { return style; }
virtual void setTxtFace (CTxtFace val);
CTxtFace getTxtFace () const { return txtFace; }
virtual void draw (CDrawContext *pContext);
virtual void setTextTransparency (bool val) { bTextTransparencyEnabled = val; }
bool getTextTransparency () const { return bTextTransparencyEnabled; }
CLASS_METHODS(CParamDisplay, CControl)
protected:
void drawText (CDrawContext *pContext, char *string, CBitmap *newBack = 0);
void (*stringConvert) (float value, char *string);
void (*stringConvert2) (float value, char *string, void *userData);
void (*string2FloatConvert) (char *string, float &output);
void *userData;
CHoriTxtAlign horiTxtAlign;
long style;
CFont fontID;
CTxtFace txtFace;
CColor fontColor;
CColor backColor;
CColor frameColor;
CColor shadowColor;
bool bTextTransparencyEnabled;
};
//-----------------------------------------------------------------------------
// CLabel Declaration
//! a text label
//-----------------------------------------------------------------------------
class CTextLabel : public CParamDisplay
{
public:
CTextLabel (const CRect& size, const char* txt = 0, CBitmap* background = 0, const long style = 0);
~CTextLabel ();
virtual void setText (const char* txt);
virtual const char* getText () const;
virtual void draw (CDrawContext *pContext);
CLASS_METHODS(CTextLabel, CParamDisplay)
protected:
void freeText ();
char* text;
};
//-----------------------------------------------------------------------------
// CTextEdit Declaration
//! a text edit control
//-----------------------------------------------------------------------------
class CTextEdit : public CParamDisplay
{
public:
CTextEdit (const CRect &size, CControlListener *listener, long tag, const char *txt = 0,
CBitmap *background = 0, const long style = 0);
virtual ~CTextEdit ();
virtual void setText (char *txt);
virtual void getText (char *txt) const;
virtual void draw (CDrawContext *pContext);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual void setTextEditConvert (void (*editConvert) (char *input, char *string));
virtual void setTextEditConvert (void (*editConvert2) (char *input, char *string,
void *userDta), void *userData);
virtual void takeFocus (CDrawContext *pContext = 0);
virtual void looseFocus (CDrawContext *pContext = 0);
void *platformFontColor;
void *platformControl;
bool bWasReturnPressed;
#if MAC
short pluginResID;
#if QUARTZ
HIViewRef textControl;
#endif
#endif
CLASS_METHODS(CTextEdit, CParamDisplay)
protected:
void *platformFont;
char text[256];
#if (MAC && !MACX)
void *text_edit;
bool bLoosefocusWanted;
#endif
void (*editConvert) (char *input, char *string);
void (*editConvert2) (char *input, char *string, void *userData);
};
//-----------------------------------------------------------------------------
// COptionMenuScheme Declaration
//-----------------------------------------------------------------------------
class COptionMenuScheme : public CReferenceCounter
{
public:
COptionMenuScheme ();
virtual ~COptionMenuScheme ();
enum { kChecked = 0x01, kDisabled = 0x02, kSelected = 0x04, kSubMenu = 0x08, kTitle = 0x10 };
virtual void getItemSize (const char* text, CDrawContext* pContext, CPoint& size);
virtual void drawItem (const char* text, long itemId, long state, CDrawContext* pContext, const CRect& rect);
void setColors (CColor back, CColor select, CColor text, CColor htext, CColor dtext)
{ backgroundColor = back; selectionColor = select; textColor = text;
hiliteTextColor = htext; disableTextColor = dtext;}
void setFont (CFont f) { font = f; }
protected:
CColor backgroundColor;
CColor selectionColor;
CColor textColor;
CColor hiliteTextColor;
CColor disableTextColor;
CFont font;
virtual void drawItemBack (CDrawContext* pContext, const CRect& rect, bool hilite);
#if MAC_ENABLE_MENU_SCHEME
static pascal OSStatus eventHandler (EventHandlerCallRef inCallRef, EventRef inEvent, void *inUserData);
void registerWithToolbox ();
void unregisterWithToolbox ();
#endif
};
//-----------------------------------------------------------------------------
extern COptionMenuScheme* gOptionMenuScheme;
//-----------------------------------------------------------------------------
// COptionMenu Declaration
//! a popup menu control
//-----------------------------------------------------------------------------
class COptionMenu : public CParamDisplay
{
public:
COptionMenu (const CRect &size, CControlListener *listener, long tag,
CBitmap *background = 0, CBitmap *bgWhenClick = 0,
const long style = 0);
virtual ~COptionMenu ();
enum { MAX_ENTRY = 1024 };
virtual void setValue (float val);
virtual bool addEntry (COptionMenu *subMenu, char *txt);
virtual bool addEntry (char *txt, long index = -1);
virtual long getCurrent (char *txt = 0, bool countSeparator = true) const;
virtual bool setCurrent (long index, bool countSeparator = true);
virtual bool getEntry (long index, char *txt) const;
virtual bool setEntry (long index, char *txt);
virtual bool removeEntry (long index);
virtual bool removeAllEntry ();
virtual long getNbEntries () const { return nbEntries; }
virtual long getIndex (char *txt) const;
virtual bool checkEntry (long index, bool state);
virtual bool checkEntryAlone (long index);
virtual bool isCheckEntry (long index) const;
virtual void draw (CDrawContext *pContext);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual void takeFocus (CDrawContext *pContext = 0);
virtual void looseFocus (CDrawContext *pContext = 0);
virtual void setNbItemsPerColumn (long val) { nbItemsPerColumn = val; }
virtual long getNbItemsPerColumn () const { return nbItemsPerColumn; }
#if MOTIF
void setCurrentSelected (void *itemSelected);
#elif MAC
short getMenuID () const { return menuID; }
#endif
long getLastResult () const { return lastResult; }
COptionMenu *getLastItemMenu (long &idxInMenu) const;
void setScheme (COptionMenuScheme* s) { scheme = s; }
virtual COptionMenuScheme* getScheme () const { return scheme; }
virtual void setPrefixNumbers (long preCount);
COptionMenu* getSubMenu (long idx) const;
CLASS_METHODS(COptionMenu, CParamDisplay)
protected:
COptionMenu *getItemMenu (long idx, long &idxInMenu, long &offsetIdx);
void removeItems ();
void *appendItems (long &offsetIdx);
void *platformControl;
bool allocateMenu (long nb);
bool allocateSubMenu (long nb);
char **entry;
COptionMenu **submenuEntry;
bool *check;
#if MOTIF
void *itemWidget[MAX_ENTRY];
#elif MAC
short menuID;
#endif
long nbEntries;
long nbSubMenus;
long currentIndex;
CBitmap *bgWhenClick;
long lastButton;
long nbItemsPerColumn;
long nbAllocated;
long nbSubMenuAllocated;
long lastResult;
long prefixNumbers;
COptionMenu *lastMenu;
COptionMenuScheme* scheme;
};
//-----------------------------------------------------------------------------
// CKnob Declaration
//! a knob control
//-----------------------------------------------------------------------------
class CKnob : public CControl
{
public:
CKnob (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CBitmap *handle, const CPoint &offset);
virtual ~CKnob ();
virtual void draw (CDrawContext *pContext);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual bool onWheel (CDrawContext *pContext, const CPoint &where, float distance);
virtual long onKeyDown (VstKeyCode& keyCode);
virtual void drawHandle (CDrawContext *pContext);
virtual void setStartAngle (float val);
virtual float getStartAngle () const { return startAngle; }
virtual void setRangeAngle (float val);
virtual float getRangeAngle () const { return rangeAngle; }
virtual void valueToPoint (CPoint &point) const;
virtual float valueFromPoint (CPoint &point) const;
virtual void setInsetValue (long val) { inset = val; }
virtual void setColorShadowHandle (CColor color);
virtual void setColorHandle (CColor color);
virtual void setHandleBitmap (CBitmap *bitmap);
virtual void setZoomFactor (float val) { zoomFactor = val; }
virtual float getZoomFactor () const { return zoomFactor; }
CLASS_METHODS(CKnob, CControl)
protected:
void compute ();
CPoint offset;
CColor colorHandle, colorShadowHandle;
CBitmap *pHandle;
long inset;
float startAngle, rangeAngle, halfAngle;
float aCoef, bCoef;
float radius;
float zoomFactor;
};
//-----------------------------------------------------------------------------
// CAnimKnob Declaration
//! a bitmap knob control
//-----------------------------------------------------------------------------
class CAnimKnob : public CKnob
{
public:
CAnimKnob (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CAnimKnob (const CRect &size, CControlListener *listener, long tag,
long subPixmaps, // number of subPixmaps
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset);
virtual ~CAnimKnob ();
virtual bool isDirty () const;
virtual void draw (CDrawContext* pContext);
void setInverseBitmap (bool val) { bInverseBitmap = val; }
CLASS_METHODS(CAnimKnob, CKnob)
protected:
long subPixmaps; // number of subPixmaps
CCoord heightOfOneImage;
bool bInverseBitmap;
CPoint lastDrawnPoint;
};
//-----------------------------------------------------------------------------
// CVerticalSwitch Declaration
//! a vertical switch control
//-----------------------------------------------------------------------------
class CVerticalSwitch : public CControl
{
public:
CVerticalSwitch (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CVerticalSwitch (const CRect &size, CControlListener *listener, long tag,
long subPixmaps, // number of subPixmaps
CCoord heightOfOneImage, // pixel
long iMaxPositions,
CBitmap *background, CPoint &offset);
virtual ~CVerticalSwitch ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
CLASS_METHODS(CVerticalSwitch, CControl)
protected:
CPoint offset;
long subPixmaps; // number of subPixmaps
CCoord heightOfOneImage;
long iMaxPositions;
};
//-----------------------------------------------------------------------------
// CHorizontalSwitch Declaration
//! a horizontal switch control
//-----------------------------------------------------------------------------
class CHorizontalSwitch : public CControl
{
public:
CHorizontalSwitch (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CHorizontalSwitch (const CRect &size, CControlListener *listener, long tag,
long subPixmaps, // number of subPixmaps
CCoord heightOfOneImage, // pixel
long iMaxPositions,
CBitmap *background, CPoint &offset);
virtual ~CHorizontalSwitch ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
CLASS_METHODS(CHorizontalSwitch, CControl)
protected:
CPoint offset;
long subPixmaps; // number of subPixmaps
long iMaxPositions;
CCoord heightOfOneImage;
};
//-----------------------------------------------------------------------------
// CRockerSwitch Declaration
//! a switch control with 3 sub bitmaps
//-----------------------------------------------------------------------------
class CRockerSwitch : public CControl
{
public:
CRockerSwitch (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset, const long style = kHorizontal);
CRockerSwitch (const CRect &size, CControlListener *listener, long tag,
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset, const long style = kHorizontal);
virtual ~CRockerSwitch ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual bool onWheel (CDrawContext *pContext, const CPoint &where, float distance);
CLASS_METHODS(CRockerSwitch, CControl)
protected:
CPoint offset;
CCoord heightOfOneImage;
long style;
};
//-----------------------------------------------------------------------------
// CMovieBitmap Declaration
//! a bitmap control that displays different bitmaps according to its current value
//-----------------------------------------------------------------------------
class CMovieBitmap : public CControl
{
public:
CMovieBitmap (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CMovieBitmap (const CRect &size, CControlListener *listener, long tag,
long subPixmaps, // number of subPixmaps
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset);
virtual ~CMovieBitmap ();
virtual void draw (CDrawContext*);
CLASS_METHODS(CMovieBitmap, CControl)
protected:
CPoint offset;
long subPixmaps; // number of subPixmaps
CCoord heightOfOneImage;
};
//-----------------------------------------------------------------------------
// CMovieButton Declaration
//! a bi-states button with 2 subbitmaps
//-----------------------------------------------------------------------------
class CMovieButton : public CControl
{
public:
CMovieButton (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CMovieButton (const CRect &size, CControlListener *listener, long tag,
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset);
virtual ~CMovieButton ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
CLASS_METHODS(CMovieButton, CControl)
protected:
CPoint offset;
CCoord heightOfOneImage;
float buttonState;
};
//-----------------------------------------------------------------------------
// CAutoAnimation Declaration
//!
//-----------------------------------------------------------------------------
class CAutoAnimation : public CControl
{
public:
CAutoAnimation (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CAutoAnimation (const CRect &size, CControlListener *listener, long tag,
long subPixmaps, // number of subPixmaps...
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset);
virtual ~CAutoAnimation ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual void openWindow (void);
virtual void closeWindow (void);
virtual void nextPixmap (void);
virtual void previousPixmap (void);
bool isWindowOpened () const { return bWindowOpened; }
CLASS_METHODS(CAutoAnimation, CControl)
protected:
CPoint offset;
long subPixmaps;
CCoord heightOfOneImage;
CCoord totalHeightOfBitmap;
bool bWindowOpened;
};
//-----------------------------------------------------------------------------
// CSlider Declaration
//! a slider control
//-----------------------------------------------------------------------------
class CSlider : public CControl
{
public:
CSlider (const CRect &size, CControlListener *listener, long tag,
long iMinPos, // min position in pixel
long iMaxPos, // max position in pixel
CBitmap *handle, // handle bitmap
CBitmap *background, // background bitmap
CPoint &offset, // offset in the background
const long style = kLeft|kHorizontal); // style (kBottom,kRight,kTop,kLeft,kHorizontal,kVertical)
CSlider (const CRect &rect, CControlListener *listener, long tag,
CPoint &offsetHandle, // handle offset
long rangeHandle, // size of handle range
CBitmap *handle, // handle bitmap
CBitmap *background, // background bitmap
CPoint &offset, // offset in the background
const long style = kLeft|kHorizontal); // style (kBottom,kRight,kTop,kLeft,kHorizontal,kVertical)
virtual ~CSlider ();
virtual bool attached (CView *parent);
virtual bool removed (CView *parent);
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual bool onWheel (CDrawContext *pContext, const CPoint &where, float distance);
virtual long onKeyDown (VstKeyCode& keyCode);
virtual void setDrawTransparentHandle (bool val) { bDrawTransparentEnabled = val; }
virtual void setFreeClick (bool val) { bFreeClick = val; }
virtual bool getFreeClick () const { return bFreeClick; }
virtual void setOffsetHandle (CPoint &val);
virtual void setHandle (CBitmap* pHandle);
virtual CBitmap *getHandle () const { return pHandle; }
virtual void setZoomFactor (float val) { zoomFactor = val; }
virtual float getZoomFactor () const { return zoomFactor; }
CLASS_METHODS(CSlider, CControl)
protected:
CPoint offset;
CPoint offsetHandle;
CBitmap *pHandle;
COffscreenContext *pOScreen;
long style;
CCoord widthOfSlider; // size of the handle-slider
CCoord heightOfSlider;
CCoord rangeHandle;
CCoord minTmp;
CCoord maxTmp;
CCoord minPos;
CCoord widthControl;
CCoord heightControl;
float zoomFactor;
bool bDrawTransparentEnabled;
bool bFreeClick;
};
//-----------------------------------------------------------------------------
// CVerticalSlider Declaration
//! a vertical slider control
//-----------------------------------------------------------------------------
class CVerticalSlider : public CSlider
{
public:
CVerticalSlider (const CRect &size, CControlListener *listener, long tag,
long iMinPos, // min Y position in pixel
long iMaxPos, // max Y position in pixel
CBitmap *handle, // bitmap slider
CBitmap *background, // bitmap background
CPoint &offset, // offset in the background
const long style = kBottom); // style (kBottom, kTop))
CVerticalSlider (const CRect &rect, CControlListener *listener, long tag,
CPoint &offsetHandle, // handle offset
long rangeHandle, // size of handle range
CBitmap *handle, // bitmap of slider
CBitmap *background, // bitmap of background
CPoint &offset, // offset in the background
const long style = kBottom); // style (kBottom, kTop)
};
//-----------------------------------------------------------------------------
// CHorizontalSlider Declaration
//! a horizontal slider control
//-----------------------------------------------------------------------------
class CHorizontalSlider : public CSlider
{
public:
CHorizontalSlider (const CRect &size, CControlListener *listener, long tag,
long iMinPos, // min X position in pixel
long iMaxPos, // max X position in pixel
CBitmap *handle, // bitmap slider
CBitmap *background, // bitmap background
CPoint &offset, // offset in the background
const long style = kRight); // style (kRight, kLeft)
CHorizontalSlider (const CRect &rect, CControlListener *listener, long tag,
CPoint &offsetHandle, // handle offset
long rangeHandle, // size of handle range
CBitmap *handle, // bitmap of slider
CBitmap *background, // bitmap of background
CPoint &offset, // offset in the background
const long style = kRight); // style (kRight, kLeft)
};
//-----------------------------------------------------------------------------
// CSpecialDigit Declaration
//! special display with custom numbers (0...9)
//-----------------------------------------------------------------------------
class CSpecialDigit : public CControl
{
public:
CSpecialDigit (const CRect &size, CControlListener *listener, long tag, // tag identifier
long dwPos, // actual value
long iNumbers, // amount of numbers (max 7)
long *xpos, // array of all XPOS
long *ypos, // array of all YPOS
long width, // width of ONE number
long height, // height of ONE number
CBitmap *background); // bitmap numbers
virtual ~CSpecialDigit ();
virtual void draw (CDrawContext*);
virtual float getNormValue (void) const;
CLASS_METHODS(CSpecialDigit, CControl)
protected:
long iNumbers; // amount of numbers
long xpos[7]; // array of all XPOS, max 7 possible
long ypos[7]; // array of all YPOS, max 7 possible
long width; // width of ONE number
long height; // height of ONE number
};
//-----------------------------------------------------------------------------
// CKickButton Declaration
//!
//-----------------------------------------------------------------------------
class CKickButton : public CControl
{
public:
CKickButton (const CRect &size, CControlListener *listener, long tag,
CBitmap *background, CPoint &offset);
CKickButton (const CRect &size, CControlListener *listener, long tag,
CCoord heightOfOneImage, // pixel
CBitmap *background, CPoint &offset);
virtual ~CKickButton ();
virtual void draw (CDrawContext*);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
CLASS_METHODS(CKickButton, CControl)
protected:
CPoint offset;
CCoord heightOfOneImage;
};
//-----------------------------------------------------------------------------
// CSplashScreen Declaration
//!
//-----------------------------------------------------------------------------
class CSplashScreen : public CControl
{
public:
CSplashScreen (const CRect &size, CControlListener *listener, long tag,
CBitmap *background,
CRect &toDisplay,
CPoint &offset);
virtual ~CSplashScreen ();
virtual void draw (CDrawContext*);
virtual bool hitTest (const CPoint& where, const long buttons = -1);
virtual void mouse (CDrawContext *pContext, CPoint &where, long button = -1);
virtual void unSplash (CDrawContext *pContext = 0);
void setBitmapTransparency (unsigned char transparency);
unsigned char getBitmapTransparency () const { return bitmapTransparency; }
const CPoint& getOffset () const { return offset; }
CLASS_METHODS(CSplashScreen, CControl)
protected:
CRect toDisplay;
CRect keepSize;
CPoint offset;
unsigned char bitmapTransparency;
};
//-----------------------------------------------------------------------------
// CVuMeter Declaration
//!
//-----------------------------------------------------------------------------
class CVuMeter : public CControl
{
public:
CVuMeter (const CRect& size, CBitmap *onBitmap, CBitmap *offBitmap,
long nbLed, const long style = kVertical);
virtual ~CVuMeter ();
virtual void setDecreaseStepValue (float value) { decreaseValue = value; }
virtual bool attached (CView *parent);
virtual bool removed (CView *parent);
virtual void draw (CDrawContext *pContext);
virtual void setDirty (const bool val = true);
void setUseOffscreen (bool val = true);
bool getUseOffscreen () const { return bUseOffscreen; }
CLASS_METHODS(CVuMeter, CControl)
protected:
CBitmap *onBitmap;
CBitmap *offBitmap;
COffscreenContext *pOScreen;
long nbLed;
long style;
float decreaseValue;
bool bUseOffscreen;
CRect rectOn;
CRect rectOff;
};
END_NAMESPACE_VSTGUI
#endif // __vstcontrol__
|