TuttleOFX  1
ofxInteract.h
Go to the documentation of this file.
00001 #ifndef _ofxInteract_h_
00002 #define _ofxInteract_h_
00003 
00004 #include "ofxCore.h"
00005 
00006 /*
00007  * Software License :
00008  *
00009  * Copyright (c) 2007-2009, The Open Effects Association Ltd. All rights reserved.
00010  *
00011  * Redistribution and use in source and binary forms, with or without
00012  * modification, are permitted provided that the following conditions are met:
00013  *
00014  * Redistributions of source code must retain the above copyright notice,
00015  *    this list of conditions and the following disclaimer.
00016  * Redistributions in binary form must reproduce the above copyright notice,
00017  *    this list of conditions and the following disclaimer in the documentation
00018  *    and/or other materials provided with the distribution.
00019  * Neither the name The Open Effects Association Ltd, nor the names of its
00020  *    contributors may be used to endorse or promote products derived from this
00021  *    software without specific prior written permission.
00022  *
00023  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
00024  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00025  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00026  * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
00027  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00028  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00029  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
00030  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00031  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00032  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00033  */
00034 
00035 #ifdef __cplusplus
00036 extern "C" {
00037 #endif
00038 
00039 /** @file ofxInteract.h
00040  * Contains the API for ofx plugin defined GUIs and interaction.
00041  */
00042 
00043 #define kOfxInteractSuite "OfxInteractSuite"
00044 
00045 
00046 /** @brief Blind declaration of an OFX interactive gui
00047  */
00048 typedef struct OfxInteract* OfxInteractHandle;
00049 
00050 /**
00051  * \addtogroup PropertiesAll
00052  */
00053 /*@{*/
00054 /**
00055  * \defgroup PropertiesInteract Interact Property Definitions
00056  *
00057  * These are the list of properties used by the Interact API documented in \ref CustomInteractionPage.
00058  */
00059 /*@{*/
00060 /** @brief The set of parameters on which a value change will trigger a redraw for an interact.
00061  *
00062  * - Type - string X N
00063  * - Property Set - interact instance property (read/write)
00064  * - Default - no values set
00065  * - Valid Values - the name of any parameter associated with this interact.
00066  *
00067  * If the interact is representing the state of some set of OFX parameters, then is will
00068  * need to be redrawn if any of those parameters' values change. This multi-dimensional property
00069  * links such parameters to the interact.
00070  *
00071  * The interact can be slaved to multiple parameters (setting index 0, then index 1 etc...)
00072  */
00073 #define kOfxInteractPropSlaveToParam "OfxInteractPropSlaveToParam"
00074 
00075 /** @brief The size of a real screen pixel under the interact's cannonical projection.
00076  *
00077  * - Type - double X 2
00078  * - Property Set - interact instance and actions (read only)
00079  *
00080  */
00081 #define kOfxInteractPropPixelScale "OfxInteractPropPixelScale"
00082 
00083 /** @brief The size of an interact's openGL viewport
00084  *
00085  *  - Type - int X 2
00086  *  - Property Set - read only property on the interact instance and in argument to all the interact actions.
00087  *
00088  * This property is the redundant and its use will be deprecated in future releases.
00089  */
00090 #define kOfxInteractPropViewportSize "OfxInteractPropViewport"
00091 
00092 /** @brief The background colour of the application behind an interact instance
00093  *
00094  *  - Type - double X 3
00095  *  - Property Set - read only on the interact instance and in argument to the ::kOfxInteractActionDraw action
00096  *  - Valid Values - from 0 to 1
00097  *
00098  * The components are in the order red, green then blue.
00099  *
00100  */
00101 #define kOfxInteractPropBackgroundColour "OfxInteractPropBackgroundColour"
00102 
00103 /** @brief The suggested colour to draw a widget in an interact, typically for overlays.
00104  *
00105  *  - Type - double X 3
00106  *  - Property Set - read only on the interact instance
00107  *  - Default - 1.0
00108  *  - Valid Values - greater than or equal to 0.0
00109  *
00110  * Some applications allow the user to specify colours of any overlay via a colour picker, this
00111  * property represents the value of that colour. Plugins are at liberty to use this or not when
00112  * they draw an overlay.
00113  * 
00114  * If a host does not support such a colour, it should return kOfxStatReplyDefault
00115  */
00116 #define kOfxInteractPropSuggestedColour "OfxInteractPropSuggestedColour"
00117 
00118 /** @brief The position of the pen in an interact.
00119  *
00120  * - Type - double X 2
00121  * - Property Set - read only in argument to the ::kOfxInteractActionPenMotion, ::kOfxInteractActionPenDown and ::kOfxInteractActionPenUp actions
00122  *
00123  * This value passes the postion of the pen into an interact. This is in the interact's canonical coordinates.
00124  */
00125 #define kOfxInteractPropPenPosition "OfxInteractPropPenPosition"
00126 
00127 /** @brief The position of the pen in an interact in viewport coordinates.
00128  *
00129  * - Type - int X 2
00130  * - Property Set - read only in argument to the ::kOfxInteractActionPenMotion, ::kOfxInteractActionPenDown and ::kOfxInteractActionPenUp actions
00131  *
00132  * This value passes the postion of the pen into an interact. This is in the interact's openGL viewport coordinates, with 0,0 being at the bottom left.
00133  */
00134 #define kOfxInteractPropPenViewportPosition "OfxInteractPropPenViewportPosition"
00135 
00136 /** @brief The pressure of the pen in an interact.
00137  *
00138  * - Type - double X 1
00139  * - Property Set - read only in argument to the ::kOfxInteractActionPenMotion, ::kOfxInteractActionPenDown and ::kOfxInteractActionPenUp actions
00140  * - Valid Values - from 0 (no pressure) to 1 (maximum pressure)
00141  *
00142  * This is used to indicate the status of the 'pen' in an interact. If a pen has only two states (eg: a mouse button), these should map to 0.0 and 1.0.
00143  */
00144 #define kOfxInteractPropPenPressure "OfxInteractPropPenPressure"
00145 
00146 /** @brief Indicates whether the dits per component in the interact's openGL frame buffer
00147  *
00148  * - Type - int X 1
00149  * - Property Set - interact instance and descriptor (read only)
00150  *
00151  */
00152 #define kOfxInteractPropBitDepth "OfxInteractPropBitDepth"
00153 
00154 /** @brief Indicates whether the interact's frame buffer has an alpha component or not
00155  *
00156  * - Type - int X 1
00157  * - Property Set - interact instance and descriptor (read only)
00158  * - Valid Values - This must be one of
00159  *     - 0 indicates no alpha component
00160  *     - 1 indicates an alpha component
00161  */
00162 #define kOfxInteractPropHasAlpha "OfxInteractPropHasAlpha"
00163 
00164 /*@}*/
00165 /*@}*/
00166 
00167 /**
00168  * \addtogroup ActionsAll
00169  */
00170 /*@{*/
00171 /**
00172  * \defgroup InteractActions Intereact Actions
00173  *
00174  * These are the list of actions passed to an interacts' entry point function. For more details on how to deal with actions, see \ref InteractActions.
00175  */
00176 /*@{*/
00177 
00178 /** @brief Action passed to interacts telling it to redraw, see \ref InteractsActionDraw for more details */
00179 #define kOfxInteractActionDraw "OfxInteractActionDraw"
00180 
00181 /** @brief Action passed to interacts for an interact pen motion , see \ref InteractsActionPen for more details
00182  */
00183 #define kOfxInteractActionPenMotion "OfxInteractActionPenMotion"
00184 
00185 /**@brief Action passed to interacts for a pen down , see \ref InteractsActionPen for more details
00186  */
00187 #define kOfxInteractActionPenDown   "OfxInteractActionPenDown"
00188 
00189 /**@brief Action passed to interacts for a pen up, see \ref InteractsActionPen for more details
00190  */
00191 #define kOfxInteractActionPenUp     "OfxInteractActionPenUp"
00192 
00193 /**@brief Action passed to interacts for a key down, see \ref InteractsActionKey for more details
00194  */
00195 #define kOfxInteractActionKeyDown   "OfxInteractActionKeyDown"
00196 
00197 /**@brief Action passed to interacts for a key down, see \ref InteractsActionKey for more details
00198  *
00199  */
00200 #define kOfxInteractActionKeyUp     "OfxInteractActionKeyUp"
00201 
00202 /**@brief Action passed to interacts for a key repeat , see \ref InteractsActionKey for more details
00203  *
00204  */
00205 #define kOfxInteractActionKeyRepeat     "OfxInteractActionKeyRepeat"
00206 
00207 /**@brief Action passed to interacts for a gain of input focus, see \ref InteractsActionFocus for more details
00208  */
00209 #define kOfxInteractActionGainFocus "OfxInteractActionGainFocus"
00210 
00211 /**@brief Action passed to interacts for a loss of input focus, see \ref InteractsActionFocus for more details
00212  */
00213 #define kOfxInteractActionLoseFocus "OfxInteractActionLoseFocus"
00214 
00215 /*@}*/
00216 /*@}*/
00217 
00218 /** @brief OFX suite that allows an effect to interact with an openGL window so as to provide custom interfaces.
00219  *
00220  */
00221 typedef struct OfxInteractSuiteV1
00222 {
00223         /** @brief Requests an openGL buffer swap on the interact instance */
00224         OfxStatus ( *interactSwapBuffers )( OfxInteractHandle interactInstance );
00225 
00226         /** @brief Requests a redraw of the interact instance */
00227         OfxStatus ( *interactRedraw )( OfxInteractHandle interactInstance );
00228 
00229         /** @brief Gets the property set handle for this interact handle */
00230         OfxStatus ( *interactGetPropertySet )( OfxInteractHandle     interactInstance,
00231                                                OfxPropertySetHandle* property );
00232 } OfxInteractSuiteV1;
00233 
00234 #ifdef __cplusplus
00235 }
00236 #endif
00237 
00238 #endif