00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef CONTROL_H_
00025 #define CONTROL_H_
00026
00027 #include <string>
00028 #include <list>
00029
00030 #include "avcap-export.h"
00031 #include "Interval.h"
00032
00033 namespace avcap {
00034
00035 class DeviceDescriptor;
00036
00038
00046 class AVCAP_Export Control
00047 {
00048 public:
00049 enum Type {
00050 INTEGER_CONTROL = 0,
00051 BOOL_CONTROL,
00052 BUTTON_CONTROL,
00053 MENU_CONTROL,
00054 CTRLCLASS_CONTROL,
00055 USERDEFINED_CONTROL
00056 };
00057
00058 private:
00059 Type mType;
00060
00061 public:
00063 Control(Type t): mType(t)
00064 {}
00065
00067 virtual ~Control()
00068 {}
00069
00071
00072 virtual int getId() const = 0;
00073
00075
00076 virtual int getDefaultValue() const = 0;
00077
00079
00080 virtual const std::string& getName() const = 0;
00081
00083
00085 virtual int setValue(int val) = 0;
00086
00088
00089 virtual int getValue() const = 0;
00090
00092
00093 virtual int reset() = 0;
00094
00096
00097 virtual inline Type getType() const
00098 { return mType; }
00099
00100 private:
00101 Control()
00102 {}
00103 };
00104
00106
00108 class AVCAP_Export IntegerControl: public Control
00109 {
00110 public:
00111 IntegerControl(): Control(Control::INTEGER_CONTROL)
00112 {}
00113
00114 virtual ~IntegerControl()
00115 {}
00116
00118
00119 virtual const Interval& getInterval() const = 0;
00120 };
00121
00123
00125 class AVCAP_Export BoolControl: public Control
00126 {
00127 public:
00128 BoolControl(): Control(Control::BOOL_CONTROL)
00129 {}
00130
00131 virtual ~BoolControl()
00132 {}
00133 };
00134
00136
00138 class AVCAP_Export ButtonControl: public Control
00139 {
00140 public:
00141 ButtonControl(): Control(Control::BUTTON_CONTROL)
00142 {}
00143
00144 virtual ~ButtonControl()
00145 {}
00146
00148
00149 virtual int push() = 0;
00150 };
00151
00153
00157 class AVCAP_Export CtrlClassControl: public Control
00158 {
00159 public:
00160 CtrlClassControl(): Control(Control::CTRLCLASS_CONTROL)
00161 {}
00162
00163 virtual ~CtrlClassControl()
00164 {}
00165 };
00166
00167
00169 struct MenuItem
00170 {
00172 std::string name;
00173
00175 int index;
00176
00177 public:
00179 inline MenuItem(const std::string& n, int i):
00180 name(n), index(i)
00181 {}
00182 };
00183
00185
00187 class AVCAP_Export MenuControl: public Control
00188 {
00189 public:
00191 typedef std::list<MenuItem*> ItemList;
00192
00193 public:
00194 MenuControl(): Control(Control::MENU_CONTROL)
00195 {}
00196
00197 virtual ~MenuControl()
00198 {}
00199
00201
00202 virtual const ItemList& getItemList () = 0;
00203 };
00204 }
00205
00206 #endif // CONTROL_H_