root / ofxArgosUI / src / ofxArgosUI_Control.h @ 66

View | Annotate | Download (3.2 KB)

1
/***********************************************************************
2
 
3
 Copyright (c) 2009, 2010 Dimitri Diakopoulos, http://www.dimitridiakopoulos.com/
4
5
 Portions Copyright (c) 2008, 2009 Memo Aktens, http://www.memo.tv/
6
 -> Based on ofxSimpleGuiToo
7
 
8
 Portions Copyright (c) 2008 Todd Vanderlin, http://toddvanderlin.com/
9
 -> Inspired by ofxSimpleGui API
10
11
        Redistribution and use in source and binary forms, with or without modification, 
12
        are permitted provided that the following conditions are met:
13
14
        1. Redistributions of source code must retain the above copyright notice, 
15
        this list of conditions and the following disclaimer.
16
17
        2. Redistributions in binary form must reproduce the above copyright notice, 
18
        this list of conditions and the following disclaimer in the documentation and/or 
19
        other materials provided with the distribution.
20
21
        3. The name of the author may not be used to endorse or promote products derived 
22
        from this software without specific prior written permission.
23
24
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
25
        ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 
26
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
27
        ARE DISCLAIMED. IN NOEVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, 
28
        INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 
29
        (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 
30
        LOSS OF USE, DATA, ORPROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 
31
        AND ON ANY THEORY OFLIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 
33
        OF THE USE OF THIS SOFTWARE,EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
34
35
*************************************************************************/ 
36
#pragma once
37
38
#include "ofxXmlSettings.h"
39
#include "ofxTouchAPI_IO.h"
40
#include "ofxArgosUI_Parameter.h"
41
#include "StaticFont.h"
42
#include "OSCHandler.h"
43
44
class ofxArgosUI_Control : public ofxTouchAPI_IO {
45
46
public:
47
48
        ofxArgosUI_Parameter        param;  
49
50
        string                name;                        // Human readable name
51
        string                key;                        // Machine readable name
52
        string                controlType;        // ...
53
        bool                lock;                        // ... 
54
55
        bool                canfocus;                // Can the control be selected?
56
        bool                dragging;                // Is the control currently being dragged?
57
        
58
        int                        dragX;
59
        int                        dragY; 
60
61
        string                OSCaddress;                // OSC address
62
        
63
        // ========================================= Constructor
64
        ofxArgosUI_Control(string name);
65
66
        // ========================================= Basic
67
        void setName(string newName);
68
        void setKey(string newKey);
69
        void setConfig(ofxArgosUI_Parameter *config);
70
71
        // ========================================= Color
72
        void setTextColor(bool clickable = true);
73
        void setTextBGColor(bool clickable = true);
74
        void setFullColor(bool forceActive = false);
75
        void setEmptyColor();
76
77
        // ========================================= Drawing
78
        virtual void setup() {}
79
        virtual void draw(float x, float y) {}
80
        virtual void draw() { draw(x, y); }        
81
82
        // ========================================= Dragging
83
        virtual void dropControl(int x, int y) {}
84
85
        // ========================================= XML Settings (deprecated)
86
        virtual void loadFromXML(ofxXmlSettings &XML) {}
87
        virtual void saveToXML(ofxXmlSettings &XML) {}
88
89
};