summaryrefslogtreecommitdiffstats
path: root/arts/gui/common/artsgui.idl
blob: 2cf5b614910378e9b9f7fb9289f11ae423c2bef5 (plain)
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
    /*

    Copyright (C) 2000 Stefan Westerfeld
                       stefan@space.twc.de
                  2001, 2002 Matthias Kretz <kretz@kde.org>
                  2003 Arnold Krille <arnold@arnoldarts.de>

    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
    License as published by the Free Software Foundation; either
    version 2 of the License, or (at your option) any later version.

    This library 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
    Library General Public License for more details.

    You should have received a copy of the GNU Library General Public License
    along with this library; see the file COPYING.LIB.  If not, write to
    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
    Boston, MA 02110-1301, USA.

    */

/*
 * DISCLAIMER: The interfaces in artsgui.idl (and the derived .cc/.h files)
 *             DO NOT GUARANTEE BINARY COMPATIBILITY YET.
 *
 * They are intended for developers. You shouldn't expect that applications in
 * binary form will be fully compatibile with further releases of these
 * interfaces.
 */

module Arts {
	// MayGrow = 1,
	// ExpMask = 2,
	// MayShrink = 4
	enum SizePolicy {
		spFixed = 0,
		spMinimum = 1,
		spMaximum = 4,
		spPreferred = 5,
		spMinimumExpanding = 3,
		spExpanding = 7,
		spIgnored = 2
	};

	interface Widget {
		readonly attribute long widgetID;

		attribute Widget tqparent;
		attribute long x,y,width,height;
		attribute boolean visible;
		attribute SizePolicy hSizePolicy;
		attribute SizePolicy vSizePolicy;

		void show();
		void hide();
	};

	enum Shape {
		NoFrame = 0,
		Box = 0x0001,
		Panel = 0x0002,
		WinPanel = 0x0003,
		HLine = 0x0004,
		VLine = 0x0005,
		StyledPanel = 0x0006,
		PopupPanel = 0x0007,
		MenuBarPanel = 0x0008,
		ToolBarPanel = 0x0009,
		LineEditPanel = 0x000a,
		TabWidgetPanel = 0x000b,
		MShape = 0x000f
	};

	enum Shadow {
		Plain = 0x0010,
		Raised = 0x0020,
		Sunken = 0x0030,
		MShadow = 0x00f0
	};

	interface Frame : Widget {
		void constructor( Widget tqparent );

		attribute long margin;
		attribute long linewidth;
		attribute long midlinewidth;

		attribute long framestyle;
		attribute Shape frametqshape;
		attribute Shadow frameshadow;
	};

	/**
		Some tqalignmentflags used by various widgets.
		Taken from Qt. (akrille)
		*/
	enum Align {
		AlignAuto=0,
		AlignLeft=1,
		AlignRight=2,
		AlignHCenter=4,
		AlignJustify=8,
		AlignTop=16,
		AlignBottom=32,
		AlignVCenter=64,
		AlignCenter=68
	};

