2007-01-15 12:09:25 -08:00
|
|
|
/*
|
|
|
|
This file is part of Warzone 2100.
|
|
|
|
Copyright (C) 1999-2004 Eidos Interactive
|
|
|
|
Copyright (C) 2005-2007 Warzone Resurrection Project
|
|
|
|
|
|
|
|
Warzone 2100 is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
Warzone 2100 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 General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with Warzone 2100; if not, write to the Free Software
|
|
|
|
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
2008-04-24 10:06:25 -07:00
|
|
|
/**
|
2008-09-11 11:25:34 -07:00
|
|
|
* @file lib/widget/widget.h
|
2008-04-24 10:06:25 -07:00
|
|
|
* Definitions for the Widget library
|
2008-04-24 10:23:11 -07:00
|
|
|
* @defgroup Widget Widget system
|
2008-04-24 10:06:25 -07:00
|
|
|
* Warzone uses a pixel layout, callback based widget code. While it has several
|
|
|
|
* fallbacks for drawing standard widgets, usually you want to specify your
|
|
|
|
* own drawing callbacks.
|
|
|
|
* @{
|
2007-06-28 10:47:08 -07:00
|
|
|
*/
|
2008-03-21 08:40:23 -07:00
|
|
|
|
|
|
|
#ifndef __INCLUDED_LIB_WIDGET_WIDGET_H__
|
|
|
|
#define __INCLUDED_LIB_WIDGET_WIDGET_H__
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2006-05-27 09:37:17 -07:00
|
|
|
#include "lib/framework/frame.h"
|
2007-12-09 08:09:23 -08:00
|
|
|
#include "lib/ivis_common/piepalette.h"
|
2008-03-23 11:12:23 -07:00
|
|
|
#include "lib/ivis_common/textdraw.h"
|
2007-06-28 10:47:08 -07:00
|
|
|
#include "widgbase.h"
|
|
|
|
|
|
|
|
/***********************************************************************************
|
|
|
|
*
|
|
|
|
* Widget style definitions - these control how the basic widget appears on screen
|
|
|
|
*/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WIDG_HIDDEN 0x8000 ///< The widget is initially hidden
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/************ Form styles ****************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WFORM_PLAIN 0 ///< Plain form
|
|
|
|
#define WFORM_TABBED 1 ///< Tabbed form
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Invisible (i.e. see through) form - can be used in conjunction with WFORM_PLAIN or WFORM_TABBED. */
|
2007-06-28 10:47:08 -07:00
|
|
|
#define WFORM_INVISIBLE 2
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WFORM_CLICKABLE 4 ///< Clickable form - return form id when the form is clicked
|
|
|
|
#define WFORM_NOCLICKMOVE 8 ///< Disable movement on a clickable form
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/**
|
|
|
|
* Control whether the primary or secondary buttons work on a clickable form.
|
|
|
|
* Primary works by default - this turns it off.
|
|
|
|
*/
|
|
|
|
#define WFORM_NOPRIMARY 0x10
|
|
|
|
#define WFORM_SECONDARY 0x20 ///< Enable secondary buttons
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/************ Label styles ***************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WLAB_PLAIN 0 ///< Plain text only label
|
|
|
|
#define WLAB_ALIGNLEFT 1 ///< Align the text at the left of the box
|
|
|
|
#define WLAB_ALIGNCENTRE 2 ///< Center the text
|
|
|
|
#define WLAB_ALIGNRIGHT 4 ///< Align the text at the right of the box
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/************ Button styles **************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WBUT_PLAIN 0 ///< Plain button (text with a box around it)
|
|
|
|
#define WBUT_NOCLICKMOVE 8 ///< Disable movement on a button
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/**
|
|
|
|
* Control whether the primary or secondary buttons work on a button. Primary works by default -
|
|
|
|
* this turns it off.
|
|
|
|
*/
|
|
|
|
#define WBUT_NOPRIMARY 0x10
|
|
|
|
#define WBUT_SECONDARY 0x20 ///< Enable secondary buttons.
|
|
|
|
#define WBUT_TXTCENTRE 64 ///< Text only buttons. centre the text?
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/*********** Edit Box styles *************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WEDB_PLAIN 0 ///< Plain edit box (text with a box around it)
|
|
|
|
#define WEDB_DISABLED 1 ///< Disabled. Displayed but never gets focus.
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/*********** Bar Graph styles ************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WBAR_PLAIN 0 ////< Plain bar graph
|
|
|
|
#define WBAR_TROUGH 1 ///< Bar graph with a trough showing empty percentage
|
|
|
|
#define WBAR_DOUBLE 2 ///< Double bar graph, one on top of other
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/*********** Slider styles ***************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WSLD_PLAIN 0 ///< Plain slider
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/***********************************************************************************/
|
|
|
|
|
|
|
|
/* Basic initialisation entries common to all widgets */
|
|
|
|
#define WINIT_BASE \
|
|
|
|
UDWORD formID; /* ID number of form to put widget on */ \
|
|
|
|
/* ID == 0 specifies the default form for the screen */ \
|
|
|
|
UWORD majorID,minorID; /* Which major and minor tab to put the widget */ \
|
|
|
|
/* on for a tabbed form */ \
|
|
|
|
UDWORD id; /* Unique id number (chosen by user) */ \
|
|
|
|
UDWORD style; /* widget style */ \
|
|
|
|
SWORD x,y; /* screen location */ \
|
|
|
|
UWORD width,height; /* widget size */\
|
|
|
|
WIDGET_DISPLAY pDisplay; /* Optional display function */\
|
|
|
|
WIDGET_CALLBACK pCallback; /* Optional callback function */\
|
|
|
|
void *pUserData; /* Optional user data pointer */\
|
|
|
|
UDWORD UserData /* User data (if any) */
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** The basic initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
WINIT_BASE;
|
|
|
|
} W_INIT;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/*
|
|
|
|
* Flags for controlling where the tabs appear on a form -
|
2007-06-28 10:47:08 -07:00
|
|
|
* used in the majorPos and minorPos entries of the W_FORMINIT struct
|
|
|
|
*/
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WFORM_TABNONE 0 ///< No tab
|
2007-06-28 10:47:08 -07:00
|
|
|
#define WFORM_TABTOP 1
|
|
|
|
#define WFORM_TABLEFT 2
|
|
|
|
#define WFORM_TABRIGHT 3
|
|
|
|
#define WFORM_TABBOTTOM 4
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/*
|
|
|
|
* Upper limits for major and minor tabs on a tab form.
|
2007-06-28 10:47:08 -07:00
|
|
|
* Not the best way to do it I know, but it keeps the memory
|
|
|
|
* management MUCH simpler.
|
|
|
|
*/
|
|
|
|
|
2007-12-03 12:47:05 -08:00
|
|
|
// The below define is max # of tabs we can have.
|
|
|
|
// It is set to 20 Look @ #define MAXSTRUCTURES 200 in hci.h Keep them in check!
|
|
|
|
// New routines really have no max limit. I am not sure what max # a legal user can have.
|
2008-03-28 11:41:53 -07:00
|
|
|
#define WFORM_MAXMAJOR 40 // Maximum number of major tabs on a tab form
|
2007-12-03 12:47:05 -08:00
|
|
|
// we do NOT use MAX MINOR now, it is another way to draw the widgets.
|
2007-06-28 10:47:08 -07:00
|
|
|
#define WFORM_MAXMINOR 5 //15 // Maximum number of minor tabs off a major
|
2008-01-22 12:11:10 -08:00
|
|
|
#define MAX_TAB_STD_SHOWN 4 // max # of tabs we can display using standard tab icons.
|
|
|
|
#define MAX_TAB_SMALL_SHOWN 8 // max # of tabs we can display using small tab icons.
|
2007-12-03 12:47:05 -08:00
|
|
|
#define TAB_SEVEN 7 //*with* tab scroll buttons, we can only (currently) show 7 max!
|
|
|
|
// NOTE: enable TAB_MINOR at your own risk. Have NOT testest new rotuines with that.
|
2007-06-28 10:47:08 -07:00
|
|
|
#define TAB_MINOR 0 // Tab types passed into tab display callbacks.
|
|
|
|
#define TAB_MAJOR 1
|
|
|
|
|
2007-06-03 06:46:50 -07:00
|
|
|
typedef void (*TAB_DISPLAY)(WIDGET *psWidget, UDWORD TabType, UDWORD Position, UDWORD Number, BOOL Selected, BOOL Hilight, UDWORD x, UDWORD y, UDWORD Width, UDWORD Height);
|
|
|
|
typedef void (*FONT_DISPLAY)(UDWORD x, UDWORD y, char *String);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Form initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* The basic init entries */
|
|
|
|
WINIT_BASE;
|
|
|
|
|
|
|
|
/* Data for a tabbed form */
|
2007-02-17 13:33:10 -08:00
|
|
|
BOOL disableChildren;
|
2008-04-24 10:06:25 -07:00
|
|
|
UWORD majorPos, minorPos; // Position of the tabs on the form
|
2007-06-28 10:47:08 -07:00
|
|
|
UWORD majorSize, minorSize; // Size of the tabs (in pixels)
|
|
|
|
SWORD majorOffset, minorOffset; // Tab start offset.
|
2008-04-24 10:06:25 -07:00
|
|
|
SWORD tabVertOffset; ///< Tab form overlap offset.
|
|
|
|
SWORD tabHorzOffset; ///< Tab form overlap offset.
|
|
|
|
UWORD tabMajorThickness; ///< The thickness of the tabs
|
|
|
|
UWORD tabMinorThickness; ///< The thickness of the tabs
|
|
|
|
UWORD tabMajorGap; ///< The space between tabs
|
|
|
|
UWORD tabMinorGap; ///< The space between tabs
|
|
|
|
UWORD numStats; ///< Number of "stats" (items) in list
|
|
|
|
UWORD numButtons; ///< Number of buttons per form
|
|
|
|
UWORD numMajor; ///< Number of major tabs
|
|
|
|
UWORD aNumMinors[WFORM_MAXMAJOR]; ///< Number of minor tabs for each major
|
|
|
|
SWORD TabMultiplier; ///< Used to tell system we got lots of (virtual) tabs to display
|
|
|
|
const char *pTip; ///< Tool tip for the form itself
|
|
|
|
char *apMajorTips[WFORM_MAXMAJOR]; ///< Tool tips for the major tabs
|
|
|
|
char *apMinorTips[WFORM_MAXMAJOR][WFORM_MAXMINOR]; ///< Tool tips for the minor tabs
|
|
|
|
TAB_DISPLAY pTabDisplay; ///< Optional callback for displaying a tab.
|
|
|
|
WIDGET_DISPLAY pFormDisplay; ///< Optional callback to display the form.
|
2007-06-28 10:47:08 -07:00
|
|
|
} W_FORMINIT;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Label initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* The basic init entries */
|
|
|
|
WINIT_BASE;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
const char *pText; ///< label text
|
|
|
|
const char *pTip; ///< Tool tip for the label.
|
|
|
|
enum iV_fonts FontID; ///< ID of the IVIS font to use for this widget.
|
2007-06-28 10:47:08 -07:00
|
|
|
} W_LABINIT;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Button initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* The basic init entries */
|
|
|
|
WINIT_BASE;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
const char *pText; ///< Button text
|
|
|
|
const char *pTip; ///< Tool tip text
|
|
|
|
enum iV_fonts FontID; //< ID of the IVIS font to use for this widget.
|
2007-06-28 10:47:08 -07:00
|
|
|
} W_BUTINIT;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Edit box initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* The basic init entries */
|
|
|
|
WINIT_BASE;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
const char *pText; ///< initial contents of the edit box
|
|
|
|
enum iV_fonts FontID; ///< ID of the IVIS font to use for this widget.
|
|
|
|
WIDGET_DISPLAY pBoxDisplay; ///< Optional callback to display the form.
|
|
|
|
FONT_DISPLAY pFontDisplay; ///< Optional callback to display a string.
|
2007-06-28 10:47:08 -07:00
|
|
|
} W_EDBINIT;
|
|
|
|
|
|
|
|
/* Orientation flags for the bar graph */
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WBAR_LEFT 0x0001 ///< Bar graph fills from left to right
|
|
|
|
#define WBAR_RIGHT 0x0002 ///< Bar graph fills from right to left
|
|
|
|
#define WBAR_TOP 0x0003 ///< Bar graph fills from top to bottom
|
|
|
|
#define WBAR_BOTTOM 0x0004 ///< Bar graph fills from bottom to top
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Bar Graph initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* The basic init entries */
|
|
|
|
WINIT_BASE;
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
UWORD orientation; ///< Orientation of the bar on the widget
|
|
|
|
UWORD size; ///< Initial percentage of the graph that is filled
|
|
|
|
UWORD minorSize; ///< Percentage of second bar graph if there is one
|
|
|
|
UWORD iRange; ///< Maximum range
|
|
|
|
PIELIGHT sCol; ///< Bar colour
|
|
|
|
PIELIGHT sMinorCol; ///< Minor bar colour
|
|
|
|
const char *pTip; ///< Tool tip text
|
2007-06-28 10:47:08 -07:00
|
|
|
} W_BARINIT;
|
|
|
|
|
|
|
|
|
|
|
|
/* Orientation of the slider */
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WSLD_LEFT 0x0001 ///< Slider is horizontal and starts at left
|
|
|
|
#define WSLD_RIGHT 0x0002 ///< Slider is horizontal and starts at the right
|
|
|
|
#define WSLD_TOP 0x0003 ///< Slider is vertical and starts at the top
|
|
|
|
#define WSLD_BOTTOM 0x0004 ///< Slider is vertical and starts at the bottom
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Slider initialisation structure */
|
|
|
|
typedef struct
|
2007-06-28 10:47:08 -07:00
|
|
|
{
|
|
|
|
/* The basic init entries */
|
|
|
|
WINIT_BASE;
|
2006-05-27 09:37:17 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
UWORD orientation; ///< Orientation of the slider
|
|
|
|
UWORD numStops; ///< Number of stops on the slider
|
|
|
|
UWORD barSize; ///< Size of the bar
|
|
|
|
UWORD pos; ///< Initial position of the slider bar
|
|
|
|
const char *pTip; ///< Tip string
|
2007-06-28 10:47:08 -07:00
|
|
|
} W_SLDINIT;
|
|
|
|
|
|
|
|
/***********************************************************************************/
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** The maximum lenth of strings for the widget system */
|
2007-06-28 10:47:08 -07:00
|
|
|
#define WIDG_MAXSTR 80
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** The maximum value for bar graph size */
|
2007-06-28 10:47:08 -07:00
|
|
|
#define WBAR_SCALE 100
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Initialise the widget module */
|
2008-03-23 17:32:00 -07:00
|
|
|
extern bool widgInitialise(void);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Reset the widget module */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgReset(void);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Shut down the widget module */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgShutDown(void);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Create an empty widget screen */
|
2008-03-21 07:22:42 -07:00
|
|
|
extern W_SCREEN* widgCreateScreen(void);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Release a screen and all its associated data */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgReleaseScreen(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the tool tip font for a screen */
|
2008-03-23 11:12:23 -07:00
|
|
|
extern void widgSetTipFont(W_SCREEN *psScreen, enum iV_fonts FontID);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Add a form to the widget screen */
|
2008-03-21 07:22:36 -07:00
|
|
|
extern BOOL widgAddForm(W_SCREEN *psScreen, const W_FORMINIT* psInit);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Add a label to the widget screen */
|
2008-03-21 07:22:20 -07:00
|
|
|
extern BOOL widgAddLabel(W_SCREEN *psScreen, const W_LABINIT* psInit);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Add a button to a form */
|
2008-03-21 07:22:15 -07:00
|
|
|
extern BOOL widgAddButton(W_SCREEN *psScreen, const W_BUTINIT* psInit);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Add an edit box to a form */
|
2008-03-21 07:22:30 -07:00
|
|
|
extern BOOL widgAddEditBox(W_SCREEN *psScreen, const W_EDBINIT* psInit);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Add a bar graph to a form */
|
2008-03-21 07:22:05 -07:00
|
|
|
extern BOOL widgAddBarGraph(W_SCREEN *psScreen, const W_BARINIT* psInit);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Add a slider to a form */
|
2008-03-21 04:47:23 -07:00
|
|
|
extern BOOL widgAddSlider(W_SCREEN *psScreen, const W_SLDINIT* psInit);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Delete a widget from the screen */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgDelete(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Hide a widget */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgHide(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Reveal a widget */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgReveal(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Return a pointer to a buffer containing the current string of a widget if any.
|
2007-06-28 10:47:08 -07:00
|
|
|
* This will always return a valid string pointer.
|
|
|
|
* NOTE: The string must be copied out of the buffer
|
|
|
|
*/
|
2007-06-03 06:46:50 -07:00
|
|
|
extern const char *widgGetString(W_SCREEN *psScreen, UDWORD id);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the text in a widget */
|
2007-04-09 15:09:27 -07:00
|
|
|
extern void widgSetString(W_SCREEN *psScreen, UDWORD id, const char *pText);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the current tabs for a tab form */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgSetTabs(W_SCREEN *psScreen, UDWORD id, UWORD major, UWORD minor);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get the current tabs for a tab form */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgGetTabs(W_SCREEN *psScreen, UDWORD id, UWORD *pMajor, UWORD *pMinor);
|
|
|
|
|
2008-05-09 13:32:31 -07:00
|
|
|
/** Get the number of major tab in a tab form. */
|
|
|
|
int widgGetNumTabMajor(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
|
|
|
/** Get the number of minor tabs in a tab form. */
|
|
|
|
int widgGetNumTabMinor(W_SCREEN *psScreen, UDWORD id, UWORD pMajor);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get the current position of a widget */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgGetPos(W_SCREEN *psScreen, UDWORD id, SWORD *pX, SWORD *pY);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get the current position of a slider bar */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern UDWORD widgGetSliderPos(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the current position of a slider bar */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgSetSliderPos(W_SCREEN *psScreen, UDWORD id, UWORD pos);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the current size of a bar graph */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgSetBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD size);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the current size of a minor bar on a double graph */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgSetMinorBarSize(W_SCREEN *psScreen, UDWORD id, UDWORD size);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Return the ID of the widget the mouse was over this frame */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern UDWORD widgGetMouseOver(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Return the user data for a widget */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void *widgGetUserData(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the user data for a widget */
|
2007-06-03 06:46:50 -07:00
|
|
|
extern void widgSetUserData(W_SCREEN *psScreen, UDWORD id, void *UserData);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Return the user data for a widget */
|
2007-06-03 06:46:50 -07:00
|
|
|
extern UDWORD widgGetUserData2(W_SCREEN *psScreen, UDWORD id);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the user data for a widget */
|
2007-06-03 06:46:50 -07:00
|
|
|
extern void widgSetUserData2(W_SCREEN *psScreen, UDWORD id,UDWORD UserData);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Return the user data for the returned widget */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void *widgGetLastUserData(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get widget structure */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern WIDGET *widgGetFromID(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set tip string for a widget */
|
|
|
|
extern void widgSetTip(W_SCREEN *psScreen, UDWORD id, const char *pTip);
|
2007-06-04 11:33:36 -07:00
|
|
|
extern void widgSetTipText(WIDGET* psWidget, const char* pTip);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Colour numbers */
|
2007-06-28 10:47:08 -07:00
|
|
|
enum _w_colour
|
|
|
|
{
|
2008-04-24 10:06:25 -07:00
|
|
|
WCOL_BKGRND, ///< Background colours
|
|
|
|
WCOL_TEXT, ///< Text colour
|
|
|
|
WCOL_LIGHT, ///< Light colour for 3D effects
|
|
|
|
WCOL_DARK, ///< Dark colour for 3D effects
|
|
|
|
WCOL_HILITE, ///< Hilite colour
|
|
|
|
WCOL_CURSOR, ///< Edit Box cursor colour
|
|
|
|
WCOL_TIPBKGRND, ///< Background for the tool tip window
|
|
|
|
WCOL_DISABLE, ///< Text colour on a disabled button
|
|
|
|
|
|
|
|
WCOL_MAX, ///< All colour numbers are less than this
|
2007-06-28 10:47:08 -07:00
|
|
|
};
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set a colour on a form */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgSetColour(W_SCREEN *psScreen, UDWORD id, UDWORD colour,
|
|
|
|
UBYTE red, UBYTE green, UBYTE blue);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the global toop tip text colour. */
|
2008-04-20 10:17:50 -07:00
|
|
|
extern void widgSetTipColour(PIELIGHT colour);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
/* Possible states for a button */
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WBUT_DISABLE 0x0001 ///< Disable (grey out) a button
|
|
|
|
#define WBUT_LOCK 0x0002 ///< Fix a button down
|
|
|
|
#define WBUT_CLICKLOCK 0x0004 ///< Fix a button down but it is still clickable
|
|
|
|
#define WBUT_FLASH 0x0008 ///< Make a button flash.
|
2007-06-28 10:47:08 -07:00
|
|
|
|
|
|
|
extern void widgSetButtonFlash(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
extern void widgClearButtonFlash(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get a button or clickable form's state */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern UDWORD widgGetButtonState(W_SCREEN *psScreen, UDWORD id);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set a button or clickable form's state */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void widgSetButtonState(W_SCREEN *psScreen, UDWORD id, UDWORD state);
|
|
|
|
|
|
|
|
|
|
|
|
/* The keys that can be used to press a button */
|
2008-04-24 10:06:25 -07:00
|
|
|
#define WKEY_NONE 0
|
2007-06-28 10:47:08 -07:00
|
|
|
#define WKEY_PRIMARY 1
|
|
|
|
#define WKEY_SECONDARY 2
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Return which key was used to press the last returned widget */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern UDWORD widgGetButtonKey(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Initialise the set of widgets that make up a screen.
|
2007-06-28 10:47:08 -07:00
|
|
|
* Call this once before calling widgRunScreen and widgDisplayScreen.
|
|
|
|
* This should only be called once before calling Run and Display as many times
|
|
|
|
* as is required.
|
|
|
|
*/
|
|
|
|
extern void widgStartScreen(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Clean up after a screen has been run.
|
2007-06-28 10:47:08 -07:00
|
|
|
* Call this after the widgRunScreen / widgDisplayScreen cycle.
|
|
|
|
*/
|
|
|
|
extern void widgEndScreen(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Execute a set of widgets for one cycle.
|
2007-06-28 10:47:08 -07:00
|
|
|
* Return the id of the widget that was activated, or 0 for none.
|
|
|
|
*/
|
|
|
|
extern UDWORD widgRunScreen(W_SCREEN *psScreen);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Display the screen's widgets in their current state
|
2007-06-28 10:47:08 -07:00
|
|
|
* (Call after calling widgRunScreen, this allows the input
|
|
|
|
* processing to be seperated from the display of the widgets).
|
|
|
|
*/
|
|
|
|
extern void widgDisplayScreen(W_SCREEN *psScreen);
|
|
|
|
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Set the current audio callback function and audio id's. */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern void WidgSetAudio(WIDGET_AUDIOCALLBACK Callback,SWORD HilightID,SWORD ClickedID);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get pointer to current audio callback function. */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern WIDGET_AUDIOCALLBACK WidgGetAudioCallback(void);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get current audio ID for hilight. */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern SWORD WidgGetHilightAudioID(void);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Get current audio ID for clicked. */
|
2007-06-28 10:47:08 -07:00
|
|
|
extern SWORD WidgGetClickedAudioID(void);
|
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** Enable or disable all sliders. */
|
2007-06-03 06:46:50 -07:00
|
|
|
extern void sliderEnableDrag(BOOL Enable);
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2007-06-03 06:46:50 -07:00
|
|
|
extern void setWidgetsStatus( BOOL var );
|
|
|
|
extern BOOL getWidgetsStatus( void );
|
2007-06-28 10:47:08 -07:00
|
|
|
|
2008-04-24 10:06:25 -07:00
|
|
|
/** @} */
|
|
|
|
|
2008-03-21 08:40:23 -07:00
|
|
|
#endif // __INCLUDED_LIB_WIDGET_WIDGET_H__
|