File: CommonParameterInterface.h

package info (click to toggle)
bullet 2.83.7%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 48,772 kB
  • sloc: cpp: 355,312; lisp: 12,087; ansic: 11,969; python: 644; makefile: 116; xml: 27
file content (89 lines) | stat: -rw-r--r-- 1,817 bytes parent folder | download
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

#ifndef PARAM_INTERFACE_H
#define PARAM_INTERFACE_H

#pragma once

typedef void (*SliderParamChangedCallback) (float newVal);
#include "LinearMath/btScalar.h"

struct SliderParams
{
	const char* m_name;
	float m_minVal;
	float m_maxVal;
	SliderParamChangedCallback m_callback;
	btScalar* m_paramValuePointer;
	void* m_userPointer;
	bool m_clampToNotches;
    bool m_showValues;
    
	SliderParams(const char* name, btScalar* targetValuePointer)
	:m_name(name),
	m_minVal(-100),
	m_maxVal(100),
	m_callback(0),
	m_paramValuePointer(targetValuePointer),
	m_userPointer(0),
	m_clampToNotches(true),
    m_showValues(true)
	{
	}

};

typedef void (*ButtonParamChangedCallback) (int buttonId, bool buttonState, void* userPointer);
typedef void (*ComboBoxCallback) (int combobox, const char* item, void* userPointer);

struct ButtonParams
{
	const char* m_name;
	int m_buttonId;
	void* m_userPointer;

	ButtonParamChangedCallback m_callback;
	ButtonParams(const char* name, int buttonId, bool isTrigger)
		:m_name(name),
		m_buttonId(buttonId),
		m_userPointer(0),
	m_callback(0)
	{
	}
};

struct ComboBoxParams
{
	int m_comboboxId;
	int m_numItems;
	const char** m_items;
	int m_startItem;
	ComboBoxCallback m_callback;
	void*	m_userPointer;

	ComboBoxParams()
		:m_comboboxId(-1),
		m_numItems(0),
		m_items(0),
		m_startItem(0),
		m_callback(0),
		m_userPointer(0)
	{
	}
};


struct CommonParameterInterface
{

	virtual ~CommonParameterInterface() {}
	virtual void registerSliderFloatParameter(SliderParams& params)=0;
	virtual void registerButtonParameter(ButtonParams& params)=0;
	virtual void registerComboBox(ComboBoxParams& params)=0;

	virtual void syncParameters()=0;
	virtual void removeAllParameters()=0;
    virtual void setSliderValue(int sliderIndex, double sliderValue)=0;

};
	
#endif //PARAM_INTERFACE_H