home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / SLAX 6.0.8 / slax-6.0.8.iso / slax / base / 006-devel.lzm / usr / include / arts / artsgui.idl < prev    next >
Encoding:
Text File  |  2005-09-10  |  11.4 KB  |  397 lines

  1.     /*
  2.  
  3.     Copyright (C) 2000 Stefan Westerfeld
  4.                        stefan@space.twc.de
  5.                   2001, 2002 Matthias Kretz <kretz@kde.org>
  6.                   2003 Arnold Krille <arnold@arnoldarts.de>
  7.  
  8.     This library is free software; you can redistribute it and/or
  9.     modify it under the terms of the GNU Library General Public
  10.     License as published by the Free Software Foundation; either
  11.     version 2 of the License, or (at your option) any later version.
  12.  
  13.     This library is distributed in the hope that it will be useful,
  14.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  15.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16.     Library General Public License for more details.
  17.  
  18.     You should have received a copy of the GNU Library General Public License
  19.     along with this library; see the file COPYING.LIB.  If not, write to
  20.     the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  21.     Boston, MA 02111-1307, USA.
  22.  
  23.     */
  24.  
  25. /*
  26.  * DISCLAIMER: The interfaces in artsgui.idl (and the derived .cc/.h files)
  27.  *             DO NOT GUARANTEE BINARY COMPATIBILITY YET.
  28.  *
  29.  * They are intended for developers. You shouldn't expect that applications in
  30.  * binary form will be fully compatibile with further releases of these
  31.  * interfaces.
  32.  */
  33.  
  34. module Arts {
  35.     // MayGrow = 1,
  36.     // ExpMask = 2,
  37.     // MayShrink = 4
  38.     enum SizePolicy {
  39.         spFixed = 0,
  40.         spMinimum = 1,
  41.         spMaximum = 4,
  42.         spPreferred = 5,
  43.         spMinimumExpanding = 3,
  44.         spExpanding = 7,
  45.         spIgnored = 2
  46.     };
  47.  
  48.     interface Widget {
  49.         readonly attribute long widgetID;
  50.  
  51.         attribute Widget parent;
  52.         attribute long x,y,width,height;
  53.         attribute boolean visible;
  54.         attribute SizePolicy hSizePolicy;
  55.         attribute SizePolicy vSizePolicy;
  56.  
  57.         void show();
  58.         void hide();
  59.     };
  60.  
  61.     enum Shape {
  62.         NoFrame = 0,
  63.         Box = 0x0001,
  64.         Panel = 0x0002,
  65.         WinPanel = 0x0003,
  66.         HLine = 0x0004,
  67.         VLine = 0x0005,
  68.         StyledPanel = 0x0006,
  69.         PopupPanel = 0x0007,
  70.         MenuBarPanel = 0x0008,
  71.         ToolBarPanel = 0x0009,
  72.         LineEditPanel = 0x000a,
  73.         TabWidgetPanel = 0x000b,
  74.         MShape = 0x000f
  75.     };
  76.  
  77.     enum Shadow {
  78.         Plain = 0x0010,
  79.         Raised = 0x0020,
  80.         Sunken = 0x0030,
  81.         MShadow = 0x00f0
  82.     };
  83.  
  84.     interface Frame : Widget {
  85.         void constructor( Widget parent );
  86.  
  87.         attribute long margin;
  88.         attribute long linewidth;
  89.         attribute long midlinewidth;
  90.  
  91.         attribute long framestyle;
  92.         attribute Shape frameshape;
  93.         attribute Shadow frameshadow;
  94.     };
  95.  
  96.     /**
  97.         Some alignmentflags used by various widgets.
  98.         Taken from Qt. (akrille)
  99.         */
  100.     enum Align {
  101.         AlignAuto=0,
  102.         AlignLeft=1,
  103.         AlignRight=2,
  104.         AlignHCenter=4,
  105.         AlignJustify=8,
  106.         AlignTop=16,
  107.         AlignBottom=32,
  108.         AlignVCenter=64,
  109.         AlignCenter=68
  110.     };
  111.  
  112.     /**
  113.         Directions. From Qt. (akrille)
  114.     */
  115.     enum Direction { LeftToRight, RightToLeft, TopToBottom, BottomToTop };
  116.  
  117.     /** The LayoutBox. - Arrange your widgets vertical or horizontal.
  118.  
  119.         Usage is quite simple: Add the widgets you have in the right order
  120.         to the layoutbox by calling addWidget().
  121.         Thats it, no ._addChild or .parent with this widget.
  122.  
  123.         For more information see QBoxLayout.
  124.         (akrille)
  125.         */
  126.     interface LayoutBox : Frame {
  127.         /// Sets the direction of the widgets. Can be changed on-the-fly.
  128.         attribute Direction direction;
  129.         /// Adds a widget with the stretch-factor and the alignment.
  130.         void addWidget( Widget widget, long stretch, long align );
  131.         void addWidget( Widget widget, long stretch );
  132.         void addWidget( Widget widget );
  133.         /// Inserts the Widget at the given position
  134.         void insertWidget( long position, Widget widget, long stretch, long align );
  135.         void insertWidget( long position, Widget widget, long stretch );
  136.         void insertWidget( long position, Widget widget );
  137.         /// Adds a stretch with stretch-factor.
  138.         void addStretch( long stretch );
  139.         void addStretch();
  140.         /// Adds a Spacer the given width or height according your direction.
  141.         void addSpace( long space );
  142.         /** [From QBoxLayout]
  143.             Limits the perpendicular dimension of the box (e.g. height if the
  144.             box is LeftToRight) to a minimum of size. Other constraints may
  145.             increase the limit.
  146.         */
  147.         void addStrut( long size );
  148.         /// Adds a separator (a horizontal/vertical line)
  149.         void addSeparator(long stretch, long align);
  150.         void addSeparator(long stretch);
  151.         void addSeparator();
  152.         /// Adds a line with width and space left/right (top/bottom)
  153.         void addLine(long width, long space, long stretch, long align);
  154.         void addLine(long width, long space, long stretch);
  155.         void addLine(long width, long space);
  156.         /// The spacing between all widgets.
  157.         attribute long spacing;
  158.         /// The margin at the outsideborder.
  159.         attribute long layoutmargin;
  160.     };
  161.  
  162.     /** IMHO (akrille) this should be removed and everywhere replaced with the LayoutBox... */
  163.     interface HBox : Frame {
  164.         attribute long spacing;
  165.     };
  166.  
  167.     interface VBox : Frame {
  168.         attribute long spacing;
  169.     };
  170.  
  171.     /** The PopupBox. - It can hide the widgets inside or show them as an own window.
  172.  
  173.         Usage is quite simple: Create the Widget you want to be hidable inside
  174.         a container like LayoutBox or a normal widget. Then create the PopupBox
  175.         and call <Name_of_PopupBox>.widget( <Name_of_your_Container> ).
  176.         Thats it, no ._addChild or .parent with this widget.
  177.         (akrille)
  178.         */
  179.     interface PopupBox : Frame {
  180.         /// The direction of the PopupBox.
  181.         attribute Direction direction;
  182.         /// The name of the box, this gets shown inside the titlebar if its not inside but an own toplevel-widget.
  183.         attribute string name;
  184.         /// Sets the widget that is shown/hidden.
  185.         attribute Widget widget;
  186.     };
  187.  
  188.     interface Button : Widget {
  189.         void constructor( Widget parent );
  190.         void constructor( string text, Widget parent );
  191.  
  192.         attribute string text;
  193.         attribute boolean toggle;
  194.         readonly attribute boolean pressed;
  195.         readonly attribute boolean clicked; //clicked( true ) is emitted whenever the button
  196.                                             //is pressed an released with the mouse cursor
  197.                                             //still above the button
  198.     };
  199.  
  200.     interface Poti : Frame {
  201.         attribute string caption, color;
  202.         attribute float min, max, value;
  203.         attribute float logarithmic;
  204.         attribute long range;
  205.     };
  206.  
  207.     interface Fader : Widget {
  208.         void constructor( Widget parent );
  209.  
  210.         attribute string caption, color;
  211.         attribute float min, max, value;
  212.         attribute float logarithmic;
  213.     };
  214.  
  215.     interface LineEdit : Widget {
  216.         void constructor( Widget parent );
  217.  
  218.         attribute string caption;
  219.         attribute string text;
  220.     };
  221.  
  222.     interface SpinBox : Widget {
  223.         void constructor( Widget parent );
  224.  
  225.         attribute string caption;
  226.         attribute long min, max, value;
  227.     };
  228.  
  229.     interface ComboBox : Widget {
  230.         void constructor( Widget parent );
  231.  
  232.         attribute string caption;
  233.         attribute sequence<string> choices;
  234.         attribute string value;
  235.     };
  236.  
  237.     interface Graph : Widget {
  238.         void constructor( Widget parent );
  239.  
  240.         attribute string caption;
  241.         attribute float minx, maxx, miny, maxy;
  242.     };
  243.  
  244.     struct GraphPoint {
  245.         float x, y;
  246.     };
  247.     interface GraphLine {
  248.         attribute Graph graph;
  249.         attribute boolean editable;
  250.         attribute string color;
  251.         attribute sequence<GraphPoint> points;
  252.     };
  253.  
  254.     enum TextBottom { South, North, West, East };
  255.  
  256.     interface Label : Frame {
  257.         /// The text to show.
  258.         attribute string text;
  259.         /// The alignment of the text. See enum Align
  260.         attribute long align;
  261.         /// Fontsize [pixel]
  262.         /*writeonly*/ attribute long fontsize;
  263.         /// Fontfamily
  264.         /*writeonly*/ attribute string fontfamily;
  265.         /// Direction of the text in normal L-R-mode. Is used to rotate the text accordingly.
  266.         attribute TextBottom bottom;
  267.     };
  268.  
  269. /// Some Notes:
  270. //   - The calculation of the peak is very easy, but it can be changed without changing all styles..
  271.  
  272.     /** * Styles for the LevelMeter. *
  273.         In Detail:
  274.             - lmNormalBars: <count> colored Bars.
  275.             - lmFireBars: One Bar moving up and down.
  276.             - lmLineBars: One Bar moving up and down, color depends on the invalue.
  277.                 substyle:
  278.                     - 0: various colors
  279.                     - 1: one color (blue) with clipping (red). The old aRtsControl style.
  280.             - lmLEDs: <count> but not more than [height|width]/15 LEDs. (not yet implemented)
  281.                 So minimum size of the LED's is 15 pixel.
  282.                 substyle (first tree belong together others are to be or'ed):
  283.                     - 1: Flat
  284.                     - 2: Raised
  285.                     - 3: Sunken
  286.                     - 4: Circular (otherwise Rectangular)
  287.                     - 8: SingleColor (otherwise in colors green/yellow/red)
  288.             - lmAnalog: An old-style analog VU-Meter. (not yet implemented)
  289.             - lmSmall: One Bar with the color depending on the invalue.
  290.      */
  291.     enum LevelMeterStyle { lmNormalBars, lmFireBars, lmLineBars, lmLEDs, lmAnalog, lmSmall };
  292.  
  293.     /**
  294.         One LevelMeter
  295.     */
  296.     interface LevelMeter : Frame {
  297.         /**
  298.             The Style of the LevelMeter.
  299.         */
  300.         attribute LevelMeterStyle style;
  301.         /**
  302.             A substyle. Is different on every style;-)
  303.         */
  304.         attribute long substyle;
  305.         /**
  306.             How many Bars/LEDs it should have. If the size is smaller than
  307.             this count it will have only that many Bars. So set Count to something
  308.             very high for smooth vu-meters.
  309.             Note: not every Style will honor this.
  310.             Note2: Perhaps this could be integrated into substyle.
  311.         */
  312.         attribute long count;
  313.         /**
  314.             Sets the peakfalloff. Set to 0 to deactivate peaks.
  315.             Is used for weighting the average.
  316.             Peak is evaluated: ( peakfalloff * oldpeak + invalue ) / ( peakfalloff + 1 )
  317.         */
  318.         attribute long peakfalloff;
  319.         /**
  320.             Minimum and minimum dB for the LevelMeter.
  321.             Maximum should always be 0dB.
  322.         */
  323.         attribute float mindB, maxdB;
  324.         /**
  325.             The incomming signal...
  326.             This attribute always returns 0.0, altough it processes all its input.
  327.         */
  328.         /*writeonly*/ attribute float invalue;
  329.         /**
  330.             The Direction of the levelmeter from null-value to highest value.
  331.         */
  332.         attribute Direction direction;
  333.     };
  334.  
  335.     /// Some positions.
  336.     enum Position { posLeft=0x0001, posRight=0x0002, posTop=0x0004, posBottom=0x0008 };
  337.  
  338.     /// Tickmarks for LevelMeter / Fader / etc.
  339.     interface Tickmarks : Frame {
  340.         void constructor( float min, float max, Direction dir, long pos );
  341.         /// Minimum/Maximum shown value.
  342.         attribute float min, max;
  343.         /// The minimal stepsize for numbers, and substep for smaller marks.
  344.         attribute float minstep, substep;
  345.         /// Direction from min to max.
  346.         attribute Direction direction;
  347.         /**
  348.          * The position of the levelmeter/fader/etc which gets the marks.
  349.          * Only Left/Right are needed. As if direction is Up/Down...
  350.          * For stereotickmarks set this to posLeft|posRight.
  351.         */
  352.         attribute long position;
  353.     };
  354.  
  355.     /// A Fader specially for volumes
  356.     //     Maybe something can be ported to the normal Fader.
  357.     interface VolumeFader : Frame {
  358.         void constructor( float dbmin, float dbmax, Direction dir );
  359.         /// Minimum/Maximum values in dB
  360.         attribute float dbmin, dbmax;
  361.         /// Direction from min to max
  362.         attribute Direction direction;
  363.         /**
  364.          *The actual volume (calling this value only changes the gui and not the
  365.          * underlying/connected objects ie. doesn't send a change notification.)
  366.          */
  367.         attribute float volume;
  368.         /// The actual volume in dB (no change notification)
  369.         attribute float dbvolume;
  370.     };
  371.  
  372.     /**
  373.      * A gui factory is an object that can create a Widget which provides a
  374.      * user interface for a running object (for instance, you might have an
  375.      * effect running somewhere, and a gui factory 
  376.      *
  377.      * TODO: do we need another argument (or other arguments) to specify
  378.      * style or other parameters?
  379.      */
  380.     interface GuiFactory {
  381.         Widget createGui(object runningObject);
  382.     };
  383.  
  384.     /**
  385.      * Convenience gui factory, which knows how and whether to
  386.      *
  387.      *  - build a gui out of hints?
  388.      *  - create an artsbuilder built gui?
  389.      *  - create a gui composed of other widgets?
  390.      *  - create a completely custom gui?
  391.      */
  392.     interface GenericGuiFactory : GuiFactory {
  393.     };
  394. };
  395.  
  396. // vim: sw=4 ts=4
  397.