-
Notifications
You must be signed in to change notification settings - Fork 5
/
poControlPanel.h
103 lines (84 loc) · 3.1 KB
/
poControlPanel.h
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
/*
* Copyright 2012 Potion Design. All rights reserved.
* This file is part of pocode.
*
* pocode is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* pocode is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with pocode. If not, see <http://www.gnu.org/licenses/>.
*
*/
#pragma once
//
// UIWindow.h
// controlUI
//
// Created by Tamar Ziv on 1/30/12.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#include "poObject.h"
#include "poShapeBasics2d.h"
#include "poControl.h"
#include "poTextBox.h"
#include "poDictionary.h"
#include <set>
#include "poLayout.h"
using namespace std;
static const std::string CUI_WINDOW_EVENT = "ui panel value changed";
class poControlPanel : public poObject {
public:
poControlPanel( string _label, poColor _color = poColor( 1,1,1,.2 ), int textSize = 11, string _path = "" );
virtual void update();
virtual void eventHandler(poEvent *event);
virtual void messageHandler(const std::string &msg, const poDictionary& dict=poDictionary());
void addControl( poObject* obj );
void addSliderF( string _ID, float min=0, float max=1, poObject* obj=NULL );
void addKnob( string _ID, float min=0, float max=1, poObject* obj=NULL );
void addSliderI( string _ID, int min=0, int max=255, poObject* obj=NULL );
void addInputTextBox( string _ID, poObject* obj=NULL );
void addPointSlider( string _ID, poPoint min=poPoint(0,0), poPoint max=poPoint(1,1) ,poObject* obj=NULL );
void addColorSlider( string _ID, bool RGB=true ,poObject* obj=NULL );
void addRadio( string _ID , vector<string> names, poObject* obj=NULL );
void addButton( string _ID , poObject* obj=NULL );
void addToggle( string _ID, poObject* obj=NULL );
void autoResize();
void saveSettings();
void readSettings();
void setSavePath( string s );
bool getBool( string s);
int getInt( string s);
float getFloat( string s);
string getString( string s);
poPoint getPoint( string s);
poColor getColor( string s);
void setString( string s, string setString );
void setBool( string s, bool val );
void setInt( string s, int val );
void setFloat( string s, float val );
void setPoint( string s, poPoint val );
poColor panelColor;
poObject* container;
poLayout* containerLayout;
poRectShape* bar;
poRectShape* save;
poRectShape* box;
poRectShape* hide;
poTextBox* hideText;
string label;
string path;
poPoint pos;
int winWidth, winHeight;
bool isDragged;
poPoint prevPoint;
float r,g,b,a;
poDictionary settings;
bool isResized;
};