Browse Source

added BND_EXPORT, OUI_EXPORT for situations where an export

define is needed.
pull/1/head
Leonard Ritter 10 years ago
parent
commit
43fe99cb82
2 changed files with 120 additions and 108 deletions
  1. +51
    -45
      blendish.h
  2. +69
    -63
      oui.h

+ 51
- 45
blendish.h View File

@@ -75,6 +75,12 @@ before including blendish.h, otherwise the file will be in header-only mode.

*/

// you can override this from the outside to pick
// the export level you need
#ifndef BND_EXPORT
#define BND_EXPORT
#endif

// if that typedef is provided elsewhere, you may define
// BLENDISH_NO_NVG_TYPEDEFS before including the header.
#ifndef BLENDISH_NO_NVG_TYPEDEFS
@@ -245,23 +251,23 @@ typedef enum BNDcornerFlags {

// set the current theme all widgets will be drawn with.
// the default Blender 2.6 theme is set by default.
void bndSetTheme(BNDtheme theme);
BND_EXPORT void bndSetTheme(BNDtheme theme);

// Returns the currently set theme
const BNDtheme *bndGetTheme();
BND_EXPORT const BNDtheme *bndGetTheme();

// designates an image handle as returned by nvgCreateImage*() as the themes'
// icon sheet. The icon sheet format must be compatible to Blender 2.6's icon
// sheet; the order of icons does not matter.
// A valid icon sheet is e.g. shown at
// http://wiki.blender.org/index.php/Dev:2.5/Doc/How_to/Add_an_icon
void bndSetIconImage(int image);
BND_EXPORT void bndSetIconImage(int image);

// designates an image handle as returned by nvgCreateFont*() as the themes'
// UI font. Blender's original UI font Droid Sans is perfectly suited and
// available here:
// https://svn.blender.org/svnroot/bf-blender/trunk/blender/release/datafiles/fonts/
void bndSetFont(int font);
BND_EXPORT void bndSetFont(int font);

////////////////////////////////////////////////////////////////////////////////

@@ -273,7 +279,7 @@ void bndSetFont(int font);
// if iconid >= 0, an icon will be added to the widget
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndLabel(NVGcontext *ctx,
BND_EXPORT void bndLabel(NVGcontext *ctx,
float x, float y, float w, float h, int iconid, const char *label);

// Draw a tool button with its lower left origin at (x,y) and size of (w,h),
@@ -282,7 +288,7 @@ void bndLabel(NVGcontext *ctx,
// if iconid >= 0, an icon will be added to the widget
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndToolButton(NVGcontext *ctx,
BND_EXPORT void bndToolButton(NVGcontext *ctx,
float x, float y, float w, float h, int flags, BNDwidgetState state,
int iconid, const char *label);

@@ -292,7 +298,7 @@ void bndToolButton(NVGcontext *ctx,
// if iconid >= 0, an icon will be added to the widget
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndRadioButton(NVGcontext *ctx,
BND_EXPORT void bndRadioButton(NVGcontext *ctx,
float x, float y, float w, float h, int flags, BNDwidgetState state,
int iconid, const char *label);
@@ -305,7 +311,7 @@ void bndRadioButton(NVGcontext *ctx,
// cend must be >= cbegin and <= strlen(text) and denotes the end of the caret
// if cend < cbegin, then no caret will be drawn
// widget looks best when height is BND_WIDGET_HEIGHT
void bndTextField(NVGcontext *ctx,
BND_EXPORT void bndTextField(NVGcontext *ctx,
float x, float y, float w, float h, int flags, BNDwidgetState state,
int iconid, const char *text, int cbegin, int cend);
@@ -314,7 +320,7 @@ void bndTextField(NVGcontext *ctx,
// the widgets current UI state.
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndOptionButton(NVGcontext *ctx,
BND_EXPORT void bndOptionButton(NVGcontext *ctx,
float x, float y, float w, float h, BNDwidgetState state,
const char *label);
@@ -324,7 +330,7 @@ void bndOptionButton(NVGcontext *ctx,
// if iconid >= 0, an icon will be added to the widget
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndChoiceButton(NVGcontext *ctx,
BND_EXPORT void bndChoiceButton(NVGcontext *ctx,
float x, float y, float w, float h, int flags, BNDwidgetState state,
int iconid, const char *label);
@@ -335,7 +341,7 @@ void bndChoiceButton(NVGcontext *ctx,
// if value is not NULL, a value will be added to the widget, along with
// a ":" separator
// widget looks best when height is BND_WIDGET_HEIGHT
void bndNumberField(NVGcontext *ctx,
BND_EXPORT void bndNumberField(NVGcontext *ctx,
float x, float y, float w, float h, int flags, BNDwidgetState state,
const char *label, const char *value);

@@ -347,7 +353,7 @@ void bndNumberField(NVGcontext *ctx,
// if value is not NULL, a value will be added to the widget, along with
// a ":" separator
// widget looks best when height is BND_WIDGET_HEIGHT
void bndSlider(NVGcontext *ctx,
BND_EXPORT void bndSlider(NVGcontext *ctx,
float x, float y, float w, float h, int flags, BNDwidgetState state,
float progress, const char *label, const char *value);

@@ -357,20 +363,20 @@ void bndSlider(NVGcontext *ctx,
// size is in the range 0..1 and controls the size of the scroll handle
// horizontal widget looks best when height is BND_SCROLLBAR_HEIGHT,
// vertical looks best when width is BND_SCROLLBAR_WIDTH
void bndScrollBar(NVGcontext *ctx,
BND_EXPORT void bndScrollBar(NVGcontext *ctx,
float x, float y, float w, float h, BNDwidgetState state,
float offset, float size);
// Draw a menu background with its lower left origin at (x,y) and size of (w,h),
// where flags is one or multiple flags from BNDcornerFlags.
void bndMenuBackground(NVGcontext *ctx,
BND_EXPORT void bndMenuBackground(NVGcontext *ctx,
float x, float y, float w, float h, int flags);

// Draw a menu label with its lower left origin at (x,y) and size of (w,h).
// if iconid >= 0, an icon will be added to the widget
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndMenuLabel(NVGcontext *ctx,
BND_EXPORT void bndMenuLabel(NVGcontext *ctx,
float x, float y, float w, float h, int iconid, const char *label);

// Draw a menu item with its lower left origin at (x,y) and size of (w,h),
@@ -378,15 +384,15 @@ void bndMenuLabel(NVGcontext *ctx,
// if iconid >= 0, an icon will be added to the widget
// if label is not NULL, a label will be added to the widget
// widget looks best when height is BND_WIDGET_HEIGHT
void bndMenuItem(NVGcontext *ctx,
BND_EXPORT void bndMenuItem(NVGcontext *ctx,
float x, float y, float w, float h, BNDwidgetState state,
int iconid, const char *label);

// Draw a tooltip background with its lower left origin at (x,y) and size of (w,h)
void bndTooltipBackground(NVGcontext *ctx, float x, float y, float w, float h);
BND_EXPORT void bndTooltipBackground(NVGcontext *ctx, float x, float y, float w, float h);

// Draw a node port at the given position filled with the given color
void bndNodePort(NVGcontext *ctx, float x, float y, BNDwidgetState state,
BND_EXPORT void bndNodePort(NVGcontext *ctx, float x, float y, BNDwidgetState state,
NVGcolor color);

// Draw a node wire originating at (x0,y0) and floating to (x1,y1), with
@@ -394,23 +400,23 @@ void bndNodePort(NVGcontext *ctx, float x, float y, BNDwidgetState state,
// BND_DEFAULT: default wire color
// BND_HOVER: selected wire color
// BND_ACTIVE: dragged wire color
void bndNodeWire(NVGcontext *ctx, float x0, float y0, float x1, float y1,
BND_EXPORT void bndNodeWire(NVGcontext *ctx, float x0, float y0, float x1, float y1,
BNDwidgetState state0, BNDwidgetState state1);

// Draw a node background with its upper left origin at (x,y) and size of (w,h)
// where titleColor provides the base color for the title bar
void bndNodeBackground(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndNodeBackground(NVGcontext *ctx, float x, float y, float w, float h,
BNDwidgetState state, int iconid, const char *label, NVGcolor titleColor);

// Draw a window with the upper right and lower left splitter widgets into
// the rectangle at origin (x,y) and size (w, h)
void bndSplitterWidgets(NVGcontext *ctx, float x, float y, float w, float h);
BND_EXPORT void bndSplitterWidgets(NVGcontext *ctx, float x, float y, float w, float h);

// Draw the join area overlay stencil into the rectangle
// at origin (x,y) and size (w,h)
// vertical is 0 or 1 and designates the arrow orientation,
// mirror is 0 or 1 and flips the arrow side
void bndJoinAreaOverlay(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndJoinAreaOverlay(NVGcontext *ctx, float x, float y, float w, float h,
int vertical, int mirror);

////////////////////////////////////////////////////////////////////////////////
@@ -420,7 +426,7 @@ void bndJoinAreaOverlay(NVGcontext *ctx, float x, float y, float w, float h,
// Use these functions to estimate sizes for widgets with your NVGcontext.

// returns the ideal width for a label with given icon and text
float bndLabelWidth(NVGcontext *ctx, int iconid, const char *label);
BND_EXPORT float bndLabelWidth(NVGcontext *ctx, int iconid, const char *label);
////////////////////////////////////////////////////////////////////////////////

@@ -430,31 +436,31 @@ float bndLabelWidth(NVGcontext *ctx, int iconid, const char *label);
// new kinds of controls in a similar fashion.

// make color transparent using the default alpha value
NVGcolor bndTransparent(NVGcolor color);
BND_EXPORT NVGcolor bndTransparent(NVGcolor color);

// offset a color by a given integer delta in the range -100 to 100
NVGcolor bndOffsetColor(NVGcolor color, int delta);
BND_EXPORT NVGcolor bndOffsetColor(NVGcolor color, int delta);

// assigns radius r to the four entries of array radiuses depending on whether
// the corner is marked as sharp or not; see BNDcornerFlags for possible
// flag values.
void bndSelectCorners(float *radiuses, float r, int flags);
BND_EXPORT void bndSelectCorners(float *radiuses, float r, int flags);

// computes the upper and lower gradient colors for the inner box from a widget
// theme and the widgets state. If flipActive is set and the state is
// BND_ACTIVE, the upper and lower colors will be swapped.
void bndInnerColors(NVGcolor *shade_top, NVGcolor *shade_down,
BND_EXPORT void bndInnerColors(NVGcolor *shade_top, NVGcolor *shade_down,
const BNDwidgetTheme *theme, BNDwidgetState state, int flipActive);

// computes the text color for a widget label from a widget theme and the
// widgets state.
NVGcolor bndTextColor(const BNDwidgetTheme *theme, BNDwidgetState state);
BND_EXPORT NVGcolor bndTextColor(const BNDwidgetTheme *theme, BNDwidgetState state);

// computes the bounds of the scrollbar handle from the scrollbar size
// and the handles offset and size.
// offset is in the range 0..1 and defines the position of the scroll handle
// size is in the range 0..1 and defines the size of the scroll handle
void bndScrollHandleRect(float *x, float *y, float *w, float *h,
BND_EXPORT void bndScrollHandleRect(float *x, float *y, float *w, float *h,
float offset, float size);

// Add a rounded box path at position (x,y) with size (w,h) and a separate
@@ -462,43 +468,43 @@ void bndScrollHandleRect(float *x, float *y, float *w, float *h,
// cr1 = top right, cr2 = bottom right, cr3 = bottom left;
// this is a low level drawing function: the path must be stroked or filled
// to become visible.
void bndRoundedBox(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndRoundedBox(NVGcontext *ctx, float x, float y, float w, float h,
float cr0, float cr1, float cr2, float cr3);

// Draw a flat panel without any decorations at position (x,y) with size (w,h)
// and fills it with backgroundColor
void bndBackground(NVGcontext *ctx, float x, float y, float w, float h);
BND_EXPORT void bndBackground(NVGcontext *ctx, float x, float y, float w, float h);

// Draw a beveled border at position (x,y) with size (w,h) shaded with
// lighter and darker versions of backgroundColor
void bndBevel(NVGcontext *ctx, float x, float y, float w, float h);
BND_EXPORT void bndBevel(NVGcontext *ctx, float x, float y, float w, float h);

// Draw a lower inset for a rounded box at position (x,y) with size (w,h)
// that gives the impression the surface has been pushed in.
// cr2 and cr3 contain the radiuses of the bottom right and bottom left
// corners of the rounded box.
void bndBevelInset(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndBevelInset(NVGcontext *ctx, float x, float y, float w, float h,
float cr2, float cr3);
// Draw an icon with (x,y) as its upper left coordinate; the iconid selects
// the icon from the sheet; use the BND_ICONID macro to build icon IDs.
void bndIcon(NVGcontext *ctx, float x, float y, int iconid);
BND_EXPORT void bndIcon(NVGcontext *ctx, float x, float y, int iconid);

// Draw a drop shadow around the rounded box at (x,y) with size (w,h) and
// radius r, with feather as its maximum range in pixels.
// No shadow will be painted inside the rounded box.
void bndDropShadow(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndDropShadow(NVGcontext *ctx, float x, float y, float w, float h,
float r, float feather, float alpha);

// Draw the inner part of a widget box, with a gradient from shade_top to
// shade_down. If h>w, the gradient will be horizontal instead of
// vertical.
void bndInnerBox(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndInnerBox(NVGcontext *ctx, float x, float y, float w, float h,
float cr0, float cr1, float cr2, float cr3,
NVGcolor shade_top, NVGcolor shade_down);

// Draw the outline part of a widget box with the given color
void bndOutlineBox(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndOutlineBox(NVGcontext *ctx, float x, float y, float w, float h,
float cr0, float cr1, float cr2, float cr3, NVGcolor color);

// Draw an optional icon specified by <iconid> and an optional label with
@@ -509,7 +515,7 @@ void bndOutlineBox(NVGcontext *ctx, float x, float y, float w, float h,
// and color.
// if value is not NULL, label and value will be drawn with a ":" separator
// inbetween.
void bndIconLabelValue(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndIconLabelValue(NVGcontext *ctx, float x, float y, float w, float h,
int iconid, NVGcolor color, int align, float fontsize, const char *label,
const char *value);

@@ -518,7 +524,7 @@ void bndIconLabelValue(NVGcontext *ctx, float x, float y, float w, float h,
// if iconid is >= 0, an icon will be drawn
// if label is not NULL, it will be drawn with the specified alignment, fontsize
// and color.
void bndNodeIconLabel(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndNodeIconLabel(NVGcontext *ctx, float x, float y, float w, float h,
int iconid, NVGcolor color, NVGcolor shadowColor, int align,
float fontsize, const char *label);
@@ -531,28 +537,28 @@ void bndNodeIconLabel(NVGcontext *ctx, float x, float y, float w, float h,
// cbegin must be >= 0 and <= strlen(text) and denotes the beginning of the caret
// cend must be >= cbegin and <= strlen(text) and denotes the end of the caret
// if cend < cbegin, then no caret will be drawn
void bndIconLabelCaret(NVGcontext *ctx, float x, float y, float w, float h,
BND_EXPORT void bndIconLabelCaret(NVGcontext *ctx, float x, float y, float w, float h,
int iconid, NVGcolor color, float fontsize, const char *label,
NVGcolor caretcolor, int cbegin, int cend);
// Draw a checkmark for an option box with the given upper left coordinates
// (ox,oy) with the specified color.
void bndCheck(NVGcontext *ctx, float ox, float oy, NVGcolor color);
BND_EXPORT void bndCheck(NVGcontext *ctx, float ox, float oy, NVGcolor color);

// Draw a horizontal arrow for a number field with its center at (x,y) and
// size s; if s is negative, the arrow points to the left.
void bndArrow(NVGcontext *ctx, float x, float y, float s, NVGcolor color);
BND_EXPORT void bndArrow(NVGcontext *ctx, float x, float y, float s, NVGcolor color);

// Draw an up/down arrow for a choice box with its center at (x,y) and size s
void bndUpDownArrow(NVGcontext *ctx, float x, float y, float s, NVGcolor color);
BND_EXPORT void bndUpDownArrow(NVGcontext *ctx, float x, float y, float s, NVGcolor color);

// Draw a node down-arrow with its tip at (x,y) and size s
void bndNodeArrowDown(NVGcontext *ctx, float x, float y, float s, NVGcolor color);
BND_EXPORT void bndNodeArrowDown(NVGcontext *ctx, float x, float y, float s, NVGcolor color);

// return the color of a node wire based on state
// BND_HOVER indicates selected state,
// BND_ACTIVE indicates dragged state
NVGcolor bndNodeWireColor(const BNDnodeTheme *theme, BNDwidgetState state);
BND_EXPORT NVGcolor bndNodeWireColor(const BNDnodeTheme *theme, BNDwidgetState state);

#ifdef __cplusplus
};


+ 69
- 63
oui.h View File

@@ -182,6 +182,12 @@ See example.cpp in the repository for a full usage example.

*/

// you can override this from the outside to pick
// the export level you need
#ifndef OUI_EXPORT
#define OUI_EXPORT
#endif

// limits

// maximum number of items that may be added (must be power of 2)
@@ -306,58 +312,58 @@ typedef struct UIrect {
// create a new UI context; call uiMakeCurrent() to make this context the
// current context. The context is managed by the client and must be released
// using uiDestroyContext()
UIcontext *uiCreateContext();
OUI_EXPORT UIcontext *uiCreateContext();

// select an UI context as the current context; a context must always be
// selected before using any of the other UI functions
void uiMakeCurrent(UIcontext *ctx);
OUI_EXPORT void uiMakeCurrent(UIcontext *ctx);

// release the memory of an UI context created with uiCreateContext(); if the
// context is the current context, the current context will be set to NULL
void uiDestroyContext(UIcontext *ctx);
OUI_EXPORT void uiDestroyContext(UIcontext *ctx);

// Input Control
// -------------

// sets the current cursor position (usually belonging to a mouse) to the
// screen coordinates at (x,y)
void uiSetCursor(int x, int y);
OUI_EXPORT void uiSetCursor(int x, int y);

// returns the current cursor position in screen coordinates as set by
// uiSetCursor()
UIvec2 uiGetCursor();
OUI_EXPORT UIvec2 uiGetCursor();

// returns the offset of the cursor relative to the last call to uiProcess()
UIvec2 uiGetCursorDelta();
OUI_EXPORT UIvec2 uiGetCursorDelta();

// returns the beginning point of a drag operation.
UIvec2 uiGetCursorStart();
OUI_EXPORT UIvec2 uiGetCursorStart();

// returns the offset of the cursor relative to the beginning point of a drag
// operation.
UIvec2 uiGetCursorStartDelta();
OUI_EXPORT UIvec2 uiGetCursorStartDelta();

// sets a mouse or gamepad button as pressed/released
// button is in the range 0..63 and maps to an application defined input
// source.
// enabled is 1 for pressed, 0 for released
void uiSetButton(int button, int enabled);
OUI_EXPORT void uiSetButton(int button, int enabled);

// returns the current state of an application dependent input button
// as set by uiSetButton().
// the function returns 1 if the button has been set to pressed, 0 for released.
int uiGetButton(int button);
OUI_EXPORT int uiGetButton(int button);

// sets a key as down/up; the key can be any application defined keycode
// mod is an application defined set of flags for modifier keys
// enabled is 1 for key down, 0 for key up
// all key events are being buffered until the next call to uiProcess()
void uiSetKey(unsigned int key, unsigned int mod, int enabled);
OUI_EXPORT void uiSetKey(unsigned int key, unsigned int mod, int enabled);

// sends a single character for text input; the character is usually in the
// unicode range, but can be application defined.
// all char events are being buffered until the next call to uiProcess()
void uiSetChar(unsigned int value);
OUI_EXPORT void uiSetChar(unsigned int value);


// Stages
@@ -368,14 +374,14 @@ void uiSetChar(unsigned int value);
// times.
// After the call, all previously declared item IDs are invalid, and all
// application dependent context data has been freed.
void uiClear();
OUI_EXPORT void uiClear();

// layout all added items starting from the root item 0.
// after calling uiLayout(), no further modifications to the item tree should
// be done until the next call to uiClear().
// It is safe to immediately draw the items after a call to uiLayout().
// this is an O(N) operation for N = number of declared items.
void uiLayout();
OUI_EXPORT void uiLayout();

// update the internal state according to the current cursor position and
// button states, and call all registered handlers.
@@ -383,13 +389,13 @@ void uiLayout();
// be done until the next call to uiClear().
// Items should be drawn before a call to uiProcess()
// this is an O(N) operation for N = number of declared items.
void uiProcess();
OUI_EXPORT void uiProcess();

// UI Declaration
// --------------

// create a new UI item and return the new items ID.
int uiItem();
OUI_EXPORT int uiItem();

// set an items state to frozen; the UI will not recurse into frozen items
// when searching for hot or active items; subsequently, frozen items and
@@ -398,62 +404,62 @@ int uiItem();
// UI_COLD for child items. Upon encountering a frozen item, the drawing
// routine needs to handle rendering of child items appropriately.
// see example.cpp for a demonstration.
void uiSetFrozen(int item, int enable);
OUI_EXPORT void uiSetFrozen(int item, int enable);

// set the application-dependent handle of an item.
// handle is an application defined 64-bit handle. If handle is 0, the item
// will not be interactive.
void uiSetHandle(int item, UIhandle handle);
OUI_EXPORT void uiSetHandle(int item, UIhandle handle);

// assigns the items own address as handle; this may cause glitches
// when the order of items changes while theitem is captured
void uiSetSelfHandle(int item);
OUI_EXPORT void uiSetSelfHandle(int item);

// allocate space for application-dependent context data and return the pointer
// if successful. If no data has been allocated, a new pointer is returned.
// Otherwise, an assertion is thrown.
// The memory of the pointer is managed by the UI context.
void *uiAllocData(int item, int size);
OUI_EXPORT void *uiAllocData(int item, int size);

// set the handler callback for an interactive item.
// flags is a combination of UI_EVENT_* and designates for which events the
// handler should be called.
void uiSetHandler(int item, UIhandler handler, int flags);
OUI_EXPORT void uiSetHandler(int item, UIhandler handler, int flags);

// assign an item to a container.
// an item ID of 0 refers to the root item.
// if child is already assigned to a parent, an assertion will be thrown.
// the function returns the child item ID
int uiAppend(int item, int child);
OUI_EXPORT int uiAppend(int item, int child);

// set the size of the item; a size of 0 indicates the dimension to be
// dynamic; if the size is set, the item can not expand beyond that size.
void uiSetSize(int item, int w, int h);
OUI_EXPORT void uiSetSize(int item, int w, int h);

// set the anchoring behavior of the item to one or multiple UIlayoutFlags
void uiSetLayout(int item, int flags);
OUI_EXPORT void uiSetLayout(int item, int flags);

// set the left, top, right and bottom margins of an item; when the item is
// anchored to the parent or another item, the margin controls the distance
// from the neighboring element.
void uiSetMargins(int item, int l, int t, int r, int b);
OUI_EXPORT void uiSetMargins(int item, int l, int t, int r, int b);

// anchor the item to another sibling within the same container, so that the
// sibling is left to this item.
void uiSetRelToLeft(int item, int other);
OUI_EXPORT void uiSetRelToLeft(int item, int other);
// anchor the item to another sibling within the same container, so that the
// sibling is above this item.
void uiSetRelToTop(int item, int other);
OUI_EXPORT void uiSetRelToTop(int item, int other);
// anchor the item to another sibling within the same container, so that the
// sibling is right to this item.
void uiSetRelToRight(int item, int other);
OUI_EXPORT void uiSetRelToRight(int item, int other);
// anchor the item to another sibling within the same container, so that the
// sibling is below this item.
void uiSetRelToDown(int item, int other);
OUI_EXPORT void uiSetRelToDown(int item, int other);

// set item as recipient of all keyboard events; the item must have a handle
// assigned; if item is -1, no item will be focused.
void uiFocus(int item);
OUI_EXPORT void uiFocus(int item);

// Iteration
// ---------
@@ -461,24 +467,24 @@ void uiFocus(int item);
// returns the first child item of a container item. If the item is not
// a container or does not contain any items, -1 is returned.
// if item is 0, the first child item of the root item will be returned.
int uiFirstChild(int item);
OUI_EXPORT int uiFirstChild(int item);

// returns the last child item of a container item. If the item is not
// a container or does not contain any items, -1 is returned.
// if item is 0, the last child item of the root item will be returned.
int uiLastChild(int item);
OUI_EXPORT int uiLastChild(int item);

// returns an items parent container item.
// if item is 0, -1 will be returned.
int uiParent(int item);
OUI_EXPORT int uiParent(int item);

// returns an items next sibling in the list of the parent containers children.
// if item is 0 or the item is the last child item, -1 will be returned.
int uiNextSibling(int item);
OUI_EXPORT int uiNextSibling(int item);
// returns an items previous sibling in the list of the parent containers
// children.
// if item is 0 or the item is the first child item, -1 will be returned.
int uiPrevSibling(int item);
OUI_EXPORT int uiPrevSibling(int item);

// Querying
// --------
@@ -486,97 +492,97 @@ int uiPrevSibling(int item);
// return the current state of the item. This state is only valid after
// a call to uiProcess().
// The returned value is one of UI_COLD, UI_HOT, UI_ACTIVE, UI_FROZEN.
UIitemState uiGetState(int item);
OUI_EXPORT UIitemState uiGetState(int item);

// return the application-dependent handle of the item as passed to uiSetHandle().
UIhandle uiGetHandle(int item);
OUI_EXPORT UIhandle uiGetHandle(int item);

// return the item with the given application-dependent handle as assigned by
// uiSetHandle() or -1 if unsuccessful.
int uiGetItem(UIhandle handle);
OUI_EXPORT int uiGetItem(UIhandle handle);

// return the item that is currently under the cursor or -1 for none
int uiGetHotItem();
OUI_EXPORT int uiGetHotItem();

// return the item that is currently focused or -1 for none
int uiGetFocusedItem();
OUI_EXPORT int uiGetFocusedItem();

// return the application-dependent context data for an item as passed to
// uiAllocData(). The memory of the pointer is managed by the UI context
// and should not be altered.
const void *uiGetData(int item);
OUI_EXPORT const void *uiGetData(int item);

// return the handler callback for an item as passed to uiSetHandler()
UIhandler uiGetHandler(int item);
OUI_EXPORT UIhandler uiGetHandler(int item);
// return the handler flags for an item as passed to uiSetHandler()
int uiGetHandlerFlags(int item);
OUI_EXPORT int uiGetHandlerFlags(int item);
// when handling a KEY_DOWN/KEY_UP event: the key that triggered this event
unsigned int uiGetKey();
OUI_EXPORT unsigned int uiGetKey();
// when handling a KEY_DOWN/KEY_UP event: the key that triggered this event
unsigned int uiGetModifier();
OUI_EXPORT unsigned int uiGetModifier();
// when handling an EXTEND event; the container which to add items to
int uiGetExtendItem();
OUI_EXPORT int uiGetExtendItem();

// returns the number of child items a container item contains. If the item
// is not a container or does not contain any items, 0 is returned.
// if item is 0, the child item count of the root item will be returned.
int uiGetChildCount(int item);
OUI_EXPORT int uiGetChildCount(int item);

// returns an items child index relative to its parent. If the item is the
// first item, the return value is 0; If the item is the last item, the return
// value is equivalent to uiGetChildCount(uiParent(item))-1.
// if item is 0, 0 will be returned.
int uiGetChildId(int item);
OUI_EXPORT int uiGetChildId(int item);

// returns the items layout rectangle relative to the parent. If uiGetRect()
// is called before uiLayout(), the values of the returned rectangle are
// undefined.
UIrect uiGetRect(int item);
OUI_EXPORT UIrect uiGetRect(int item);

// returns the items layout rectangle in absolute coordinates. If
// uiGetAbsoluteRect() is called before uiLayout(), the values of the returned
// rectangle are undefined.
// This function has complexity O(N) for N parents
UIrect uiGetAbsoluteRect(int item);
OUI_EXPORT UIrect uiGetAbsoluteRect(int item);

// returns 1 if an items absolute rectangle contains a given coordinate
// otherwise 0
int uiContains(int item, int x, int y);
OUI_EXPORT int uiContains(int item, int x, int y);

// when called from an input event handler, returns the active items absolute
// layout rectangle. If uiGetActiveRect() is called outside of a handler,
// the values of the returned rectangle are undefined.
UIrect uiGetActiveRect();
OUI_EXPORT UIrect uiGetActiveRect();

// return the width of the item as set by uiSetSize()
int uiGetWidth(int item);
OUI_EXPORT int uiGetWidth(int item);
// return the height of the item as set by uiSetSize()
int uiGetHeight(int item);
OUI_EXPORT int uiGetHeight(int item);

// return the anchoring behavior as set by uiSetLayout()
int uiGetLayout(int item);
OUI_EXPORT int uiGetLayout(int item);

// return the left margin of the item as set with uiSetMargins()
int uiGetMarginLeft(int item);
OUI_EXPORT int uiGetMarginLeft(int item);
// return the top margin of the item as set with uiSetMargins()
int uiGetMarginTop(int item);
OUI_EXPORT int uiGetMarginTop(int item);
// return the right margin of the item as set with uiSetMargins()
int uiGetMarginRight(int item);
OUI_EXPORT int uiGetMarginRight(int item);
// return the bottom margin of the item as set with uiSetMargins()
int uiGetMarginDown(int item);
OUI_EXPORT int uiGetMarginDown(int item);

// return the items anchored sibling as assigned with uiSetRelToLeft()
// or -1 if not set.
int uiGetRelToLeft(int item);
OUI_EXPORT int uiGetRelToLeft(int item);
// return the items anchored sibling as assigned with uiSetRelToTop()
// or -1 if not set.
int uiGetRelToTop(int item);
OUI_EXPORT int uiGetRelToTop(int item);
// return the items anchored sibling as assigned with uiSetRelToRight()
// or -1 if not set.
int uiGetRelToRight(int item);
OUI_EXPORT int uiGetRelToRight(int item);
// return the items anchored sibling as assigned with uiSetRelToBottom()
// or -1 if not set.
int uiGetRelToDown(int item);
OUI_EXPORT int uiGetRelToDown(int item);

#endif // _OUI_H_



Loading…
Cancel
Save