WDS_Looks

WDS_Looks

wds

1998 12-05


CLASS

WDS_Looks - a list of WDS_Look's


SYNOPSIS

Class WDS_Looks contains doubly-linked list of WDS_Look's. This list is not publically accessible, but utilized through member functions to WDS_Looks.


PUBLIC MEMBER FUNCTIONS



void RegisterLook(long *typecode,char *type_name,WDS_Look *look)
Register the specified look for the widget class having the unique typecode. See WDS_Widget for information on typecode. The type_name is used to match names in Look-and-Feel (.laf) files.



WDS_Look *LookupLook(long *typecode)
Returns the WDS_Look for the specified typecode. This is a costly operation. WDS itself caches these lookups for look inheritance.



long SearchForElement(long *typecode,long value,long state,long element)
Interpret the value for an element following the look-and-feel inheritance rules for defaults. These rules follow through the following WDS_Look specifications until an unmapped non-default value is found. Mapping can applied along the way.

  1. WDS_Look of specific widget instance
  2. WDS_Look of widget's class
  3. WDS_Look of each inherited widget class (in order, where WDS_ELEMENT_INHERIT is set)
  4. WDS_Look of WDS_Widget
  5. current colors set for EW_Window (colors only)


Otherwise, zero is used. This function is generally only used internally. Widgets and applications should use long WDS_Widget::InterpretElement(long state,long element), which calls this function.



long LoadFromFile(char *name)
Loads look and feel configuration name, such as "motif". The files name.laf, _name.laf, and .name.laf are searched for in the colon-separated path defined in the environment variable WDS_LOOK_PATH, or by current default: .:~ . All occurances of these files found are cumulatively loaded in the order listed. Each WDS_Look found is loaded and registered. Previously registered look's that are not found are left unchanged.



void Initialize(long set,WDS_Looks *default_looks)
Readjusts the entire look and feel for the specified style set, which is one of:

This method is partially outdated in preference to LoadFromFile(). Currently, only WDS_LOOK_DEFAULT is supported as a fallback in case no look-and-feel files can be found.


The default_looks gives a list a WDS_Look's which can potentially contain entries with WDS_ELEMENT_CALLBACK_INIT set. If so, these callbacks are called. If default_looks is NULL, WDS_Widget is searched.



void Dump(long code)
Print the table of looks for debugging. The code is printed somewhere in the format and can be any number.


LOOK-AND-FEEL FILE FORMAT

Generally, a look-and-feel (.laf) file is a collection of matrices (tables) defining the default setting of each element in each state for each uniquely typecode'd class. Since the matricies are inherently sparse, the format allows for definition of mulitple subsets of the full matrix. An example from win32.laf is



for WDS_Look WDS_DividerTab
// selectable buttons on top of divider widget
set *   IN_FROM WDS_Button
header  WIDGET  LIT         HLIT        BORDER
row *   MAP|BG  MAP|LIT     MAP|HLIT    SMOOTH|ROUND|OUT|OM_BOT

header  INSET   LABELX      LABELY
row S1  -2      0           2

set *   SUB_IN  1
set S1  SUB_IN  3
end


Each WDS_Look is enclosed in a

	for-type-name-body-end
construct. Elements can be specified in two ways. Individual elements can be specified with
	set state element setting
Subsets of the table can be defined using

	header element1 element2 ... elementn
	row state	setting1 setting2 ... settingn

The header remains current until reset, even after lines using set. All states can be set at once using the state wildcard "*". The pipe (|) can be used to OR values. Comments are preceded with "//", like C++. Included files and defined constants follow in C/C++ convention like:

	#include "standard.laf"

	#define IN_FROM 21

Defines permit simple pipe (|) OR'ing, but nothing more. No C++ pre-processor is used. Note that a laf file consisting purely of includes, defines, and comments (no tables) is C++ compatible.


The current "standard.laf" should probably be included in every .laf file since it maps the short names into the current numeric values. The short names corresponding to the contants described in the WDS_Look man page are as follows:


States
S0 WDS_STATE_0
S1 WDS_STATE_1
S2 WDS_STATE_2
S3 WDS_STATE_3
S4 WDS_STATE_4
S5 WDS_STATE_5