	/**
		Directions. From Qt. (akrille)
	*/
	enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop };

	/** The LayoutBox. - Arrange your widgets vertical or horizontal.

		Usage is quite simple: Add the widgets you have in the right order
		to the tqlayoutbox by calling addWidget().
		Thats it, no ._addChild or .tqparent with this widget.

		For more information see QBoxLayout.
		(akrille)
		*/
	interface LayoutBox : Frame {
		/// Sets the direction of the widgets. Can be changed on-the-fly.
		attribute Direction direction;
		/// Adds a widget with the stretch-factor and the tqalignment.
		void addWidget( Widget widget, long stretch, long align );
		void addWidget( Widget widget, long stretch );
		void addWidget( Widget widget );
		/// Inserts the Widget at the given position
		void insertWidget( long position, Widget widget, long stretch, long align );
		void insertWidget( long position, Widget widget, long stretch );
		void insertWidget( long position, Widget widget );
		/// Adds a stretch with stretch-factor.
		void addStretch( long stretch );
		void addStretch();
		/// Adds a Spacer the given width or height according your direction.
		void addSpace( long space );
		/** [From QBoxLayout]
		    Limits the perpendicular dimension of the box (e.g. height if the
		    box is LeftToRight) to a minimum of size. Other constraints may
		    increase the limit.
		*/
		void addStrut( long size );
		/// Adds a separator (a horizontal/vertical line)
		void addSeparator(long stretch, long align);
		void addSeparator(long stretch);
		void addSeparator();
		/// Adds a line with width and space left/right (top/bottom)
		void addLine(long width, long space, long stretch, long align);
		void addLine(long width, long space, long stretch);
		void addLine(long width, long space);
		/// The spacing between all widgets.
		attribute long spacing;
		/// The margin at the outsideborder.
		attribute long tqlayoutmargin;
	};

	/** IMHO (akrille) this should be removed and everywhere replaced with the LayoutBox... */
	interface HBox : Frame {
		attribute long spacing;
	};

	interface VBox : Frame {
		attribute long spacing;
	};

	/** The PopupBox. - It can hide the widgets inside or show them as an own window.

		Usage is quite simple: Create the Widget you want to be hidable inside
		a container like LayoutBox or a normal widget. Then create the PopupBox
		and call <Name_of_PopupBox>.widget( <Name_of_your_Container> ).
		Thats it, no ._addChild or .tqparent with this widget.
		(akrille)
		*/
	interface PopupBox : Frame {
		/// The direction of the PopupBox.
		attribute Direction direction;
		/// The name of the box, this gets shown inside the titlebar if its not inside but an own toplevel-widget.
		attribute string name;
		/// Sets the widget that is shown/hidden.
		attribute Widget widget;
	};

	interface Button : Widget {
		void constructor( Widget tqparent );
		void constructor( string text, Widget tqparent );

		attribute string text;
		attribute boolean toggle;
		readonly attribute boolean pressed;
		readonly attribute boolean clicked; //clicked( true ) is emitted whenever the button
		                                    //is pressed an released with the mouse cursor
		                                    //still above the button
	};

	interface Poti : Frame {
		attribute string caption, color;
		attribute float min, max, value;
		attribute float logarithmic;
		attribute long range;
	};

	interface Fader : Widget {
		void constructor( Widget tqparent );

		attribute string caption, color;
		attribute float min, max, value;
		attribute float logarithmic;
	};

	interface LineEdit : Widget {
		void constructor( Widget tqparent );

		attribute string caption;
		attribute string text;
	};

	interface SpinBox : Widget {
		void constructor( Widget tqparent );

		attribute string caption;
		attribute long min, max, value;
	};

	interface ComboBox : Widget {
		void constructor( Widget tqparent );

		attribute string caption;
		attribute sequence<string> choices;
		attribute string value;
	};

	interface Graph : Widget {
		void constructor( Widget tqparent );

		attribute string caption;
		attribute float minx, maxx, miny, maxy;
	};

	struct GraphPoint {
		float x, y;
	};
	interface GraphLine {
		attribute Graph graph;
		attribute boolean editable;
		attribute string color;
		attribute sequence<GraphPoint> points;
	};

	enum TextBottom { South, North, West, East };

	interface Label : Frame {
		/// The text to show.
		attribute string text;
		/// The tqalignment of the text. See enum Align
		attribute long align;
		/// Fontsize [pixel]
		/*writeonly*/ attribute long fontsize;
		/// Fontfamily
		/*writeonly*/ attribute string fontfamily;
		/// Direction of the text in normal L-R-mode. Is used to rotate the text accordingly.
		attribute TextBottom bottom;
	};