Elements
UNUSED EW_COLOR_UNUSED
PEN EW_COLOR_PEN
WIDGET EW_COLOR_WIDGET
BG EW_COLOR_BACKGROUND
LIT EW_COLOR_LIT
HLIT EW_COLOR_HALF_LIT
SHADOW EW_COLOR_SHADOW
HSHADOW EW_COLOR_HALF_SHADOW

BORDER WDS_ELEMENT_BORDER
PREFX WDS_ELEMENT_PREF_X
PREFY WDS_ELEMENT_PREF_Y
INDENT WDS_ELEMENT_INDENT
OUTDENT WDS_ELEMENT_OUTDENT
DEPTH WDS_ELEMENT_DEPTH
INSET WDS_ELEMENT_INSET
INSETMY WDS_ELEMENT_INSET_MODY
SUB_IN WDS_ELEMENT_SUBINSET
SUB_IMY WDS_ELEMENT_INSET_MODY
SUB_IND WDS_ELEMENT_SUBINDENT
SUB_OUT WDS_ELEMENT_SUBOUTDENT

LABELX WDS_ELEMENT_LABEL_X
LABELY WDS_ELEMENT_LABEL_Y
ANNMODE WDS_ELEMENT_ANNOTATION_MODE
ANNOTEX WDS_ELEMENT_ANNOTATION_X
ANNOTEY WDS_ELEMENT_ANNOTATION_Y
IN_FROM WDS_ELEMENT_INHERITANCE
CALLBK WDS_ELEMENT_CALLBACK_INIT

U0 WDS_ELEMENT_UNION_0
U1 WDS_ELEMENT_UNION_1
U2 WDS_ELEMENT_UNION_2
U3 WDS_ELEMENT_UNION_3
U4 WDS_ELEMENT_UNION_4

BT_SENS WDS_ELEMENT_BUTTON_SENSE_ANNOTATION

HN_LINE WDS_ELEMENT_HNODE_LINES

GS_SHAL WDS_ELEMENT_GETSTR_SCOPE_SHALLOW
GS_UNFG WDS_ELEMENT_GETSTR_UNSELECT_FG
GS_FG WDS_ELEMENT_GETSTR_SELECT_FG
GS_BG WDS_ELEMENT_GETSTR_SELECT_BG
GS_HIBG WDS_ELEMENT_GETSTR_HIGHLIGHT_BG

TL_HIBG WDS_ELEMENT_TEXTLIST_HIGHLIGHT_BG

FM_SEP WDS_ELEMENT_FORM_SEPARATOR
FM_ID WDS_ELEMENT_FORM_INDENT
FM_IDAF WDS_ELEMENT_FORM_INDENT_AFTER
FM_SEL WDS_ELEMENT_FORM_COLOR_SELECT

PT_SEP WDS_ELEMENT_PARTITION_SEPARATOR
PT_KNOB WDS_ELEMENT_PARTITION_KNOB_OFFSET
PT_GRBW WDS_ELEMENT_PARTITION_GRAB_WIDTH
PT_GRBL WDS_ELEMENT_PARTITION_GRAB_LENGTH

SR_SCBL WDS_ELEMENT_SCROLLREGION_SCROLLABLE

SB_WDTH WDS_ELEMENT_SCROLLBAR_WIDTH
SB_CHLD WDS_ELEMENT_SCROLLBAR_CHILDREN

PP_HAND WDS_ELEMENT_POPUP_IDLE_HANDOFF

DV_SLFM WDS_ELEMENT_DIVIDER_SLIDEFORM
DV_OVER WDS_ELEMENT_DIVIDER_OVERLAP

PB_WDTH WDS_ELEMENT_PICKBUTTON_WIDTH

PK_AOFF WDS_ELEMENT_PICK_AUTO_OFFSET
PK_MNTN WDS_ELEMENT_PICK_MAINTAIN_BUTTON
PK_HMAX WDS_ELEMENT_PICK_WIN_HEIGHT_MAX

MB_WDTH WDS_ELEMENT_MENUBUTTON_WIDTH


Settings
FALSE 0
TRUE 1

INH WDS_ELEMENT_INHERIT
DEF WDS_ELEMENT_DEFAULT
MAP WDS_ELEMENT_MAP
INMAP (INH|MAP)
INDEF (INH|DEF)
x INDEF

BLACK EW_BLACK
MGREY EW_MEDGREY
LGREY EW_LIGHTGREY
WHITE EW_WHITE
DGREY EW_DARKGREY
PINK EW_PINK
LGREEN EW_LIGHTGREEN
BLUEGRN EW_BLUEGREEN

BLUE EW_BLUE
GREEN EW_GREEN
CYAN EW_CYAN
YELLOW EW_YELLOW
RED EW_RED
MAGENTA EW_MAGENTA
OLIVE EW_OLIVE
PURPLE EW_PURPLE

BDRLESS WDS_BEVELBOX_BORDERLESS
SEAM WDS_BEVELBOX_SEAM
RIDGE WDS_BEVELBOX_RIDGE
IN WDS_BEVELBOX_IN
OUT WDS_BEVELBOX_OUT
GROOVE WDS_BEVELBOX_GROOVE
BORDERD WDS_BEVELBOX_BORDER
RIDGED WDS_BEVELBOX_RIDGED
MOAT WDS_BEVELBOX_MOAT
SMOOTH WDS_BEVELBOX_SMOOTH
ROUND WDS_BEVELBOX_ROUND
OM_RIGT WDS_BEVELBOX_OMIT_RIGHT
OM_LEFT WDS_BEVELBOX_OMIT_LEFT
OM_TOP WDS_BEVELBOX_OMIT_TOP
OM_BOT WDS_BEVELBOX_OMIT_BOTTOM

POINT WDS_BEVELBOX_POINT
PT_VERT WDS_BEVELBOX_POINT_VERTICAL
PT_BACK WDS_BEVELBOX_POINT_BACK
PT_RIGT WDS_BEVELBOX_POINT_RIGHT
PT_LEFT WDS_BEVELBOX_POINT_LEFT
PT_UP WDS_BEVELBOX_POINT_UP
PT_DOWN WDS_BEVELBOX_POINT_DOWN
ANGLE45 WDS_BEVELBOX_ANGLE_45
POINT45 WDS_BEVELBOX_POINT_45
LBL_LFT WDS_BEVELBOX_LABEL_LEFT
ELLIPSE WDS_BEVELBOX_ELLIPTICAL
CHECK WDS_BEVELBOX_CHECKMARK
PLUS WDS_BEVELBOX_PLUSMARK
MINUS WDS_BEVELBOX_MINUSMARK

SB_NONE WDS_SCROLLBAR_CHILDREN_NONE
SB_SLAV WDS_SCROLLBAR_CHILDREN_SLAVES
SB_OPP WDS_SCROLLBAR_CHILDREN_OPPOSE
SB_ALT WDS_SCROLLBAR_CHILDREN_ALTERNATE
SB_INSD WDS_SCROLLBAR_CHILDREN_INSIDE

SR_OFF WDS_SCROLLABLE_OFF
SR_ON WDS_SCROLLABLE_ON
SR_VIEW WDS_SCROLLABLE_VIEWABLE
SR_VIS WDS_SCROLLABLE_VISIBLE
SR_PERS WDS_SCROLLABLE_PERSISTANT
SR_OPP WDS_SCROLLABLE_OPPOSE
SR_AUTO WDS_SCROLLABLE_AUTOSCALE

AN_OFF WDS_WIDGET_ANNOTATION_OFF
AN_ON WDS_WIDGET_ANNOTATION_ON
AN_TOP WDS_WIDGET_ANNOTATION_TOP
AN_LEFT WDS_WIDGET_ANNOTATION_LEFT
AN_RGHT WDS_WIDGET_ANNOTATION_RIGHT
AN_IMBD WDS_WIDGET_ANNOTATION_IMBED
AN_SQR WDS_WIDGET_ANNOTATION_SQUARE_WIDGET


FILES

wds/look.h Look-and-feel header file


SEE ALSO

WDS_intro(3), WDS_Look(3), WDS_Widget(3)