/// Some Notes:
//   - The calculation of the peak is very easy, but it can be changed without changing all styles..

	/** * Styles for the LevelMeter. *
		In Detail:
			- lmNormalBars: <count> colored Bars.
			- lmFireBars: One Bar moving up and down.
			- lmLineBars: One Bar moving up and down, color depends on the invalue.
				substyle:
					- 0: various colors
					- 1: one color (blue) with clipping (red). The old aRtsControl style.
			- lmLEDs: <count> but not more than [height|width]/15 LEDs. (not yet implemented)
				So minimum size of the LED's is 15 pixel.
				substyle (first tree belong together others are to be or'ed):
					- 1: Flat
					- 2: Raised
					- 3: Sunken
					- 4: Circular (otherwise Rectangular)
					- 8: SingleColor (otherwise in colors green/yellow/red)
			- lmAnalog: An old-style analog VU-Meter. (not yet implemented)
			- lmSmall: One Bar with the color depending on the invalue.
	 */
	enum LevelMeterStyle { lmNormalBars, lmFireBars, lmLineBars, lmLEDs, lmAnalog, lmSmall };

	/**
		One LevelMeter
	*/
	interface LevelMeter : Frame {
		/**
			The Style of the LevelMeter.
		*/
		attribute LevelMeterStyle style;
		/**
			A substyle. Is different on every style;-)
		*/
		attribute long substyle;
		/**
			How many Bars/LEDs it should have. If the size is smaller than
			this count it will have only that many Bars. So set Count to something
			very high for smooth vu-meters.
			Note: not every Style will honor this.
			Note2: Perhaps this could be integrated into substyle.
		*/
		attribute long count;
		/**
			Sets the peakfalloff. Set to 0 to deactivate peaks.
			Is used for weighting the average.
			Peak is evaluated: ( peakfalloff * oldpeak + invalue ) / ( peakfalloff + 1 )
		*/
		attribute long peakfalloff;
		/**
			Minimum and minimum dB for the LevelMeter.
			Maximum should always be 0dB.
		*/
		attribute float mindB, maxdB;
		/**
			The incomming signal...
			This attribute always returns 0.0, altough it processes all its input.
		*/
		/*writeonly*/ attribute float invalue;
		/**
			The Direction of the levelmeter from null-value to highest value.
		*/
		attribute Direction direction;
	};

	/// Some positions.
	enum Position { posLeft=0x0001, posRight=0x0002, posTop=0x0004, posBottom=0x0008 };

	/// Tickmarks for LevelMeter / Fader / etc.
	interface Tickmarks : Frame {
		void constructor( float min, float max, Direction dir, long pos );
		/// Minimum/Maximum shown value.
		attribute float min, max;
		/// The minimal stepsize for numbers, and substep for smaller marks.
		attribute float minstep, substep;
		/// Direction from min to max.
		attribute Direction direction;
		/**
		 * The position of the levelmeter/fader/etc which gets the marks.
		 * Only Left/Right are needed. As if direction is Up/Down...
		 * For stereotickmarks set this to posLeft|posRight.
		*/
		attribute long position;
	};

	/// A Fader specially for volumes
	//     Maybe something can be ported to the normal Fader.
	interface VolumeFader : Frame {
		void constructor( float dbmin, float dbmax, Direction dir );
		/// Minimum/Maximum values in dB
		attribute float dbmin, dbmax;
		/// Direction from min to max
		attribute Direction direction;
		/**
		 *The actual volume (calling this value only changes the gui and not the
		 * underlying/connected objects ie. doesn't send a change notification.)
		 */
		attribute float volume;
		/// The actual volume in dB (no change notification)
		attribute float dbvolume;
	};

	/**
	 * A gui factory is an object that can create a Widget which provides a
	 * user interface for a running object (for instance, you might have an
	 * effect running somewhere, and a gui factory 
	 *
	 * TODO: do we need another argument (or other arguments) to specify
	 * style or other parameters?
	 */
	interface GuiFactory {
		Widget createGui(object runningObject);
	};

	/**
	 * Convenience gui factory, which knows how and whether to
	 *
	 *  - build a gui out of hints?
	 *  - create an artsbuilder built gui?
	 *  - create a gui composed of other widgets?
	 *  - create a completely custom gui?
	 */
	interface GenericGuiFactory : GuiFactory {
	};
};

// vim: sw=4 ts=4