Download O2Look User Manual

Transcript
O2Look
User Manual
Release 5.0 - May 1998
In for m ation in t h is docu m en t is su bject t o ch an ge with ou t
n ot ice an d sh ou ld n ot be con str u ed as a com m it m en t by
O2 Tech n ology.
Th e soft war e descr ibed in th is docu m en t is deliver ed u n der a
licen se or n on disclosu r e agr eem en t.
Th e soft war e can on ly be u sed or copied in accor dan ce wit h t h e
ter m s of th e agr eem en t . It is again st t h e law t o copy t h is
soft war e on m agn et ic t ape, disk , or an y ot h er m ediu m for an y
pu r pose ot h er t h an t h e pu r ch aser ’s own u se.
Copyr igh t 1992-1998 O 2 Tech n ology.
All r igh t s r eser ved. No par t of t h is pu blicat ion can be
r epr odu ced, st or ed in a r et r ieval syst em or t r an sm it t ed in an y
for m or by an y m ean s, elect r on ic, m ech an ical, ph ot ocopy
with ou t pr ior wr itt en per m ission of O2 Tech n ology.
O2 , O 2 En gin e API, O2 C, O2 DBAccess, O2 En gin e, O2 Gr aph ,
O2 Kit , O2 Look , O2 St or e, O2 Tools, an d O2 Web ar e r egist er ed
tr adem ar k s of O2 Tech n ology.
SQL an d AIX ar e r egist er ed t r adem ar k s of In t er n at ion al
Bu sin ess Mach in es Cor por at ion .
Su n , Su n OS, an d SOLARIS ar e r egist er ed t r adem ar k s of Su n
Micr osystem s, In c.
X Win dow System is a r egist er ed tr adem ar k of t h e
Massach u set t s In st itu t e of Tech n ology.
Un ix is a r egist er ed t r adem ar k of Un ix Syst em Labor at or ies, In c.
HPUX is a r egist er ed t r adem ar k of H ewlet t -Pack ar d Com pan y.
BOSX is a r egist er ed t r adem ar k of Bu ll S.A.
IRIX is a r egist er ed t r adem ar k of Siem en s Nixdor f, A.G.
NeXTSt ep is a r egister ed t r adem ar k of t h e NeXT Com pu t er , In c.
Pu r ify, Qu an t ify ar e r egist er ed tr adem ar k s of Pu r e Soft war e In c.
Win dows is a r egist er ed t r adem ar k of Micr osoft Cor por ation .
All oth er com pan y or pr odu ct n am es qu ot ed ar e t r adem ar k s or
r egist er ed t r adem ar k s of t h eir r espect ive t r adem ar k h older s.
Who should read this manual
Th is m an u al det ails h ow t o u se t h e O2 Look pr ogr am m in g r ou t in es
(fu n ct ion s an d m et h ods) in you r m et h ods an d pr ogr am s. It t h en
descr ibes h ow t o cu st om ize you r applicat ion in t er face an d t h e
O2 Widget Look in t er face. Th is m an u al m u st be r ead t oget h er wit h eit h er
t h e O 2 C Refer en ce m an u al, ODM G C++ Bin din g Gu ide, or t h e C
in t er face t o O 2 Man u al.
Ot h er docu m en t s available ar e ou t lin ed, click below.
See O2 Documentation set.
TABLE OF CONTENTS
Th is m an u al is divided in t o t h e followin g ch apt er s:
• 1 - In t r odu ct ion
• 2 - M et h ods an d fu n ct ion s
• 3 - M ask s
• 4 - Resou r ces
• 5 - Widget Look
O2Look User Man u al
5
TABLE OF CONTENTS
O2Look
i
Who should read this manual ....................................................... iii
See O2 Documentation set. .......................................................... iii
1
Introduction
11
1.1 O2 Product Line ....................................................................... 12
1.2 Features and advantages........................................................ 14
Easy to update and user-friendly ................................................. 14
Easy to use and customize........................................................... 14
Open and Integrated .................................................................... 15
1.3 Presentations ........................................................................... 16
1.4 Drag and Drop.......................................................................... 18
1.5 Programming with O2Look ..................................................... 19
Methods ....................................................................................... 19
Functions ..................................................................................... 20
Masks and Resources .................................................................. 20
1.6 User Manual overview ............................................................. 21
2
Methods and Functions
23
2.1 Introduction.............................................................................. 24
System-defined C types............................................................... 24
O2C options................................................................................. 25
2.2 Display methods ...................................................................... 25
all_presentations .......................................................................... 27
consult ......................................................................................... 28
disable_method............................................................................ 29
display ......................................................................................... 31
edit ............................................................................................... 33
enable_method............................................................................. 35
erase_all....................................................................................... 36
present ......................................................................................... 37
refresh_all .................................................................................... 38
6
O2Look User Man u al
TABLE OF CONTENTS
rubout........................................................................................... 39
2.3 Callback methods .................................................................... 40
bitmap .......................................................................................... 41
erase............................................................................................. 43
menu ............................................................................................ 44
save .............................................................................................. 46
title............................................................................................... 47
2.4 Library functions ..................................................................... 49
lk_all_mapped_presentations ...................................................... 50
lk_all_presentations..................................................................... 51
lk_consult .................................................................................... 52
lk_current_presentation ............................................................... 54
lk_delete_all ................................................................................ 56
lk_delete_presentation................................................................. 57
lk_epilogue .................................................................................. 58
lk_free.......................................................................................... 59
lk_grab......................................................................................... 60
lk_map ......................................................................................... 61
lk_present .................................................................................... 64
lk_prologue.................................................................................. 66
lk_refresh_presentation ............................................................... 68
lk_unmap ..................................................................................... 70
lk_wait ......................................................................................... 71
3
Masks
73
3.1 Introduction.............................................................................. 74
Mask Functions ........................................................................... 74
Resource specification in Functions............................................ 76
3.2 Functions.................................................................................. 79
lk_atom ........................................................................................ 80
lk_destroy_mask.......................................................................... 82
lk_generic .................................................................................... 83
lk_list ........................................................................................... 85
lk_method .................................................................................... 87
lk_object ...................................................................................... 89
O2Look User Man u al
7
TABLE OF CONTENTS
lk_protected..................................................................................92
lk_set ............................................................................................94
lk_specific ....................................................................................96
lk_tuple.........................................................................................97
4
Graphic Resources
101
4.1 Using graphic resources .......................................................102
4.2 Resource files.........................................................................102
Special resources for application icons ......................................105
4.3 Resource arrays .....................................................................106
4.4 How to read resource tables .................................................107
Name ..........................................................................................108
Type ...........................................................................................108
Default........................................................................................110
Access ........................................................................................110
4.5 Global resources .................................................................... 111
4.6 Presentation resources ......................................................... 113
4.7 Graphic resources for integers............................................. 115
4.8 Graphic resources for real numbers .................................... 116
4.9 Graphic resources for characters......................................... 117
4.10 Graphic resources for strings............................................... 118
4.11 Graphic resources for boolean values................................. 119
4.12 Graphic resources for lists....................................................121
4.13 Graphic Resources for sets ..................................................125
4.14 Graphic resources for tuples ................................................129
4.15 Graphic Resources for Objects ............................................131
8
O2Look User Man u al
TABLE OF CONTENTS
5
Widget Look
137
5.1 Introduction............................................................................ 138
5.2 Tools ....................................................................................... 138
Xo2Look.................................................................................... 139
Xo2CreateLook ......................................................................... 143
Xo2SetO2Value......................................................................... 144
Xo2ConsultO2Value ................................................................. 146
INDEX
O2Look User Man u al
147
9
TABLE OF CONTENTS
10
O2Look User Man u al
1
I ntr oduction
1
YOUR GUI GENERATOR
Con gr at u lat ion s! You ar e n ow a u ser of O 2 Look - a tool for t h e design
an d developm en t of th e Gr aph ical User In t er face of you r applicat ion .
To face t h e t ech n ical ch allen ge of design in g an d im plem en t in g a
Gr aph ical User In t er face, O 2 Look pr ovides softwar e developer s wit h a
power fu l in t egr at ed t ool en ablin g t h e on -scr een gr aph ical display an d
in t er act ive m an ipu lation of com plex an d m u lt im edia object s an d
in volvin g n o pr ogr am m in g an d n o dr awin g.
Th is in tr odu ct or y ch apt er is divided as follows:
• O2 Pr odu ct Lin e
• Feat u r es an d advan t ages
• Pr esen t at ion s
• D r ag an d Dr op
• Pr ogr am m in g wit h O2Look
• User Man u al over view
O2 Look User Man u al
11
1
Introduction
1.1 O2 Product Line
Th e syst em ar ch it ect u r e of O2 is illu st r at ed in Figu r e 1.1..
External
Interfaces
Development Tools
O2 Dev. Tools
Standard
Dev. Tools
O2Look
OQL
O2C
C++
C
O2ODBC
Java
O2Corba
Database Engine
O2Engine
O2Store
O2DB
Access
O2Web
Fi gu r e 1 .1 : O2 Sy st em Ar ch i t ect u r e
Th e O 2 system can be viewed as con sist in g of t h r ee com pon en t s. Th e
Database Engine pr ovides all t h e feat u r es of a D at abase syst em an d an
object -or ien t ed syst em . Th is en gin e is accessed wit h Development Tools ,
su ch as var iou s pr ogr am m in g lan gu ages, O 2 developm en t t ools an d an y
st an dar d developm en t tool. Nu m er ou s External Interfaces ar e pr ovided.
All en com passin g, O 2 is a ver sat ile, por t able, dist r ibu t ed, h igh per for m an ce dyn am ic object -or ien ted dat abase system .
Database En gin e:
12
• O2 St or e
Th e dat abase m an agem en t syst em pr ovides low level
facilit ies, t h r ou gh O2 Stor e API, t o access an d m an age a
dat abase: disk volu m es, files, r ecor ds, in dices an d
t r an sact ion s.
• O2 En gin e
Th e object dat abase en gin e pr ovides dir ect con t r ol of
sch em as, classes, object s an d t r an sact ion s, t h r ou gh
O2 En gin e API. It pr ovides fu ll t ext in dexin g an d sear ch
capabilit ies wit h O 2 Sear ch an d spat ial in dexin g an d
r et r ieval capabilit ies wit h O 2 Spat ial. It in clu des a
Not ificat ion m an ager for in for m in g oth er clien t s
con n ect ed t o t h e sam e O 2 ser ver t h at an even t h as
occu r r ed, a Ver sion m an ager for h an dlin g m u lt iple
object ver sion s an d a Replicat ion API for syn ch r on izin g
m u lt iple copies of an O2 system .
O2 Look User Man u al
O2 Product Line
Pr ogr am m in g Lan gu ages:
O 2 object s m ay be cr eat ed an d m an aged u sin g t h e followin g
pr ogr am m in g lan gu ages, u tilizin g all t h e featu r es available wit h O2
(per sist en ce, collection m an agem en t , t r an sact ion m an agem en t , OQL
qu er ies, et c.)
• C
O2 fu n ct ion s can be in vok ed by C pr ogr am s.
• C++
OD MG com plian t C++ bin din g.
• J ava
OD MG com plian t J ava bin din g.
• O2 C
A power fu l an d elegan t object-or ien t ed fou r t h
gen er at ion lan gu age specialized for easy developm en t
of object dat abase applicat ion s.
• OQL
OD MG st an dar d, easy-t o-u se SQL-lik e object qu er y
lan gu age wit h special feat u r es for dealin g wit h com plex
O2 object s an d m eth ods.
O 2 Developm en t Tools:
• O2 Gr aph
Cr eat e, m odify an d edit an y t ype of object gr aph .
• O2 Look
Design an d develop gr aph ical u ser in ter faces, pr ovides
in t er active m an ipu lation of com plex an d m u ltim edia
object s.
• O2 Kit
Libr ar y of pr edefin ed classes an d m et h ods for fast er
developm en t of u ser applicat ion s.
• O2 Tools
Com plet e gr aph ical pr ogr am m in g en vir on m en t t o
design an d develop O 2 dat abase applicat ion s.
St an dar d Developm en t Tools:
All stan dar d pr ogr am m in g lan gu ages can be u sed wit h st an dar d
en vir on m en t s (e.g. Visu al C++, Su n Spar cwor k s).
Exter n al In t er faces:
• O2 Cor ba
Cr eat e an O2 / Or bix ser ver t o access an O2 dat abase
wit h CORBA.
• O2 DBAccess Con n ect O2 applicat ion s to r elation al dat abases on
r em ot e h ost s an d in vok e SQL st at em en ts.
• O2 OD BC
Con n ect r em ot e ODBC clien t applicat ion s t o O2
dat abases.
• O2 Web
Cr eat e an O2 Wor ld Wide Web ser ver t o access an O 2
dat abase th r ou gh t h e in t er n et n etwor k .
O2 Look User Man u al
13
1
Introduction
1.2 Features and advantages
O 2 Look en ables you t o design an d cr eat e t h e gr aph ical u ser in t er face of
you r object -or ien t ed dat abase applicat ion s.
It is u n iqu e becau se it au t om at ically cr eat es th e gr aph ical display of an y
dat abase object .
It offer s soft war e developer s a power fu l in t egr at ed tool en ablin g t h e on scr een gr aph ical display an d in t er act ive m an ipu lat ion of com plex an d
m u lt im edia object s, an d in volves n o dr awin g an d n o pr ogr am m in g.
Som e of its featu r es in clu de:
• dir ect dr ag an d dr op oper at ion s on objects.
• th e applicat ion can con t r ol t h e in ter act ive dialog bet ween t h e
applicat ion an d t h e en d u ser .
• O2 Look au tom at ically cr eat es a m en u fr om wh ich object m et h ods can
be t r igger ed.
• you can easily cu stom ize t h e O2 Look pr esen t at ion t o m eet you r
specific n eeds.
• lin k s can be cr eat ed bet ween pr esen t at ion win dows for dispat ch in g
act ion s (lik e m ovin g, icon ifyin g, savin g).
Easy to update and user-friendly
You can t est you r O2 Look gr aph ical u ser in t er face im m ediat ely givin g
you extr em ely fast pr ot ot ypin g facilit ies.
An y ch an ges you m ak e t o you r applicat ion can be r eflect ed in t h e
in t er face at a ver y low cost an d ver y easily.
Th is en ables you r en d application t o be ext r em ely u ser -fr ien dly becau se
it s gr aph ical u ser in t er face is coh er en t an d u ser -fr ien dly an d can be
fu lly cu st om ized t o m eet t h e specific n eeds an d expect at ion s of all you r
en d-u ser s.
Easy to use and customize
You n eed n o pr ogr am m in g exper ien ce t o u se t h e t oolk it sin ce
developm en t wit h O2 Look is code fr ee.
14
O2 Look User Man u al
Features and advantages
Th e gr aph ical pr esen tation of an y object in t h e dat abase is
au t om at ically bu ilt , ir r espect ive of it s com plexity, by r eadin g it s class
defin ition . O 2 Look au tom at ically cr eat es a m en u fr om wh ich object
m et h ods can be t r igger ed an d wh ich pops u p a dialog box for en t er in g
par am eter s.
Abou t t wen t y pr edefin ed m eth ods per m it t in g t h e display an d t h e
m an ipu lat ion of pr esen t at ion s ar e at t ach ed t o t h e class Object an d
in h er it ed by an y su bclass.
Alt h ou gh O 2 Look au tom at ically gen er at es gen er ic pr esen t at ion s of
object s an d valu es t h at can be u sed im m ediat ely, you can easily
cu st om ize t h ese pr esen t at ion s t o m eet you r own r equ ir em en t s. You can
also u se t ailor -m ade pr esen t at ion s.
For t h e easy cu stom izat ion of an object 's pr esen t at ion , you h ave a Mask
m ech an ism th at en ables you t o defin e wh ich par t s of an object ar e
visible. M ask s also give you t h e u se of t h e t ext, bit m ap, im age, an d
widget edit or s 1 u sed in con ju n ct ion wit h O2 Kit.
A Resou r ces m ech an ism descr ibes t h e gr aph ical aspect (e.g. color , fon t ),
t h e m en u an d t h e editabilit y of an object . You can m odify r esou r ces
wit h ou t r e-com pilin g you r applicat ion .
You r en d-u ser s can m odify r esou r ces n ot specified dir ect ly in th e
applicat ion by t h e developer .
Open and Integrated
You r O2 Look pr esen t at ion s ar e displayed wit h OSF/ Motif look an d feel.
For m or e specific n eeds you can u se O 2 Look in con ju n ct ion wit h ot h er
gr aph ic t ools su ch as O2 Xt an d O2 Widget Look .
O 2 Look is fu lly in t egr at ed wit h O2 En gin e in C, C++ an d O 2 En gin e API.
Wh en u sed wit h O2 C, O2 Look con st it u t es a power fu l 4t h gen er at ion
object -or ien t ed lan gu age.
1. Also t h e graph edit or of O2 Gr aph .
O2 Look User Man u al
15
1
Introduction
Fi gu r e 1 .2 : O2 Look p r esen t a t i on s
1.3 Presentations
O2 Look is a gr aph ical u ser in ter face for t h e O 2 object -or ien t ed dat abase
m an agem en t syst em . It oper at es u n der t h e X Win dow Syst em , u ses of
t h e M ot if widget libr ar y, an d con for m s t o t h e r ecom m en dat ion s of t h e
Mot if st yle gu ide.
16
O2 Look User Man u al
Presentations
Fu n ct ion ally, O2 Look is a Mot if ext en sion dedicat ed to t h e scr een
display an d m an ipu lat ion of O2 object s an d valu es.
You can display an y O 2 object or valu e, r egar dless of it s dat a t ype, in a
r e-sizable Mot if win dow called a pr esen t at i on .
For exam ple, con sider a class Person defin ed as follows:
class Person
public type tuple (name: string,
age: integer,
position: string,
spouse: Person,
children: list(Person))
method public birthday: integer
end;
Wit h O 2 Look , you u se var iou s m et h ods an d fu n ct ion s t o display an
object of t h is class in t h e followin g t ype of win dow sh own in Figu r e 1.3.
A
B
C
D
E
F
Fi gu r e 1 .3 : O2 Look Pr esen t a t i on
A: Pen ci l bu t t on
B: Er a ser bu t t on
C: Pu bl i c m et h od s m en u
D: Pr esen t a t i on t i t l e
E: Obj ect con t en t s
F: Com p on en t obj ect i con
O2 Look User Man u al
17
1
Introduction
If you ar e allowed to car r y ou t m odification s in t h e win dow t h er e is
always a pen cil (A ) an d an er aser (B ) bu t t on .
If you can on ly r ead t h e con t en t s of t h e win dow, t h er e is on ly an er aser
bu t t on .
To r em ove t h e display, click on t h e Pen cil or t h e Er aser bu t t on . To save
you r m odificat ion s, click on Pen cil. Th e valu e is u pdat ed an d th e
pr esen t at ion disappear s. If you click on t h e Er aser all m odificat ion s ar e
ign or ed an d t h e pr esen t at ion disappear s 1 .
Th e pu blic m et h ods m en u appear s wh en you click th e left m ou se bu t t on
on t h e m en u bu tt on (C) of an object pr esen t at ion .
Th e pr esen t at ion tit le (D) is, by defau lt , t h e class n am e of t h e object
bein g displayed (an d is t h er efor e blan k for valu es). You can ch an ge t h e
pr esen t at ion t itle fr om t h e defau lt class t it le of t h e object . If th e
pr esen t at ion sh ows an object t h at is a com pon en t of an ot h er object (F ),
each object h as it s own pop-u p m en u wh ich is displayed by click in g on
t h e Object icon u sin g th e r igh t m ou se bu t t on .
Note
Th e pr esen t at ion of a valu e, of cou r se, h as n o pu blic m et h ods m en u (C)
an d n o t it le (D).
1.4 Drag and Drop
Th e O 2 Look dr ag an d dr op m ech an ism allows you t o copy or m ove a
select ed elem en t t o a differ en t locat ion .
Wh en you copy an elem en t , t h e or igin al r em ain s u n ch an ged an d t h e
copy is past ed in to t h e n ew locat ion .
Wh en copyin g elem en t s, if th e t ype is a valu e, you can copy th e valu e,
bu t if th e t ype is an object , you can on ly sh ar e t h e object .
Wh en you m ov e an elem en t , t h e or igin al elem en t is cu t fr om t h e sou r ce
an d is past ed in t o t h e n ew locat ion .
1. You con t rol th e appearan ce an d u t ilizat ion of t h ese t wo bu tt on s u sin g t h e lk _wait an d
lk _gr ab fu n ct ion s descr ibed in Section 2.3.
18
O2 Look User Man u al
Programming with O2Look
To dr ag an elem en t , select it u sin g t h e m iddle m ou se bu tt on an d dr ag it
t o t h e locat ion of you r ch oice.
Be car efu l wh en select in g an d dr aggin g elem en ts t h at you ar e actu ally
allowed t o copy an d m ove t h ese elem en t s, an d t h at t h e dest in at ion will
accept t h e elem en t s in qu est ion :
• Wh en you dr ag an elem en t t h at can n ot be cu t fr om th e sou r ce, th e
oper at ion is au t om at ically a copy oper at ion , e.g, dr aggin g a tu ple
at t r ibu t e or an it em of a n on -edit able collection .
• If it can be cu t fr om t h e sou r ce, th e oper at ion is au t om at ically a m ove
oper at ion , e.g, dr aggin g an it em fr om an edit able collect ion .
• Pr essin g t h e "Ctr l" k ey wh en dr aggin g im plies a copy oper at ion even if
th e elem en t can be cu t.
1.5 Programming with O2Look
You cr eat e an d m an ipu lat e pr esen t at ion s u sin g var iou s t ools su pplied
wit h O2 Look .
Methods
Th e m ost basic O2 Look oper ation on an O2 object is t o in vok e a system defin ed m et h od on it .
For exam ple, t o cr eat e a pr esen t at ion t h at displays t h e valu e of t h e
object tintin an d t h en wait s for t h e en d-u ser t o ack n owledge it , you
sim ply u se t h e followin g O 2 C code:
tintin->display;
All t h e var iou s syst em -defin ed m et h ods you can u se t o gen er ically
display objects ar e given in Sect ion 2.3. Also given ar e t h e O2 Look
callback m et h ods t h at con t r ol som e par t of t h e aspect an d beh avior of
pr esen t at ion s. Th is in clu des t h e bit m ap im age u sed for an icon , or wh at
h appen s wh en t h e Pen cil bu tt on is click ed.
O2 Look User Man u al
19
1
Introduction
Functions
To bu ild an d m an ipu lat e pr esen t at ion s for v al u es, you in vok e an
O 2 Look fu n ct ion (as valu es h ave n o m et h ods). Th is fu n ct ion libr ar y is
given in Sect ion 2.4.
Sever al of t h ese fu n ct ion s sim ply r epeat th e oper at ion s of t h e m et h ods
(som et im es wit h m or e soph ist icat ed opt ion s). If you u se t h ese fu n ct ion s
wit h t h eir defau lt par am et er s, it is oft en th e sim plest way t o con st r u ct a
gr aph ic application qu ick ly an d clean ly.
You can u se t h e O2 Look libr ar y fu n ction s t o display an d m an ipu lat e
object s as well as valu es. In fact for h igh ly specialized gr aph ic
applicat ion s, you n eed th e elabor at e opt ion s of t h ese fu n ct ion s as th ey
su pply a flexible m ean s to defin e an d m an ipu lat e pr esen t at ion s.
On e ver y im por tan t way is t o specify pr esen tation m ask s.
Masks and Resources
A m ask defin it ion descr ibes a t em plat e for t h e for m at of a pr esen t at ion :
wh ich t u ple at tr ibu t es ar e t o be displayed, for exam ple, an d wh ich can
be m odified. Most O2 Look oper at ion s u se defau lt m ask s.
H owever , you can fin d t h at t h e st an dar d m ask s ar e n ot su it able for all
sit u ation s. You h ave con t r ol over t h e gr aph ic r esou r ces u sed by t h e
syst em t o bu ild win dows.
Gr aph ic r esou r ces in clu de color , fon t s, icon an d bu t t on bit m aps, an d
wh et h er or n ot t h e displayed dat a can be m odified.
O 2 Look r esou r ces ar e an ext en sion of X Win dow an d M ot if r esou r ces.
Som e O2 Look fu n ction s r et u r n er r or codes, bu t t h ese ar e u sefu l m ain ly
t o ascer t ain wh et h er ever yt h in g wen t well or n ot.
Ru n -tim e er r or s ar e h an dled by O 2 Look itself; an appr opr iat e er r or
m essage is displayed on t h e scr een . If t h e er r or is r ecover able (for
exam ple, t h e specificat ion of a m ask in appr opr iate for th e valu e bein g
displayed), a “War n in g” or “At t en t ion ” m essage is displayed, an d a
defau lt act ion is t ak en (u se of a defau lt m ask , for exam ple).
If t h e er r or is ser iou s, an “Er r or ” m essage is displayed an d t h e O2 Look
fu n ct ion t er m in ates im m ediat ely with a n on -zer o r et u r n ed valu e.
20
O2 Look User Man u al
User Manual overview
1.6 User Manual overview
Th e O2 Look User m an u al is divided u p in t o t h e followin g ch apt er s:
• Chapter 1 - Introduction
Th is ch apter in t r odu ces t h e feat u r es an d advan t ages O 2 Look offer s you .
It th en in t r odu ces t h e basic con cept s of O2 Look Pr esen t at ion s an d
over views h ow t o pr ogr am you r applicat ion u sin g O2 Look u sin g t h e
syst em -su pplied m eth ods, fu n ct ion s, m ask s an d gr aph ic r esou r ces.
Fin ally it gives t h e syst em -defin ed C t ypes you n eed t o u se O2 Look .
• Chapter 2 - Methods and Functions
Th is ch apt er in t r odu ces t h e syst em defin ed C t ypes an d opt ion s O2 C
you n eed wh en u sin g O2 Look m et h ods an d fu n ction s to wr it e you r
gr aph ic applicat ion s. It t h en gives t h e syn t ax of all t h e O 2 Look display
an d callback m et h ods, an d all t h e O2 Look libr ar y fu n ct ion s you n eed t o
display an d m an ipu lat e an y object or valu e.
• Chapter 3 - Masks
Th is ch apt er descr ibes h ow t o u se all t h e var iou s O 2 Look m ask s.
• Chapter 4 - Graphic Resources
Th is ch apt er descr ibes h ow t o u se all t h e var iou s O 2 Look gr aph ic
r esou r ces an d gives all t h e r elevan t r esou r ce t ables.
• Chapter 5 - Widget Look
Th is ch apt er descr ibes t h e O2 Widget Look . Th is is an X Toolk it
com pat ible u ser -in ter face com pon en t an d con t ain s all t h e power of
O 2 Look in a sim ple widget .
O2 Look User Man u al
21
1
22
Introduction
O2 Look User Man u al
2
Me thods a nd
Func ti ons
2
Th is ch apt er ou tlin es t h e followin g O2 Look m eth ods an d fu n ction s:
• In t r odu ct ion
• D isplay m et h ods
• Callback m et h ods
• Libr ar y fu n ct ion s
O2 Look User Man u al
23
2
Methods and Functions
2.1 Introduction
Th is sect ion in t r odu ces t h e syst em defin ed C t ypes an d O 2 C opt ion s you
n eed wh en u sin g O 2 Look m et h ods an d fu n ct ion s t o wr it e you r gr aph ic
applicat ion s.
System-defined C types
Th e syst em defin es sever al C t ypes:
• Lk_presentation
Th e Lk_presentation type is associat ed t o O 2 Look pr esen t at ion
win dows. Each pr esen t at ion defin ition is an in st an ce of t h is t ype.
• Lk_mask
Th is t ype is associated t o display m ask s u sed with in pr esen t at ion s.
Each display m ask is an in st an ce of t h is t ype.
• Lk_attribute_mask
You u se t h is type t o specify th e display m ask of an in dividu al t u ple
at t r ibu t e. It is u sed on ly wit h t h e lk_tuple m ask fu n ct ion .
typedef struct {
char *name;
Lk_mask mask;
} Lk_attribute_mask;
• Lk_resource
Th is t ype is associat ed wit h O2 Look gr aph ic r esou r ces. Each r esou r ce is
specified wit h an in st an ce of t h is t ype:
24
O2 Look User Man u al
Display methods : O2C options
typedef struct {
char *name;
char *value;
} Lk_resource;
O2C options
Th e type defin it ion s, descr ibed above, as well as a n u m ber of
en u m er at ed t ypes u sed in th e Libr ar y fu n ction s, ar e fou n d in a h eader
file called o2_look.h in t h e include su bdir ect or y of t h e O2 in st allat ion
dir ect or y.
Th is h eader file is au t om at ically in clu ded by t h e O2 C com piler for all
O 2 C m et h ods, pr ogr am s an d fu n ct ion s. If t h is cau ses a pr oblem , in th at
for exam ple, you h ave an applicat ion t h at u ses a defin it ion t h at con flict s
wit h t h e o2_look.h defin ition , sim ple u se th e -nolook opt ion of t h e set
opt ion s sch em a com m an d. See t h e O 2 C Refer en ce m an u al for fu r th er
det ails.
Not e t h at t h e o2_look.h h eader file an d it s defin it ion s ar e u sed on ly by
O 2 C code.
You m ay oft en wan t t o design m et h ods an d pr ogr am s t h at t ak e
pr esen t at ion s or m ask s as Ar gu m en t s, or r et u r n t h em as r et u r n ed
valu es.
You sh ou ld t h er efor e t r eat pr esen t at ion s an d m ask s as in t eger s in O 2
dat a defin it ion lan gu age com m an ds, in clu din g m et h od an d pr ogr am
sign atu r es, an d cast as type Lk_presentation or Lk_mask wit h in
m et h od code.
2.2 Display methods
Th e followin g m eth ods ar e att ach ed t o class Object an d can t h er efor e
be sen t t o an y object .
Th ey en able you t o display an d m an ipu lat e gr aph ic r epr esen t at ion s of
object s on t h e scr een .
O2 Look User Man u al
25
2
Methods and Functions
On ly t h e m ost gen er ic of O2 Look fu n ct ion s ar e per for m ed by t h ese
syst em -su pplied m et h ods.
For a m or e specific u se, or for t h e display an d m an ipu lat ion of valu es as
well as object s, u se t h e Libr ar y fu n ct ion s.
Non e of t h e m et h ods descr ibed in t h is ch apt er fu n ct ion in alph an u m er ic
m ode as th ey all r equ ir e O2 Look .
Note
Th e display m et h od descr ibed below fu n ct ion s in bot h m odes,
alth ou gh it h as a par t icu lar beh avior in O2 Look .
Th e followin g system -su pplied display m et h ods ar e descr ibed:
• all_presentations
• consult
• disable_method
• display
• edit
• enable_method
• erase_all
• present
• refresh_all
• rubout
26
O2 Look User Man u al
Display methods
all_presentations
Retu r n s a list of all r eceiver object pr esen tation s.
Summary
Syntax
receiver->all_presentations
Arguments
Non e.
Returns
A valu e of t ype list (integer). Each elem en t in t h e list cor r espon ds
t o a pr esen t at ion . If t h er e ar e n o pr esen tat ion s, t h e em pt y list is
r et u r n ed.
Description
Th e all_presentations m et h od lists all t h e r eceiver object
pr esen tation s defin ed for t h e cu r r en t applicat ion .
Th is in clu des t h ose pr esen t at ion s in wh ich t h e r eceiver object appear s
as a com pon en t as well as t h ose pr esen t at ion s wh ich ar e devot ed to t h e
r eceiver object , an d ir r espect ive of wh et h er t h e pr esen t at ion s ar e
m apped or u n m apped.
Note
If t h e r eceiver object appear s in side a specific edit or , t h at pr esen t at ion is
n ot in clu ded in t h e list .
Example
o2 list (integer) lp;
...
lp = (o2 list(integer)) client->all_presentations;
O2 Look User Man u al
27
2
Methods and Functions
consult
28
Summary
Assign s a n ew valu e t o t h e r eceiver object .
Syntax
receiver->consult (presentation )
Arguments
presentation Th e pr esen t at ion iden t ifier is of t ype Lk_presentation
an d is r et u r n ed by a present m et h od or lk_present
fu n ct ion .
Description
Th e consult m et h od t ak es t h e cu r r en t valu e fr om th e O 2 Look
pr esen t at ion iden t ifier in t h e presentation ar gu m en t , dyn am ically
ch eck s t h e t ypes, an d t h en assign s t h is valu e t o t h e r eceiver object .
Returns
Zer o if all wen t well, or n on -zer o in t eger if th e presentation given does
n ot exist .
Example
selected_hotel->consult (p);
O2 Look User Man u al
Display methods : disable_method
disable_method
Summary
Disables a specified m eth od.
Syntax
receiver->disable_method (method_name)
Arguments
method_name
Description
Th e disable_method m et h od disables t h e m et h od method_name in t h e
m en u of pu blic m eth ods at t ach ed t o r eceiver object pr esen t at ion s, a
m en u wh ich list s all pu blic m et h ods defin ed in or in h er it ed by t h e
object class.
Th e n am e of th e m et h od t o be disabled. Th is is
ch ar act er str in g wh ich can be a var iable defin ed as
char *, an O2 string, or a st r in g lit er al bet ween
dou ble-qu ot es.
Th e m et h od is im m ediat ely disabled for all t h e pr esen t at ion s of t h e
r eceiver object cu r r en t ly defin ed. Th e m et h od n am e is sh adowed on t h e
m en u .
To r ever se t h e disable_method m et h od, r efer t o t h e enable_method
m et h od.
An y pr esen tation defin ed af t er t h e disable_method is u n affect ed.
Returns
Zer o if t h e m et h od is su ccessfu l an d a n on -zer o if t h e m et h od n am e
specified is n ot a pu blic m et h od of t h e r eceiver object class.
Example
o2 Person this_employee = new Person;
Lk_presentation p = this_employee->present(0);
this_employee->disable_method ("view_salary");
lk_map (p, LK_MANUAL, LK_FREE, LK_SCREEN, 0, 0);
lk_grab(p);
In t h e m en u of pu blic m eth ods, view_salary is n ow sh adowed an d you
can n ot select it .
O2 Look User Man u al
29
2
Methods and Functions
methods
refresh_all
erase_all
display
edit
view_salary
Fi gu r e 2 .1 : Met h od s m en u w i t h sh a d ow ed i t em
30
O2 Look User Man u al
Display methods : display
display
Summary
Displays t h e r eceiver object valu e.
Syntax
receiver -> display
Arguments
Non e
Description
Th e display m et h od displays t h e pu blic an d/ or r ead-on ly valu e of t h e
r eceiver object. You can n ot m odify t h e pr esen t at ion con t en ts an d
con sequ en t ly, t h er e is n o Pen cil bu t ton .
Returns
Not h in g
Example
run body {
o2 Person p = new Person, q = new Person,
r = new Person, s = new Person;
p -> name = "Tintin";
p -> age = 24;
p -> position = "Rave_reporter";
p -> spouse = q;
p -> children = list (r, s);
p -> display;
}
If you ar e u sin g O 2 Look , you see t h e win dow sh own in Figu r e 2.2.:
O2 Look User Man u al
31
2
Methods and Functions
Fi gu r e 2 .2 : Di sp l a y m et h od i n O2 L ook
32
O2 Look User Man u al
Display methods : edit
edit
Summary
Displays t h e r eceiver object valu e
Syntax
receiver->edit
Arguments
Non e
Returns
LK_SAVE – if t h e Pen cil bu t ton is click ed, or
LK_ERASE – if t h e Er aser bu t t on is click ed.
Description
Th e edit m et h od is th e sam e as t h e display m et h od descr ibed in th at
it displays t h e r eceiver object valu e on scr een . Th e differ en ce is th at you
can m odify t h e con t en t s of t h e pr esen t at ion win dow an d th er e ar e bot h
Pen cil an d Er aser bu t t on s. On ly pu blic pr oper t ies ar e displayed.
Example
run body {
o2 Person p = new Person, q = new Person,
r = new Person, s = new Person;
p -> name = "Tintin";
p -> age = 24;
p -> position = "Rave_reporter";
p -> spouse = q;
p -> children = list (r, s);
p -> edit;
}
You obt ain t h e followin g pr esen t at ion sh own below in Figu r e 2.3.
O2 Look User Man u al
33
2
Methods and Functions
To r em ove t h e display, click on t h e
Pen cil or t h e Er aser bu tt on , sh own in
Figu r e 2.3.
If you click on Pen cil th e displayed
valu e an d an y ch an ges you h ave
m ade ar e assign ed t o th e r eceiver
object . If you click on Er aser an y
ch an ges you m ade ar e ign or ed.
Fi gu r e 2 .3 : Pr esen t a t i on a f t er a n ed i t m et h od
34
O2 Look User Man u al
Display methods
enable_method
Summary
Rever ses t h e disable_method.
Syntax
receiver->enable_method (method_name)
Arguments
method_name
Description
Th e enable_method m et h od r ever ses disable_method an d r est or es th e
pr eviou sly disabled m eth od method_name in t h e m en u of t h e r eceiver
object pr esen tation s.
Returns
Zer o if su ccessfu l or a n on -zer o in t eger if t h e specified m et h od n am e is
n ot on e of th e pu blic m et h od belon gin g to t h e object class.
Th e n am e of th e m et h od t o be en abled. Th is is a
ch ar act er str in g wh ich can be a var iable defin ed as
char *, an O2 string, or a st r in g lit er al en closed in
dou ble-qu ot es.
Example
Lk_presentation p = this_employee->present(0);
this_employee->disable_method ("view_salary");
...
this_employee->enable_method ("view_salary");
In t h e m en u of pu blic m et h ods, view_salary is n ow en abled (it is n o
lon ger sh adowed) an d you can select it .
methods
refresh_all
erase_all
display
edit
view_salary
Fi gu r e 2 .4 : Met h od s m en u w i t h sh a d ow ed i t em
O2 Look User Man u al
35
2
Methods and Functions
erase_all
Summary
Rem oves all r eceiver object pr esen t at ion s.
Syntax
receiver->erase_all
Arguments
Non e.
Description
Th e erase_all m et h od r em oves all t h e r eceiver object pr esen t at ion s
defin ed in t h e cu r r en t applicat ion .
Mapped pr esen t at ion s ar e er ased fr om t h e scr een , an d t h e defin it ion s of
bot h m apped an d u n m apped pr esen t at ion s ar e deleted. If t h e object is a
com pon en t of t h e pr esen t at ion s of an ot h er object or valu e, t h ese
pr esen t at ion s ar e also er ased.
Note
In th e pr esen t ver sion of O 2 Look , if t h e r eceiver object appear s in side a
specific edit or , t h at pr esen t at ion is n ot er ased.
36
Returns
Zer o if su ccessfu l or a n on -zer o in t eger if on e or m or e of t h e
pr esen t at ion s is lock ed (with an lk_grab or lk_wait fu n ct ion ) an d
can n ot be er ased.
Example
client->erase_all;
O2 Look User Man u al
Display methods : present
present
Summary
Bu ilds a pr esen t at ion of t h e r eceiver object .
Syntax
receiver->present (mask)
Arguments
mask
Description
Th e m ask you wan t t o u se t o bu ild t h e pr esen t at ion is
a valu e of t ype Lk_mask. If left zer o, t h e m eth od t ak es
t h e defau lt m ask lk_protected.
Th e present m et h od bu ilds an object pr esen tation accor din g t o it s
class declar at ion . Th is m et h od does n ot display th e object bu t r et u r n s a
pr esen tation iden t ifier wh ich you can t h en u se in ot h er O2 Look
fu n ct ion s.
You can specify a display m ask (a valu e of t ype Lk_mask) t o u se in t h e
pr esen t at ion . Ot h er wise, a defau lt m ask is u sed. In t h is way th e
present m et h od is m or e flexible t h an t h e display m et h od.
Returns
Th e pr esen t at ion iden tifier wh ich is a valu e of type Lk_presentation.
Example
Lk_presentation p;
o2 Client current_client;
...
p = current_client->present (0);
lk_map (p, LK_COORDINATE, 0, 0, 200, 0);
lk_grab (p);
lk_delete_presentation (p);
O2 Look User Man u al
37
2
Methods and Functions
refresh_all
Summary
Refr esh es all scr een r epr esen t at ion s of t h e r eceiver object u sin g t h e
cu r r en t valu e of t h at object .
Syntax
receiver->refresh_all
Arguments
Non e
Description
Th e refresh_all m et h od r efr esh es all scr een r epr esen tation s of t h e
r eceiver object u sin g t h e cu r r en t valu e of t h at object .
Th is m et h od affect s all th e pr esen t at ion s defin ed u sin g t h e r eceiver
object , wh et h er as a wh ole or as a com pon en t par t of an ot h er object or
valu e, an d wh et h er or n ot t h e pr esen tation is act u ally m apped
an ywh er e.
If th e r eceiver object appear s as a com pon en t of a lar ger pr esen t at ion ,
on ly t h e com pon en t r elat ed t o t h e r eceiver object is r efr esh ed.
Note
In th e pr esen t ver sion of O 2 Look , if t h e r eceiver object appear s in side a
specific edit or , t h at pr esen t at ion is not r efr esh ed.
38
Returns
Not h in g
Example
client->refresh_all;
O2 Look User Man u al
Display methods
rubout
Summary
Replaces all r eceiver object pr esen t at ion s wit h n il object
r epr esen tat ion s.
Syntax
receiver->rubout
Arguments
Non e.
Description
Th e rubout m et h od r eplaces all r epr esen t at ion s of t h e r eceiver object
wit h n il object r epr esen t at ion s t h er eby r em ovin g all r efer en ces t o t h e
object in all m apped an d u n m apped pr esen t at ion s.
Th e r eplacem en t t ak es place on ly at t h e pr esen t at ion level. Th e object is
n ot delet ed fr om t h e dat abase an d n o r efer en ces to it ar e act u ally
ch an ged in t h e dat abase.
H owever , if you issu e a consult m et h od on t h e pr esen t ation s in volved,
or if you r en d-u ser click s on th e Pen cil bu t ton , t h e ch an ges ar e r ecor ded
in th e dat abase.
Note
In t h e pr esen t ver sion of O2 Look , if t h e r eceiver object appear s in side a
specific editor , t h is r epr esen t at ion of it is not r eplaced with a n il object .
Returns
Zer o if su ccessfu l or a n on -zer o in t eger if on e or m or e of t h e
pr esen tation s ar e lock ed (u sin g t h e lk_grab or lk_wait fu n ct ion ) an d
can n ot be er ased.
Example
client->rubout;
O2 Look User Man u al
39
2
Methods and Functions
2.3 Callback methods
Th er e ar e a n u m ber of gen er ic O2 Look m et h ods au t om at ically in vok ed
by O2 Look an d ar e r ar el y ex p l i ci t l y i n v ok ed .
For exam ple, a save m et h od is tr igger ed wh en ever th e en d-u ser click s
on t h e Pen cil bu t ton in an u n lock ed object pr esen t at ion .
You can r edefin e t h ese in t er n al O2 Look m eth ods for an y class at an y
level in t h e class h ier ar ch y an d t h er eby cu st om ize t h e way in wh ich
O 2 Look pr oceeds in cer t ain situ at ion s.
If an y of t h ese m et h ods ar e r edefin ed t o r efer t o an object ot h er t h an
self, t h en th at object m u st ex i st wh en t h e m et h od is t r igger ed.
Oth er wise a n il object except ion is r aised.
Th e followin g m eth ods ar e descr ibed below:
• bitmap
• erase
• menu
• save
• title
40
O2 Look User Man u al
Callback methods : bitmap
bitmap
Summary
Defin es a bitm ap u sed to r epr esen t t h e r eceiver object as an icon .
Syntax
receiver->bitmap
Arguments
Non e
Description
If you wan t t o r epr esen t th e r eceiver object as an icon , you u se bitmap
t o defin e a bit m ap.
It is au t om atically tr igger ed wh en you u se t h e present, display or
edit m et h ods, or t h e lk_present fu n ct ion .
Th e bitm ap is em pt y by defau lt an d th e icon is sim ply t h e class n am e of
t h e object cen t er ed in a box.
You can r edefin e t h e m et h od t o r et u r n an y bit m ap.
Th e O2 Look r esou r ce bitmap over r ides t h e bitmap m et h od, an d if it is
act ivat ed t h e m eth od is n ot t r igger ed.
Returns
A tu ple of t h e followin g t ype:
tuple (width: integer,
height: integer,
bitsmap: bits)
Th e at tr ibu t e width is th e h or izon t al size of t h e icon (in pixels), height
is t h e ver t ical size of t h e icon (in pixels), an d bitsmap is t h e icon im age
in X Win dows bit m ap for m at .
Example
If you h ave a class Person, you can r epr esen t each object , i.e. each
per son wit h a ph ot o.
A scan n ed ph ot ogr aph in X bit m ap for m at is u sed for th e icon , an d on e
of t h e at t r ibu t es of class Person is photo it self an object of t h e syst em su pplied class Bitmap.
You m u st r edefin e th e bit m ap m et h od of t h e class Person as follows:
return *(self->photo);
You m u st assign t h e object at t r ibu te photo befor e displayin g t h e
Person object t h at con t ain s it . Oth er wise, wh en O 2 Look t r igger s th e
O2 Look User Man u al
41
2
Methods and Functions
bitmap m et h od for t h e display an d th e m et h od get s a n il object
except ion .
For exam ple:
Fi gu r e 2 .5 : Bi t m a p i m a ge
42
O2 Look User Man u al
Callback methods : erase
erase
Summary
Defin es t h e beh avior of t h e r eceiver object pr esen t at ion wh en
t h e Er aser bu t ton on t h is pr esen t at ion is click ed by th e en du ser .
Syntax
receiver->erase (presentation)
Arguments
presentation
Description
Th e erase m et h od defin es t h e beh avior an u n lock ed object pr esen t at ion
wh en t h e Er aser bu t t on is click ed.
Th e pr esen tat ion iden t ifier is of t ype Lk_presentation
an d is r etu r n ed by a present m et h od or lk_present
fu n ct ion .
Th is m et h od is au t om atically tr igger ed wh en t h e en d-u ser click s on t h e
Er aser bu t t on :
Th e erase m et h od in vok es, by defau lt t h e lk_delete_presentation
fu n ct ion on t h e pr esen t at ion .
You can r edefin e t h e erase m et h od t o car r y ou t an y ot h er oper at ion .
Returns
Not h in g
Example
You can r edefin e t h e erase m et h od in t h e followin g way:
{for (p in self->all_presentations)
{lk_delete_presentation(p);
}
}
O2 Look User Man u al
43
2
Methods and Functions
menu
Summary
Defin es t h e pu blic m eth ods m en u .
Syntax
receiver->menu
Arguments
Non e
Description
Th e menu m et h od defin es t h e m en u of pu blic m et h ods th at appear s
wh en ever you click on th e r igh t m ou se bu t t on on a r eceiver object icon ,
or th e left m ou se bu t t on on t h e M en u bu tt on of an expan ded object
pr esen t at ion .
Th is m et h od is au t om at ically t r igger ed wh en you defin e su ch a
pr esen t at ion u sin g t h e present, display or edit m et h ods, or th e
lk_present fu n ct ion . By defau lt all pu blic m et h ods ar e in t h e m en u
bu t you can r edefin e t h e m en u m et h od t o r et u r n an y select ion of pu blic
m et h ods available.
Th e O2 Look r esou r ce menu over r ides t h e menu m et h od, an d if it is
act ivated t h e m et h od is n ot t r igger ed.
If t h e pr esen t at ion is r efr esh ed, t h e menu m eth od (an d menu r esou r ce) is
n ot tak en in t o accou n t t h er eby en su r in g t h at a m en u for a par t icu lar
pr esen t at ion can n ot be m odified wit h ou t dest r oyin g an d r edefin in g t h at
pr esen t at ion .
However , you can disable an d en able m en u it em s at an y t im e.
Returns
A list of str in gs. By defau lt a list of st r in gs of th e n am es of all u ser defin ed pu blic m et h ods att ach ed t o t h e r eceiver object class, an d t h e
syst em -defin ed m et h ods display an d edit.
Example
You can r edefin e th e menu m eth od for a class Country so th at it on ly
sh ows th e system -defin ed m et h od display.
Th is m ean s t h at you r applicat ion en d-u ser s can n ot m odify th e con ten ts
of a Country object , becau se t h ey can n ot u se an y ot h er pu blic m et h ods.
Th is is sh own over leaf.
method body menu: list(string) in class Address {
return list ("display");
}
44
O2 Look User Man u al
Callback methods : menu
wh en you click on t h e Addr ess icon , in t h is case t h e Class n am e, u sin g
t h e r igh t m ou se bu t ton you get a m en u con t ain in g t h e display it em as
sh own in (A ) Figu r e 2.6:
Display
A
Fi gu r e 2 .6 : A m od i f i ed m en u
O2 Look User Man u al
45
2
Methods and Functions
save
Summary
Defin es th e beh avior of t h e r eceiver object pr esen t at ion wh en
t h e pr esen t ation Pen cil bu t t on is click ed.
Syntax
receiver->save (presentation)
Arguments
presentation Th e pr esen t at ion iden t ifier is of t ype Lk_presentation
an d is r et u r n ed by a present m et h od or lk_present
fu n ct ion .
Description
Th e save m et h od defin es t h e beh avior of an u n lock ed r eceiver object
pr esen t at ion wh en t h e en d-u ser click s on t h e Pen cil bu t t on :
It is au t om at ically t r igger ed by O 2 Look .
By defau lt, t h e save m et h od in vok es th e lk_consult fu n ction on t h e
pr esen t at ion con cer n ed.
You can r edefin e t h e save m et h od to car r y ou t an y ot h er oper at ion .
Returns
Not h in g
Example
You can r edefin e t h e save m et h od in t h e followin g way:
{lk_consult (p, self);
self->refresh_all;
lk_delete_presentation(p);
}
46
O2 Look User Man u al
Callback methods
title
Summary
Defin es a st r in g t h at is in t h e tit le of an y r eceiver object pr esen t at ion
Syntax
receiver->title
Arguments
Non e
Description
Th e title m et h od defin es a str in g u sed in th e t it le of an y r eceiver
object pr esen tation . Th is m et h od is au t om at ically t r igger ed wh en you
defin e a pr esen t at ion u sin g t h e present, display or edit m et h od, or
lk_present fu n ction . By defau lt , t h e st r in g u sed for t h e pr esen t at ion
t it le is t h e r eceiver object class n am e.You can r edefin e t h is m et h od t o
r et u r n an y ot h er st r in g. Th e O2 Look r esou r ce titleString over r ides
t h e title m et h od an d if it is act ive t h e m et h od is n ot t r igger ed.
Returns
Th e st r in g u sed in t h e pr esen t at ion t it le. By defau lt t h e n am e of t h e
class.
Example
You can r edefin e t h e title m et h od in t h e class Address in or der t o
sh ow t h e n am e of t h e cit y an d t h e cou n t r y in t h e pr esen t at ion of objects
of t h e class Address. Ot h er wise, on ly t h e class n am e Address is
displayed. Use t h e followin g m et h od body:
method body title: string in class Address
{
return self->city+ " " + self->country;
}
Th is gives t h e followin g t ype of win dow sh own in (A ) Figu r e 2.7:
O2 Look User Man u al
47
2
Methods and Functions
Little Rock USA
A
Fi gu r e 2 .7 : A m od i f i ed cl a ss t i t l e
48
O2 Look User Man u al
Library functions : title
2.4 Library functions
Th is sect ion descr ibes th e followin g O2 Look libr ar y fu n ct ion s:
• lk_all_mapped_presentations
• lk_all_presentations
• lk_consult
• lk_current_presentation
• lk_delete_all
• lk_delete_presentation
• lk_epilogue
• lk_free
• lk_grab
• lk_map
• lk_present
• lk_prologue
• lk_refresh_presentation
• lk_unmap
• lk_wait
O2 Look User Man u al
49
2
Methods and Functions
lk_all_mapped_presentations
Summary
List s all t h e m ap p ed pr esen t at ion s in t h e cu r r en t applicat ion .
Syntax
lk_all_mapped_presentations()
Arguments
Non e
Description
Th e lk_all_mapped_presentations fu n ct ion r et u r n s a list of all th e
pr esen t at ion s t h at h ave been defin ed an d m apped in t h e cu r r en t
applicat ion con t ext . See th e fu n ction lk_prologue for a defin it ion of th e
applicat ion con t ext .
Returns
A valu e of t ype list (integer).
You can cast th e valu e as list (Lk_presentation). Each elem en t in
t h e list cor r espon ds t o t h e iden t ifier of a m apped pr esen t at ion . If t h er e
ar e n o m apped pr esen t at ion s, t h e em pt y list is r et u r n ed.
Example
If you wan t t o u n m ap all t h e pr esen t at ion s of t h e cu r r en t applicat ion
con t ext except t h e on e fr om wh ich t h e m et h od was called, you can u se
t h e lk_all_mapped_presentations m et h od in t h e followin g way:
Lk_presentation cp = lk_current_presentation(), p;
o2 list (integer) lp;
...
lp = (o2 list(integer))
lk_all_mapped_presentations();
for (p in lp) {
if (p!= cp)
lk_unmap (p);
...
}
50
O2 Look User Man u al
Library functions : lk_all_presentations
lk_all_presentations
Summary
List s of all t h e m ap p ed an d u n m ap ped pr esen t at ion s defin ed in cu r r en t
application .
Syntax
lk_all_presentations()
Arguments
Non e.
Description
Th e lk_all_presentations fu n ct ion r et u r n s a list of all pr esen t at ion s
t h at h ave been defin ed u n der t h e cu r r en t applicat ion con t ext , wh et h er
t h ey ar e m apped or u n m apped.
Returns
A valu e of t ype list (integer).
You can cast t h e valu e as list (Lk_presentation). Each elem en t in
t h e list cor r espon ds t o t h e iden tifier of a m apped pr esen t at ion . If t h er e
ar e n o pr esen t at ion s, th e em pt y list is r et u r n ed.
Example
Lk_presentation p;
o2 list (integer) lp;
...
lp = (o2 list(integer))lk_all_presentations();
for (p in lp) {
...
}
...
O2 Look User Man u al
51
2
Methods and Functions
lk_consult
Summary
Th e object or valu e displayed in a pr esen t at ion can be con su lted.
Syntax
lk_consult (presentation, obj_or_value)
Arguments
presentation Th e pr esen t at ion iden t ifier of t ype Lk_presentation is
r et u r n ed by a present m et h od or lk_present
fu n ct ion .
obj_or_value Th e object or valu e n am e k n own t o th e callin g pr ogr am .
Description
Th e lk_consult fu n ct ion en ables a pr ogr am t o con su lt th e object or
valu e displayed in a pr esen tat ion .
Th is valu e can also be st or ed in t h e th e pr ogr am var iable t h at is passed
t o t h e fu n ct ion as an ar gu m en t .
If th er e ar e com pon en t object s, t h ese ar e saved in t h e dat abase even if
t h ey ar e bein g edit ed in an ot h er pr esen t at ion : lk_consult does n ot
ch eck for con sist en cy h er e.
Th is is ver y u sefu l for dat a en t r y r ou t in es. You can u se it aft er an
lk_wait or lk_grab fu n ct ion an d t o r et u r n an y m odificat ion s m ade in
t h e pr esen t ation .
Th e valu es fr om t h e lk_consult fu n ct ion ar e au tom at ically saved wh en
you click on Pen cil an d ar e t h er efor e im m ediat ely available t o t h e
m eth od or pr ogr am u sin g t h e object->field con str u ct ion .
However , lk_consult is n eeded for an u n lock ed pr esen tation . For
exam ple, if you past e an object obj2 on t h e pr esen t at ion of an object
obj1 an d click on Pen cil, t h e valu es of obj1 ar e n ot u pdated by t h ose of
obj2 becau se t h e Pen cil click applies on ly t o obj2.
A r efer en ce t o obj1 sh ows n o ch an ge to it s valu e bu t an lk_consult of
t h e pr esen t ation sh ows t h e valu es of obj2.
Test in g an d r ecogn izin g t h is differ en ce is t h e on l y way a pr ogr am can
k n ow t h at you h ave swit ch ed object s in a pr esen t at ion .
Important
Th e object displayed by t h e pr esen t at ion , wh ich was passed to t h e
lk_present fu n ct ion as an ar gu m en t , is always u pdat ed by t h e
lk_consult m et h od, wh at ever t h e valu e of th e obj_or_value
ar gu m en t.
52
O2 Look User Man u al
Library functions : lk_consult
Returns
Zer o if su ccessfu l.
Non -zer o if t h e iden t ifier specified does n ot exist , i.e. it is n ot defin ed by
a present m et h od or lk_present fu n ct ion , or t h e dat a types specified
in t h e presentation an d obj_or_value par am et er s ar e in com pat ible.
Example
Th e followin g m et h od ch eck s wh et h er t h e pr esen t at ion is m odified:
o2 Person temp = new Person;
Lk_presentation pr;
temp = self->deep_copy;
pr = lk_present (self, lk_protected(0,0,0));
lk_map (pr, LK_MANUAL, 0,0,0,0);
if (lk_wait(pr) == LK_SAVE) {
lk_consult (pr, self);
if ((self->deep_equal (temp)) == true) {...}
else {...}
}
O2 Look User Man u al
53
2
Methods and Functions
lk_current_presentation
Summary
Gives t h e pr esen t at ion fr om wh ich th e callin g m et h od was in vok ed
in t er act ively.
Syntax
lk_current_presentation()
Arguments
Non e
Description
Th e lk_current_presentation fu n ct ion r et u r n s t h e iden t ifier of t h e
pr esen t at ion fr om wh ich t h e en d-u ser selected a pu blic m et h od fr om a
m en u .
Th e lk_current_presentation r et u r n s th e iden t ifier of t h e last
pr esen t at ion on t h e scr een for wh ich an object m en u was activat ed. In
som e cases, t h is m igh t n ot be th e on e fr om wh ich t h e callin g m et h od
was in vok ed. Th is is becau se t h e callin g m eth od m igh t itself cr eate an d
m ap pr esen t at ion s, an d in t er action s wit h t h ese or ot h er pr esen t at ion s
m igh t in volve th e act ivat ion of m en u s.
Th e on ly way to be cer tain t h at you obt ain t h e pr esen t at ion fr om wh ich
t h e callin g m et h od was in vok ed is t o call lk_current_presentation
i m m ed i at el y as t h e fir st in str u ction of th e m et h od. Th is is sh own in t h e
exam ple below.
Returns
Example
54
A valu e of t ype Lk_presentation iden t ifyin g th e pr esen t at ion fr om
wh ose m en u th e callin g m et h od was in vok ed. If t h e callin g m et h od was
n ot in vok ed in t er act ively, or if lk_current_presentation was called
fr om an applicat ion pr ogr am or a fu n ct ion , a zer o is r et u r n ed.
Th is code er ases all pr esen t at ion s of t h e cu r r en t application con text
except t h e on e fr om wh ich th e m eth od was called.
O2 Look User Man u al
Library functions : lk_current_presentation
Lk_presentation cp = lk_current_presentation(),
p;
o2 list (integer) lp;
...
lp = (o2 list(integer))
lk_all_mapped_presentations();
for (p in lp) {
if (p!= cp)
lk_unmap (p);
}
...
O2 Look User Man u al
55
2
Methods and Functions
lk_delete_all
56
Summary
Dest r oys all exist in g pr esen t at ion s.
Syntax
lk_delete_all()
Arguments
Non e.
Description
Th e fu n ct ion lk_delete_all destr oys all exist in g pr esen t at ion s t h at
h ave been defin ed in t h e cu r r en t applicat ion con text .
Returns
Not h in g.
Example
lk_delete_all();
O2 Look User Man u al
Library functions : lk_delete_presentation
lk_delete_presentation
Summary
Rem oves a pr esen t at ion .
Syntax
lk_delete_presentation (presentation)
Arguments
presentation
Description
Th e fu n ct ion lk_delete_presentation r em oves a pr esen t at ion fr om
t h e syst em . An y display of t h e pr esen t at ion is u n m apped an d t h e
pr esen tation defin it ion is delet ed, r ever sin g t h e effect of t h e present
m et h od or lk_present fu n ct ion .
Returns
If su ccessfu l t h e in t eger zer o. Ot h er wise, it r et u r n s a n on -zer o if t h e
pr esen tation h as been lock ed with an lk_grab or lk_wait fu n ct ion ,
an d can n ot be er ased, or t h e pr esen t at ion h as n ever been defin ed wit h a
present m et h od or lk_present fu n ct ion .
Example
lk_delete_presentation (my_presentation);
Th e pr esen tat ion iden t ifier is of t ype Lk_presentation
r et u r n ed by a present m et h od or lk_present
fu n ct ion .
O2 Look User Man u al
57
2
Methods and Functions
lk_epilogue
Summary
Syntax
lk_epilogue – Ter m in at es th e O2 Look applicat ion .
lk_epilogue()
Arguments
Non e.
Description
Th e lk_epilogue fu n ct ion t er m in ates t h e O 2 Look applicat ion con text
in itiat ed by t h e m ost r ecen t lk_prologue fu n ct ion .
All O 2 Look win dows associat ed wit h th at con text ar e er ased, an d t h e
applicat ion con t ext th at was in for ce befor e t h e m ost r ecen t
lk_prologue is r ein st at ed. You can st ack an d u n st ack O2 Look
applicat ion con t exts in th is way.
58
Returns
Non e.
Example
lk_epilogue();
O2 Look User Man u al
Library functions : lk_free
lk_free
Summary
React ivat es a su spen ded m et h od or applicat ion pr ogr am .
Syntax
lk_free (presentation, response)
Arguments
presentation
Th e pr esen tat ion iden t ifier is of t ype Lk_presentation
an d is r etu r n ed by a present m et h od or lk_present
fu n ct ion .
response
Th e in t eger valu e r et u r n ed by t h e r elevan t lk_wait or
lk_grab fu n ct ion as it s lock is deactivat ed, can be:
• LK_SAVE
Pr oceed as if th e u ser h as click ed on t h e
Pen cil of t h e specified pr esen t at ion .
• LK_ERASE
Pr oceed as if th e u ser h as click ed on t h e
Er aser of t h e specified pr esen t ation .
Description
Th e fu n ct ion lk_free r eact ivates a m et h od or application pr ogr am
su spen ded by lk_wait or lk_grab. Not all su ch lock s n eed an lk_free
fu n ct ion call; a su spen ded m et h od or pr ogr am m ay also be r eact ivated
by th e u ser click in g on eit h er t h e Pen cil or t h e Er aser bu t t on of t h e
associat ed pr esen t at ion . Wh en t h e lk_free call is issu ed, it specifies
t h e in t eger valu e t o be r et u r n ed by t h e r elevan t lk_wait or lk_grab
fu n ct ion . Lock s m u st be r em oved in th e r ever se or der in wh ich t h ey
wer e in vok ed, i.e., lock s ar e placed on a stack , an d m u st be u n st ack ed
in t h e pr oper or der . Th is applies r egar dless of h ow th e lock is
t er m in at ed (m ou se click or lk_free fu n ction ).
Returns
An in t eger ; zer o if all wen t well, or n on -zer o if:
• Th e pr esen tation does n ot exist or is n ot m apped.
• Th e pr esen tation does n ot cu r r en tly h ave a lock t o deact ivat e.
• Th e lock is n ot on t h e t op of t h e lock st ack .
Example
lk_free (my_presentation, LK_ERASE);
O2 Look User Man u al
59
2
Methods and Functions
lk_grab
Summary
Su spen ds execu tion of t h e m et h od, pr ogr am or fu n ct ion .
Syntax
lk_grab (presentation)
Arguments
presentation Th e pr esen t at ion iden t ifier is of t ype Lk_presentation
an d is r et u r n ed by a present m et h od or lk_present
fu n ct ion .
Description
Th e fu n ct ion lk_grab su spen ds t h e m et h od, applicat ion pr ogr am or
fu n ction in wh ich it occu r s. Th ey r em ain block ed u n til you click on t h e
Pen cil or Er aser bu t ton of t h e specified pr esen t at ion , or u n t il som e ot h er
m eth od or applicat ion pr ogr am issu es an appr opr iat e lk_free call.
All ot h er pr esen t at ion s t h at h ave been defin ed u n der t h e cu r r en t
applicat ion con t ext ar e fr ozen ; you can n ot m an ipu lat e t h em u n t il you
click s on t h e Pen cil or Er aser bu t ton of th e lk_grab pr esen tation .
A pr esen t at ion lock ed wit h lk_grab can n ot be er ased fr om an ot h er
m eth od or pr ogr am . Except for th e fact th at lk_grab “gr abs” t h e scr een ,
it beh aves lik e lk_wait.
Returns
An in t eger , wh ich m ay be on e of t h e followin g:
• LK_SAVE: Th e u ser click ed on t h e Pen cil bu t t on .
• LK_ERASE: Th e u ser click ed on t h e Er aser bu tt on .
• A n egat ive in t eger LK_FAILED if th e pr esen t at ion is n ot cu r r en t ly
displayed an ywh er e, or if it is alr eady lock ed.
Example
n = lk_grab (my_presentation);
if (n == LK_SAVE) {
...
}
else if (n == LK_ERASE) {
...
}
60
O2 Look User Man u al
Library functions : lk_map
lk_map
Summary
Displays a pr esen t at ion defin ed wit h t h e present m et h od or
lk_present fu n ct ion .
Syntax
lk_map (presentation, placement, link, reference, x, y)
Arguments
presentation
Th e pr esen tat ion iden t ifier is of t ype Lk_presentation
an d is r etu r n ed by a present m et h od or lk_present
fu n ct ion .
placement
Th is det er m in es h ow t h e pr esen t at ion is placed on t h e
scr een . Th e placem en t m ay also be affect ed by t h e x
an d y coor din at es descr ibed below. Th is par am et er is
obligat or y an d h as sever al opt ion s:
LK_MANUAL
Th e u ser click s an y m ou se bu t t on on t h e scr een at t h e
spot wh er e t h e u pper left cor n er of t h e n ew
pr esen t at ion is t o be placed. Befor e click in g, a “gh ost ”
pr esen t at ion appear s wh ich m ay be dr agged ar ou n d
t h e scr een . If t h e x an d y par am et er s ar e n on -zer o, t h e
cu r sor appear s offset in t o th e pr esen t at ion by x pixels
t o t h e r igh t an d y pixels down . Th is is u sefu l for pr eposition in g th e cu r sor over a cer t ain field or bu tt on .
LK_MOUSE
Th e n ew pr esen t at ion appear s with it s u pper left cor n er
wh er e t h e m ou se cu r sor is; n o click is n ecessar y. If t h e
x an d y par am eter s ar e n on -zer o, t h e cu r sor appear s
offset in t o t h e pr esen t at ion by x pixels t o t h e r igh t an d
y pixels down . Th is is u sefu l for pr e-position in g t h e
cu r sor over a cer tain field or bu t t on .
LK_COORDINATE
Th e u pper left cor n er of t h e n ew pr esen t at ion is placed
x pixels t o t h e r igh t an d y pixels below t h e r efer en ce
poin t defin ed in t h e reference par am et er . If t h e
reference par am et er is LK_SCREEN, t h is poin t is t h e
u pper left cor n er of t h e scr een . If t h e reference
par am eter is an ot h er pr esen t at ion , t h en t h is poin t is
t h e u pper left cor n er of th at pr esen t at ion .
LK_RIGHT
Th e n ew pr esen t at ion is placed x pixels t o t h e r igh t of
t h e on e defin ed in t h e reference par am et er .
LK_STACK
Th e n ew pr esen t at ion is “stack ed”, par t ially cover in g
t h e on e defin ed in t h e reference par am et er , bu t offset
x pixels t o th e r igh t an d y pixels down .
O2 Look User Man u al
61
2
Methods and Functions
Th is ar gu m en t specifies h ow t h e n ew pr esen t at ion is
lin k ed t o t h e on e specified by reference. Th is
par am et er is n ot r equ ir ed (i.e. m ay be left zer o) if th er e
is n o lin k .
link
Th e opt ion s ar e:
LK_FREE
No lin k at all, apar t fr om t h e in it ial placem en t (specified
in t h e placement par am et er ). Wh en t h e reference
pr esen t at ion or an y pr esen t at ion lin k ed t o it is m oved,
r esized, saved, er ased or icon ified, th e act ion does n ot
affect an y ot h er pr esen t at ion .
LK_GEOMETRIC
Wh en t h e reference pr esen t at ion or an y pr esen t at ion
lin k ed t o it is m oved or r esized, t h e oth er lin k ed
pr esen t at ion s r eposit ion th em selves t o k eep th e sam e
r elat ive posit ion s. Wh en an y of t h e lin k ed
pr esen t at ion s is icon ified, t h e ot h er on es also
disappear in t o t h e sam e icon , an d r eappear t oget h er
wh en it is de-icon ified. H owever , save an d er ase
oper at ion s ar e n ot pr opagat ed fr om on e lin k ed
pr esen t at ion t o an oth er .
LK_CONTENT
Wh en t h e reference pr esen t at ion or an y pr esen t at ion
lin k ed t o it is u n lock ed, u n m apped or saved on to t h e
dat abase, t h e sam e oper ation occu r s in all t h e oth er
lin k ed pr esen t at ion s. H owever , m ove, r esize an d
icon ificat ion oper at ion s on on e pr esen tation h ave n o
effect on an y lin k ed on es.
LK_SLAVE
All m ove, r esize, icon ificat ion , u n lock , u n m ap an d save
oper at ion s on on e lin k ed pr esen t at ion ar e pr opagat ed
t o all t h e ot h er lin k ed pr esen t at ion s.
reference
62
Th e iden t ifier of an oth er pr esen t at ion , alr eady
displayed, n ext t o wh ich t h e cu r r en t on e is t o be
placed, an d t o wh ich th e cu r r en t on e is t o be lin k ed.
For placem en t , t h e u pper left cor n er of th e reference
pr esen t at ion is th e r efer en ce poin t . If t h e cu r r en t
pr esen t at ion is n ot to be lin k ed t o an y exist in g on e,
t h en t h e ar gu m en t LK_SCREEN m ay be u sed, or t h e
par am et er m ay be left zer o; in t h is case, t h e r efer en ce
poin t is t h e t op left cor n er of t h e scr een .
O2 Look User Man u al
Library functions : lk_map
x
Th e n u m ber of h or izon t al pixels separ atin g t h e u pper
left cor n er of t h e n ew pr esen t at ion fr om t h e r efer en ce
poin t defin ed in t h e reference par am et er . Th is is
r equ ir ed for th e LK_COORDINATE, LK_LEFT, LK_RIGHT
an d LK_STACK placem en t s; it is opt ion al for
LK_MANUAL an d LK_MOUSE; in ot h er cases it is ign or ed.
If t h e global gr aph ic r esou r ce presSpacing is defin ed,
t h e h or izon t al displacem en t is x + presSpacing.
y
Th e n u m ber of ver tical pixels separ at in g th e u pper left
cor n er of t h e n ew pr esen t at ion fr om t h e r efer en ce poin t
defin ed in t h e reference par am et er . Th is is r equ ir ed
for th e LK_COORDINATE, LK_TOP, LK_BOTTOM an d
LK_STACK placem en t s; it is option al for LK_MANUAL
an d LK_MOUSE; in ot h er cases it is ign or ed. If t h e global
gr aph ic r esou r ce presSpacing is defin ed, th e ver t ical
displacem en t is y + presSpacing.
Description
Th e fu n ct ion lk_map displays a pr esen tation wh ich h as been defin ed
wit h th e present m et h od or lk_present fu n ction . Its par am eter s
iden t ify t h e pr esen t at ion t o display an d specify wh er e t o display it .
Returns
An in t eger : zer o if all wen t well, or n on -zer o if:
• Th e pr esen t ation specified in th e presentation par am eter is alr eady
displayed.
• Th e pr esen tation specified in t h e reference par am et er is n ot yet
displayed.
• Th e iden t ifier specified in eit h er t h e presentation par am eter or t h e
reference par am et er does n ot exist ; th at is, it h as n ot been defin ed
by a present m et h od or lk_present fu n ction .
Example
lk_map (p1, LK_COORDINATE, LK_FREE, LK_SCREEN, 50, 10);
lk_map (p2, LK_COORDINATE, LK_GEOMETRIC, p1, 50, 30);
lk_map (p3, LK_MANUAL, 0, 0, 0, 0);
lk_map (p4, LK_STACK, LK_SLAVE, p2, 30, 30);
lk_map (p5, LK_LEFT, LK_FREE, p4, 20, 0);
O2 Look User Man u al
63
2
Methods and Functions
lk_present
Summary
Defin es a pr esen t at ion for an O 2 object or valu e.
Syntax
lk_present (obj_or_value, mask [, ed_name, rcount,
resources])
Arguments
obj_or_value Th e object or valu e n am e as k n own t o t h e callin g
pr ogr am .
mask
Th e m ask (of t ype Lk_mask) you wan t t o u se t o in t h e
pr esen t at ion . If left zer o, t h e m et h od t ak es t h e
lk_generic defau lt m ask . If th e m ask you ch oose is
in con sist en t wit h t h e valu e or object you wan t t o
display, you get a war n in g an d t h e lk_generic m ask
is au t om atically u sed.
ed_name
A pr esen tation iden tifier wh ich you can t h en u se t o
specify it s gr aph ic r esou r ces in a r esou r ce file. Th e
ed_name defau lt valu e is GenPresentation.
rcount
Th e n u m ber of r esou r ces in t h e resources ar gu m en t .
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized. Each r esou r ce is of t ype Lk_resource.
Description
Th e fu n ct ion lk_present defin es a pr esen t at ion for an O2 object or
valu e. It r et u r n s a pr esen t at ion iden t ifier t o t h e callin g pr ogr am . Th e
pr esen t at ion m ask specifies h ow dat a is displayed in t h e M ot if win dow.
For an object , t h e pr esen t at ion also in clu des t h e m en u of pu blic
m eth ods at t ach ed t o t h e object.
Returns
Th e iden t ifier (of t ype Lk_presentation) r epr esen t in g t h e pr esen t at ion
bu ilt . Th is valu e is u sed in all ot h er fu n ction calls m an ipu lat in g t h e
pr esen t at ion .
Example
Lk_presentation p1, p2;
Lk_resource v2res[4];
...
p1 = lk_present (object1, lk_protected());
p2 = lk_present (value2, 0, "value2", 4, v2res);
64
O2 Look User Man u al
Library functions : lk_present
Resources
Sect ion 4.6 list s t h e gr aph ic r esou r ces wh ich can be cu st om ized for an
in dividu al pr esen t at ion .
O2 Look User Man u al
65
2
Methods and Functions
lk_prologue
Summary
In it ializes an application con t ext .
Syntax
lk_prologue (host, context_name, context_class, rcount,
resources)
Arguments
host
Th e n am e of t h e wor k st at ion (st r in g) on wh ich t h e
O2 Look pr esen t at ion s appear . Th e M ot if win dow
m an ager m u st be r u n n in g on th at m ach in e. If host is
zer o, t h e -display opt ion valu e is u sed if on e exists. If
-display does n ot exist , t h e valu e of th e Un ix
en vir on m en t var iable DISPLAY is u sed.
context_name Th e applicat ion con t ext n am e (st r in g). Th is n am e
appear s as th e fir st n am e in an O 2 Look r esou r ce st r in g
u sed in a r esou r ce file t o specify defau lt gr aph ic
r esou r ces for an applicat ion con t ext. Th e
context_name is also t h e defau lt win dow t it le t h at
appear s in t h e tit le bar of all pr esen t at ion s defin ed
u n der t h e applicat ion con t ext . Th e defau lt is t h e Un ix
com m an d (u su ally t h e st r in g "o2") u sed t o in it iat e th e
O2 session . Th is is also t h e defau lt con t ext n am e
between t h e t im e t h at O 2 is lau n ch ed an d t h e fir st
lk_prologue fu n ct ion execu t ed. On ce an applicat ion
is execu t ed, t h e defau lt con t ext n am e is t ak en fr om t h e
n am e of t h at applicat ion .
context_class A st r in g r epr esen t in g t h e n am e of t h e con text class of
t h e applicat ion . By defau lt (t h at is, if t h e par am et er is
zer o), th e class n am e is sim ply t h e context_name
ar gu m en t wit h it s fir st let t er con ver t ed to u pper -case.
Lik e context_name, context_class m ay be u sed as
t h e fir st par t in an O2 Look r esou r ce st r in g in a
r esou r ce file. However , in st ead of specifyin g gr aph ic
r esou r ces for t h e applicat ion bein g r u n , it specifies
t h em for all applicat ion s of t h is class.
66
rcount:
An in teger cou n t of t h e n u m ber of special r esou r ces
given in th e resources ar gu m en t.
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in th e application con t ext . Each r esou r ce
in t h e ar r ay is of t ype Lk_resource. On ly global
r esou r ces ar e specified h er e.
O2 Look User Man u al
Library functions : lk_prologue
Description
Th e lk_prologue fu n ct ion in it ializes an applicat ion con t ext . Th e
cu r r en t ly active applicat ion con t ext is su per seded by a n ew on e.
On e or m or e r esou r ce files con t ain in g defau lt gr aph ic r esou r ce
specificat ion s ar e r ead an d im plem en t ed. Th e n am e an d locat ion of
t h ese files can var y depen din g on t h e O2 in st allation dir ect or y, th e
cu r r en t valu e of t h e Un ix en vir on m en t var iables O2RESOURCE an d HOME
(t h e u ser h om e dir ect or y), an d t h e context_name.
O2 Look sear ch es for th e r esou r ce files in t h e followin g or der :
1.
If O2RESOURCE is defin ed, O 2 Look at t em pts t o load t h e file
O2_installation_directory/look/$O2RESOURCE/context_name
If O2RESOURCE is n ot defin ed, O2 Look t r ies
O2_installation_directory/look/context_name
2.
O 2 Look t h en look s for
$HOME/.LKdefaults
If n eith er 1 n or 2 exist s, n o r esou r ce file is loaded. If bot h exist , t h ey ar e
bot h loaded, an d an y con flict in g r esou r ce defin it ion s ar e r esolved by
givin g.LKdefaults pr ior it y.
Th e n ew applicat ion con t ext r em ain s in for ce u n t il eit h er a n ew
lk_prologue fu n ct ion r eplaces it or an lk_epilogue fu n ct ion
t er m in at es it an d r est or es t h e pr eviou s con t ext . Applicat ion con t ext s
can be st ack ed an d u n st ack ed t o an y r eason able dept h in t h is way.
Not e t h at applicat ion con t ext s an d gr aph ic r esou r ce defin it ion s ar e n ot
cu m u lat ive: on e con t ext com plet ely r eplaces an oth er . An applicat ion
con t ext defin es t h e r esou r ce st r in g pr efixes u sed wh en cu st om izin g
pr esen t at ion win dows an d display m ask s. It also defin es t h e bou n dar ies
beyon d wh ich an erase_all m et h od or an lk_delete_all fu n ct ion
will n ot go.
An O 2 applicat ion gen er ally begin s wit h lk_prologue an d en ds wit h
lk_epilogue, an d cor r espon ds t o on e en d-u ser t ask . In pr act ice, you r
en d-u ser m ay wish t o in t er r u pt on e applicat ion an d r u n an oth er on e. A
pr ogr am m er , for exam ple, m ay wan t t o in t er r u pt an applicat ion t h ey ar e
wr itin g, test a secon d on e, an d go back t o th e fir st aft er war d. Th is is
wh y applicat ion con text s can be st ack ed. Wh en an O2 session st ar t s u p,
t h e au t om atically syst em in it ializes a defau lt applicat ion con t ext called
o2 u n less t h e -alpha com m an d is u sed, in wh ich case n o applicat ion
con t ext is establish ed an d n o O 2 Look fu n ct ion s oper at e.
Returns
Not h in g.
Resources
Sect ion 4.5 list s t h e gr aph ic r esou r ces wh ich can be cu st om ized for an
application con t ext
Example
lk_prologue (0, "tour_booking", "TravelAgency", 0, 0);
O2 Look User Man u al
67
2
Methods and Functions
lk_refresh_presentation
Summary
Updat es a pr esen tation .
Syntax
lk_refresh_presentation (presentation, obj_or_value, mask
[, ed_name, rcount, resources])
Arguments
presentation Th e pr esen t at ion iden t ifier of type Lk_presentation
r et u r n ed by a present m et h od or lk_present
fu n ct ion .
obj_or_value Th e n am e of t h e object or valu e (as k n own to t h e callin g
pr ogr am ) wh ose dat abase valu e is u sed t o r efr esh t h e
specified pr esen tation . Th is is u su ally, bu t n ot
n ecessar ily, th e sam e object or valu e t h at was u sed t o
con st r u ct th e pr esen t at ion in t h e fir st place; in an y
even t, it m u st be t ype-com pat ible wit h th e last object
or valu e displayed in t h e pr esen tation .
Th e display m ask (a valu e of type Lk_mask) t o be u sed
in t h e r edefin it ion of t h e pr esen t at ion . If left zer o, t h e
syst em r et ain s t h e m ask t h at was specified in th e
or igin al lk_present fu n ct ion an d m u st n ot h ave been
dest r oyed by lk_destroy_mask.
mask
ed_name
Description
Not yet in u se.
rcount
An in teger cou n t of t h e n u m ber of special r esou r ces
given in th e resources ar gu m en t.
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in t h e pr esen tation (u n less rcount is zer o).
Each r esou r ce in t h e ar r ay is of t ype Lk_resource.
Th e fu n ct ion lk_refresh_presentation br in gs a pr esen t at ion of an
object or a valu e u p t o dat e. If it h as been m odified on th e dat abase (by
an y oth er u ser or in an y oth er pr esen t at ion ) sin ce t h e specified
pr esen t at ion was defin ed, t h e pr esen t at ion is u pdat ed wit h th e n ew
valu es.
If an y com pon en t s of t h e object or valu e ar e t h em selves object s, t h ese
ar e also r efr esh ed. For m apped pr esen tation s, t h e display is r edr awn to
sh ow t h e n ew valu es (an d an y u n saved ch an ges ar e discar ded).
68
O2 Look User Man u al
Library functions : lk_refresh_presentation
Th is fu n ction is u sefu l for m ain t ain in g con sist en cy bet ween th e dat a on
t h e dat abase an d th at dat a displayed on t h e scr een , or for aban don in g
an y scr een ch an ges an d r ever t in g t o th e dat abase valu e of an object or
valu e.
Refr esh in g a pr esen t at ion of an object in volves r elau n ch in g t h e title
an d bitmap m et h ods for th at object , bu t n ot t h e menu m et h od. Th e
lk_refresh_presentation fu n ct ion m ay also be u sed t o alt er t h e
display m ask , th e edit or n am e, or m ost of t h e gr aph ic r esou r ces t h at
wer e or igin ally specified in t h e lk_present fu n ct ion for t h e
pr esen tation .
Som e gr aph ic r esou r ces, h owever , ar e u n affect ed by th e r efr esh in g
pr ocess. Not e also th at t h is fu n ct ion does n ot r er ead t h e gr aph ic
r esou r ce file; an y r esou r ce ch an ges m u st be specified in th e resources
par am et er .
Returns
An in t eger ; zer o if all wen t well, or n on -zer o if:
• Th e iden t ifier specified in t h e presentation par am et er does n ot
exist ; t h at is, it h as n ot been defin ed by a present m eth od or
lk_present fu n ction .
• Th e dat a t ypes of t h e pr esen t at ion specified in th e presentation
par am et er an d of t h e object or valu e specified in t h e obj_or_value
par am et er ar e n ot com patible.
Resources
Sect ion 4.6 list s t h e gr aph ic r esou r ces wh ich m ay be cu st om ized for an
in dividu al pr esen t at ion s.
Example
Th is code r edr aws t h e pr esen t at ion pr1 based on t h e cu r r en t con t en t s
of object client.
lk_refresh_presentation (pr1, client, 0);
O2 Look User Man u al
69
2
Methods and Functions
lk_unmap
Summary
Er ases t h e pr esen t at ion .
Syntax
lk_unmap (presentation)
Arguments
presentation Th e pr esen t at ion iden t ifier of type Lk_presentation
an d r et u r n ed by a present m et h od or lk_present
fu n ct ion .
Description
Th e fu n ct ion lk_unmap er ases a pr esen t at ion fr om t h e scr een t h er eby
r ever sin g t h e lk_map fu n ct ion . It leaves t h e defin it ion of t h e
pr esen t at ion in t act , so t h at fu t u r e lk_map in st r u ction s can r e-display
t h e pr esen t ation .
Returns
An in t eger ; zer o if all wen t well, or n on -zer o if:
• Th e pr esen t at ion h as n ever been defin ed wit h a present m et h od or
lk_present fu n ct ion .
• Th e pr esen t at ion is n ot cu r r en t ly displayed an ywh er e.
• Th e pr esen t at ion h as been lock ed with an lk_wait or lk_grab
fu n ct ion , an d can n ot be u n m apped.
Example
70
lk_unmap (my_presentation);
O2 Look User Man u al
Library functions : lk_wait
lk_wait
Summary
Su spen ds t h e r u n n in g of a m et h od, pr ogr am , or fu n ct ion .
Syntax
lk_wait (presentation)
Arguments
presentation
Returns
An in teger , wh ich m ay be on e of t h e followin g:
Th e iden t ifier of t h e pr esen tation t o be lock ed. Th is is
t h e valu e, of t ype Lk_presentation, r et u r n ed by a
present m et h od or lk_present fu n ct ion .
• LK_SAVE: Th e u ser click ed on t h e Pen cil bu t t on .
• LK_ERASE: Th e u ser click ed on t h e Er aser bu t ton .
• A n egat ive in t eger LK_FAILED if t h e pr esen tation is n ot cu r r en t ly
displayed an ywh er e, or if it is alr eady lock ed.
Description
Th e fu n ct ion lk_wait su spen ds t h e m et h od, applicat ion pr ogr am or
fu n ct ion in wh ich it occu r s. Th is r em ain s block ed u n t il you click on t h e
Pen cil or Er aser bu t t on of t h e specified pr esen t at ion , or u n t il som e
ot h er m eth od or applicat ion pr ogr am issu es an appr opr iat e lk_free
call.
You can , h owever , con t in u e t o m an ipu lat e an y ot h er pr esen tation on
scr een . Usin g an lk_wait is th e n or m al way in wh ich a m et h od or
application pr ogr am pau ses t o accept u ser in pu t .
Wh ile an lk_wait is in effect , th e syst em con t in u es t o pr ocess all even t s
com in g fr om t h e en d-u ser , for all pr esen t at ion s on t h e scr een . You can
m odify t h e con ten ts of ot h er pr esen t at ion s, or copy or cu t -an d-past e
wh ole objects or valu es, or t r igger m et h ods.
By click in g on th e Pen cil bu t t on of an y pr esen t at ion ot h er t h an a
lock ed on e, you en su r e t h at ch an ges m ade to t h at pr esen t at ion ar e
r ecor ded on t h e dat abase. By click in g on t h e Er aser bu t ton of an y
pr esen tation ot h er t h an a lock ed on e, you aban don t h e ch an ges an d
t h e pr esen t at ion is er ased fr om t h e scr een .
Th e r u n n in g of th e su spen ded m et h od or pr ogr am on ly r esu m es wh en
you click on t h e Pen cil or Er aser bu t ton of t h e pr esen t at ion affect ed by
lk_wait.
Ch an ges m ade to t h is pr esen t at ion ar e n ot r ecor ded on t h e dat abase if
t h e Pen cil bu t t on is click ed, an d th e pr esen t at ion is n ot dest r oyed if t h e
Er aser bu t ton is click ed. In for m at ion as t o h ow t h e lock was t er m in at ed
is r et u r n ed to t h e m et h od or applicat ion pr ogr am wh ich issu ed t h e
lk_wait call.
O2 Look User Man u al
71
2
Methods and Functions
It is u p t o t h e m et h od or pr ogr am t o h an dle th e sit u at ion in t h e
appr opr iat e way: t o in vok e t h e pr oper lk_consult or
lk_delete_presentation fu n ct ion s, to t est an y n ew valu es en t er ed by
t h e en d-u ser , an d to stor e t h em on th e dat abase if n ecessar y. A
pr esen t at ion lock ed wit h lk_wait can n ot be er ased fr om an ot h er
m et h od or pr ogr am . Th e lk_wait fu n ct ion r et u r n s an in teger wh ich , if
n ot n egat ive (i.e. if n ot an er r or code), in dicates t h e way in wh ich t h e
lk_wait was t er m in at ed:
• If you click on t h e Pen cil bu t ton , t h e valu e LK_SAVE is r et u r n ed.
• If you click on t h e Er aser bu t t on , t h e valu e LK_ERASE is r et u r n ed.
• If an lk_free fu n ct ion was execu t ed, t h e valu e of t h e response
par am et er of t h at fu n ct ion is r et u r n ed.
Th e lk_wait fu n ction places a lock on t op of a “st ack ” of lock s in effect
for t h e cu r r en t applicat ion . An applicat ion m ay h ave an y n u m ber of
lock s in effect at on ce, bu t t h e lock s m u st be ter m in ated in th e r ever se
or der in wh ich t h ey wer e in vok ed. If, for exam ple, you click on t h e Pen cil
bu t t on of a lock ed pr esen t at ion , bu t th is pr esen t at ion was n ot t h e m ost
r ecen t on e lock ed, an appr opr iate er r or m essage appear s.
M et h ods an d pr ogr am s u sin g t h e lk_free fu n ction m u st also be car efu l
t o u n do lock s in th e pr oper or der . Wh en a pr esen t at ion is u n lock ed, an y
oth er pr esen t at ion s lin k ed t o it by a LK_CONTENT or LK_SLAVE lin k ar e
also u n lock ed. Apar t fr om r espect in g t h e or der of t h e lock stack , an
lk_wait lock on on e pr esen tation does n ot affect t h e execu t ion of ot h er
m et h ods in an applicat ion .
Example
n = lk_wait (my_presentation);
if (n == LK_SAVE) {
...
}
else if (n == LK_ERASE) {
...
}
72
O2 Look User Man u al
3
M a sks
3
A m ask defin it ion descr ibes a t em plat e for th e for m at of a pr esen t at ion .
For exam ple, wh ich t u ple at t r ibu t es ar e t o be displayed an d wh ich on es
can be m odified. You can also u se m ask s t o specify t h e gr aph ic
r esou r ces of you r pr esen t at ion s.
Th is ch apt er in t r odu ces t h ese display m ask s an d descr ibes h ow t o u se
t h em . It t h en gives t h e exact syn t ax of all t h e m ask fu n ct ion s.
It is divided in t o t h e followin g sect ion s:
• In t r odu ct ion
• Fu n ct ion s
O2 Look User Man u al
73
3
Masks
3.1 Introduction
O2 Look m ask s ar e tem plates for t h e display an d edit in g of valu es.
In m ost cases, wh en an object or valu e is displayed u n der O2 Look , n o
m ask n eed be specified.
Th e syst em u ses a defau lt m ask der ived fr om th e t ype specificat ion of
t h e object or valu e con cer n ed.
H owever , u n der special cir cu m st an ces, you m ay wish t o design you r
own display m ask , su pplem en tin g or even violat in g th e en capsu lat ion
r u les specified in t h e class descr iption , or alt er in g t h e gr aph ic r esou r ces
u sed t o display dat a.
Th e m ask s descr ibed in t h is ch apt er en able you t o n ow do t h is.
Mask Functions
Each O2 Look m ask fu n ct ion descr ibed in Sect ion 3.2 cr eat es an d
r et u r n s a m ask .
Th er e is a gen er ic display m ask for ever y dat a t ype defin ed in an O2
syst em :
• lk_atomic
To cr eat e a m ask for at om ic valu es: in teger s, r eal n u m ber s, ch ar act er s,
ch ar acter st r in gs an d boolean s,
• lk_set
To cr eat e a m ask for set s an d u n iqu e set valu es
• lk_list
To cr eat e a m ask for list valu es.
• lk_tuple
To cr eat e a m ask for t u ple valu es
Th er e ar e also var iou s gen er ic m ask fu n ct ion s:
• lk_generic
To cr eat e a m ask accor din g to t h e t ype specificat ion . Th is is t h e defau lt
m ask for O2 valu es.
• lk_protected
To cr eat e a m ask accor din g to t h e class specificat ion .
74
O2 Look User Man u al
Introduction : Mask Functions
• lk_object
To cr eate a m ask for an object .
• lk_method
To cr eate a m ask accor din g t o t h e m et h od specificat ion .
Th er e ar e also special displays speci f i c ed i t or s:
• lk_specific
To cr eate a m ask for a specific edit or : bit m ap, dat e, dialog box, gr aph ,
im age, h yper an d t ext.
A display m ask associat ed wit h a com plex object or valu e is com posed
of sever al su bsidiar y m ask s.
Th is display m ask s m ay be u sed in t h e lk_present an d
lk_refresh_presentation fu n ct ion s in place of th e t wo defau lt
m ask s. Oft en , on e m ask will in clu de on e or m or e su b-m ask
specificat ion s.
Th is is th e case, for exam ple, wit h t h e m ask t h at displays a set valu e,
cr eat ed by t h e lk_set m ask fu n ct ion . lk_set r equ ir es t h e
specificat ion of a su b-m ask of t h e appr opr iat e t ype for t h e elem en t s of
t h e set . Th e elem en ts m igh t even be tu ples, or t u ple-st r u ct u r ed object s,
wh ich m igh t con tain a list as an at t r ibu t e, an d so on .
M ask s an d su b-m ask s m ay be n est ed to an y r eason able dept h .
Th e tu ple m ask lk_tuple, for exam ple, can con t ain an y or all of t h e
oth er t ypes m ask s. Su ch com plex m ask s m ay be n ested t o an y level.
Th is is illu st r at ed in Figu r e 3.1 wh er e t h e lk_tuple m ask con t ain s
t h r ee lk_atom m ask s, a lk_generic m ask an d a lk_list m ask wh ich
it self con tain s a lk_generic m ask .
O2 Look User Man u al
75
3
Masks
lk_object
lk_tuple
lk_atom
lk_atom
lk_atom
lk_generic
lk_list
lk_generic
Fi gu r e 3 .1 : Pr esen t a t i on a n d m a sk
All m ask s su ppor t st an dar d oper at ion s su ch as k eyboar d in pu t,
copyin g, cu t -an d-past e an d er asin g, alt h ou gh t h e you m ay su ppr ess
t h ese oper at ion s for cer t ain m ask s. Som e of t h ese oper at ion s m ay
appear in a special m en u r elat ed t o t h e m ask it self.
Note
Th er e is also a lk_destroy_mask fu n ct ion t h at deletes an y m ask
cr eat ed in an y of t h e pr eviou s fu n ct ion s.
Resource specification in Functions
O 2 Look pr esen tation s ar e sim ply Mot if win dows, an d as su ch t h eir
appear an ce an d beh avior m ay be cu st om ized lik e an y ot h er Mot if
win dow, by specifyin g gr aph ic resources. A r esou r ce is an y
cu st om izable aspect of t h e X Win dow Syst em .
Th e X Win dow Syst em m ain t ain s a dat abase of cu r r en t ly-act ive
r esou r ces, an d O2 Look pr ovides a m ean s of alt er in g t h e con ten ts of th at
dat abase as t h ey apply t o O 2 Look pr esen t at ion s.
In t h is way, defau lt applicat ion r esou r ces m ay be est ablish ed;
m u lt ilin gu al or ot h er sit u at ion -specific applicat ion appear an ce an d
beh avior m ay be pr ogr am m ed; an d t h e en d u ser m ay cu st om ize
applicat ion s t o h is/ h er par t icu lar t ast e.
Resou r ces can be specified in eit h er (or bot h ) of t wo ways: t h r ou gh a
resource file con t ain in g r esou r ce com m an ds, or t h r ou gh th e passin g
of a list of r esou r ce valu es in an O 2 Look fu n ct ion call.
76
O2 Look User Man u al
Introduction
Wh en ever an O2 Look r esou r ce is specified wit h two con flict in g valu es,
on e fr om a r esou r ce file an d t h e ot h er fr om a fu n ct ion call, t h e valu e
specified in th e fu n ction call t ak es pr eceden ce.
M ost of t h ese m ask fu n ct ion s in clu de an opt ion for specifyin g gr aph ic
r esou r ce ar r ays.
A r esou r ce list in volves a cou n t of t h e r esou r ces in th e ar r ay (rcount)
followed by a poin t er t o t h e ar r ay it self (resources); th e elem en t s of th e
ar r ay ar e each of t ype Lk_resource.
Gr aph ic r esou r ces m ay also be specified for in dividu al m ask s in a
defau lt r esou r ce file. Th e m ask is k n own by it s ed i t or n am e, wh ich you
specify in t h e ed_name ar gu m en t of t h e m ask fu n ct ion .
Resou r ces t h at m ay be specified in th ese ways in clu de color , t ypeface,
an d pr otect ion (t h at is, wh et h er or n ot t h e u ser is t o be allowed t o
ch an ge th e displayed data). In t h e case of st r u ct u r ed valu es (an d,
t h er efor e, com plex m ask s), t h e pr otect ion of t h e st r u ct u r e (t u ple, set ,
list ) n eed n ot be t h e sam e as t h at of t h e elem en t s. Th e st r u ct u r e’s
pr ot ect ion r efer s to t h e abilit y to cr eat e n ew elem en ts, or delet e old
on es, wh er eas t h e ability t o view or ch an ge th e valu e of t h e elem en t s is
gover n ed by t h e pr ot ection defin ed for each elem en t .
Th is m ay be don e eit h er wh en a pr esen t at ion or m ask is cr eat ed (by
passin g a list of r esou r ces to t h e fu n ct ion th at cr eat es it ), or later
(t h r ou gh t h e lk_refresh_presentation fu n ct ion ). In eith er case, t h e
caller m u st su pply t wo Ar gu m en t s: a cou n t of t h e n u m ber of r esou r ces
t o be cu st om ized (gen er ally called rcount) an d a poin ter t o an ar r ay of
r esou r ce specificat ion s (u su ally called resources).
Each elem en t in t h e ar r ay m u st be of type Lk_resource, wh ich is
k n own t o t h e syst em as t h e followin g C st r u ct u r e:
typedef struct {
char *name;
char *value;
} Lk_resource;
Th e name str in g iden t ifies t h e r esou r ce, an d t h e value st r in g in dicat es
wh at it is t o be set t o.
Not e t h at t h e name st r in g is n ot t h e fu ll n am e specificat ion r equ ir ed for
a r esou r ce file; it is on ly t h e last par t of t h at specification , su ch as
"fontList" or "foregroundColor".
O2 Look User Man u al
77
3
Masks
Th is is becau se t h e fu n ct ion it self alr eady k n ows wh ich pr esen t at ion or
m ask is t o be affect ed by th e ch an ge.
Th e O2 Look fu n ct ion s t h at accept r esou r ce ar r ays ar e:
• lk_prologue
r esou r ce specification s affect all pr esen t at ion s u n der t h e n ewly-in it iat ed
applicat ion con t ext . On ly global r esou r ces m ay be specified h er e.
• lk_present
r esou r ce specification s affect on ly t h e pr esen t at ion bein g cr eated.
• lk_refresh_presentation
r esou r ce specificat ion s affect on ly t h e pr esen t at ion bein g r efr esh ed. Th e
r esou r ces ar e t h e sam e as for lk_present.
• All mask functions
r esou r ce specificat ion s affect on ly t h e m ask bein g cr eat ed. H owever , t h is
m ask m ay be u sed as a su b-m ask in sever al pr esen tat ion s at on ce. Th e
r esou r ces th at m ay be cu st om ized var y fr om on e type of m ask t o
an oth er .
78
O2 Look User Man u al
Functions
3.2 Functions
Th is sect ion det ails t h e followin g m ask fu n ct ion s:
• lk_atom
• lk_destroy_mask
• lk_generic
• lk_list
• lk_method
• lk_object
• lk_protected
• lk_set
• lk_specific
• lk_tuple
O2 Look User Man u al
79
3
Masks
lk_atom
Summary
Cr eat es a m ask for an at om ic valu e.
Syntax
lk_atom (ed_name, rcount, resources)
Arguments
Description
ed_name
A st r in g r epr esen t in g th e n am e of t h e m ask . Th is n am e
m ay be u sed in a r esou r ce file t o specify gr aph ic
r esou r ces for t h is in dividu al m ask .
rcount
An in t eger cou n t of t h e n u m ber of special r esou r ces
given in t h e resources ar gu m en t .
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in t h e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
Th e lk_atom m ask fu n ct ion cr eates a m ask for an at om ic valu e; th er e is
n o n eed t o specify wh ich k in d of at om ic valu e is in volved. Th is fu n ct ion
can be u sed dir ect ly in an lk_present or lk_refresh_presentation
fu n ct ion t o pr esen t atom ic valu es or as an elem en t m ask specificat ion
for t h e followin g fu n ction s:
• lk_object for an at om ic-valu ed object
• lk_tuple for an at om ic at t r ibu t e of a t u ple
• lk_set for a set of at om ic valu es
• lk_list for a list of atom ic valu es
Returns
A m ask iden t ifier of type Lk_mask.
Example
o2 string name;
Lk_presentation p;
name = "Caroline";
p = lk_present (name, lk_atom(0, 0, 0), 0, 0, 0);
lk_map (p, LK_MANUAL, 0, 0, 0, 0);
lk_grab(p);
You get t h e followin g win dow:
80
O2 Look User Man u al
Functions : lk_atom
Fi gu r e 3 .2 : Usi n g l k _a t om m a sk
O2 Look User Man u al
81
3
Masks
lk_destroy_mask
Summary
Delet es a m ask cr eat ed by an y of th e pr eviou s fu n ct ion s.
Syntax
lk_destroy_mask (mask)
Arguments
mask
Description
Th e lk_destroy_mask fu n ct ion delet es a m ask cr eat ed by on e of t h e
m ask cr eat ion fu n ct ion s. A r efer en ce t o a m ask sh ou ld n ot be m ade
aft er it s delet ion . Addit ion ally, if t h e m em or y r esou r ce is at a pr em iu m ,
we r ecom m en d you u se t h is fu n ct ion t o r ecover t h e space u sed by t h e
m ask .
th e m ask iden t ifier (of type Lk_mask) of t h e m ask t o be
dest r oyed.
Th e syst em does n ot ver ify wh eth er a m ask is in u se befor e dest r oyin g
it . In par t icu lar , all m et h ods an d fu n ct ion s t h at r efr esh a pr esen t at ion
will expect t h at t h e m ask u sed for t h at pr esen t ation st ill exists. If it does
n ot , a r u n -t im e except ion will occu r .
Returns
Not h in g
Example
Lk_presentation p;
Lk_mask m = lk_generic();
o2 Thing x;
...
p = lk_present (x, m);
lk_destroy_mask (m);
lk_map (p, LK_MOUSE, LK_FREE, LK_SCREEN, 0, 0);
...
lk_delete_presentation (p);
Th e m ask m m ay be dest r oyed im m ediat ely aft er bein g u sed by
lk_present to defin e t h e pr esen tation . H owever , an y su bsequ en t
refresh_all m et h od or lk_refresh_presentation fu n ct ion wou ld
fail (except in t h e case wh er e lk_refresh_presentation pr ovides a
n ew m ask ).
82
O2 Look User Man u al
Functions : lk_generic
lk_generic
Summary
Syntax
Cr eat es a m ask accor din g to t h e t ype specificat ion .
lk_generic()
Arguments
Non e.
Description
Th e lk_generic m ask fu n ct ion cr eates a m ask accor din g t o t h e t ype
specificat ion of t h e valu e or object con cer n ed.
Th is is t h e defau lt m ask for O2 valu es. Wh en applied t o an object, t h is
m ask pr odu ces an icon ic r epr esen t at ion of t h e object.
Th is fu n ct ion is u sed pr in cipally as an elem en t m ask specification for
t h e followin g fu n ct ion s:
• lk_object for an icon ic r epr esen t at ion of th e object
• lk_tuple for an y at tr ibu t e of a t u ple
• lk_set for an y set
• lk_list for an y list
It m ay also be u sed dir ect ly in an lk_present or
lk_refresh_presentation fu n ct ion .
Defau lt n am es ar e u sed in t h e cr eat ed m ask accor din g t o t h e type
specificat ion sh own in Table 3.1 :
Table 3.1
Type
Defaul t nam e
ch ar
Gen Ch ar
in t eger
Gen In teger
r eal
Gen Real
boolean
Gen Boolean
str in g
Gen St r in g
byt e
Gen Byt e
list
Gen List
u set
Gen Set
set
Gen Bag
object
Returns
Gen Object
A m ask iden t ifier of type Lk_mask.
O2 Look User Man u al
83
3
Masks
Example
o2 tuple (name: string, age: integer) a;
Lk_presentation p;
a.name = "George";
a.age = 45;
p = lk_present (a, lk_generic());
lk_map (p, LK_MANUAL, 0, 0, 0, 0);
lk_grab(p);
You get t h e followin g win dow:
Fi gu r e 3 .3 : Usi n g t h e gen er i c m a sk
84
O2 Look User Man u al
Functions : lk_list
lk_list
Summary
Syntax
Arguments
Cr eat es a m ask for a list valu e.
lk_list (ed_name, rcount, resources, element_mask)
ed_name
A st r in g r epr esen t in g t h e n am e of t h e m ask . Th is n am e
m ay be u sed in a r esou r ce file t o specify gr aph ic
r esou r ces for t h is in dividu al m ask .
rcount
An in teger cou n t of t h e n u m ber of special r esou r ces
given in th e resources ar gu m en t.
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in th e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
element_mask A m ask iden tifier (of type Lk_mask) appr opr iate t o t h e
dat a t ype of th e elem en t s of t h e list.
Description
Th e lk_list m ask fu n ct ion cr eat es a m ask for a list valu e.
Th is fu n ct ion is u sed pr in cipally as an elem en t m ask specificat ion for
t h e followin g fu n ct ion s:
• lk_object for a list -valu ed object
• lk_tuple for a list -st r u ct u r ed at t r ibu t e of a t u ple
• lk_set for a set of lists
• lk_list for a list of list s
It m ay also be u sed dir ectly in an lk_present or
lk_refresh_presentation fu n ction , for a pr esen t at ion of a list st r u ctu r ed valu e.
Returns
A m ask iden t ifier of t ype Lk_mask.
Example
A gen er ic m ask for a list of in t eger s wou ld be specified as:
O2 Look User Man u al
85
3
Masks
run body{
o2 list (integer) numbers;
Lk_presentation p;
Lk_mask mk;
numbers = list (99, 76, 56);
mk = lk_list ("foo", 0, 0, lk_atom(0, 0, 0));
p = lk_present (numbers, mk, 0, 0, 0);
lk_map (p, LK_MANUAL, 0, 0, 0, 0);
lk_grab(p);
}
Th is gives t h e followin g win dow:
Fi gu r e 3 .4 : Usi n g t h e l k _l i st m a sk
86
O2 Look User Man u al
Functions : lk_method
lk_method
Summary
Syntax
Cr eat es a m ask accor din g to t h e execu t ion of a specified m eth od.
lk_method (method_name)
t h e m et h od defin ed for th e class con cer n ed. Th is
m et h od t ak es n o par am et er s an d r et u r n s a m ask
iden t ifier .
Arguments
method_name
Description
Th e lk_method m ask fu n ct ion cr eates a m ask accor din g t o t h e m et h od
specified.
As it specifies a m et h od t h at is passed t o an object an d wh ich bu ilds u p
t h e object m ask , lk_method can n ot be applied to valu es.
You in vok e t h e m et h od wh en th e pr esen t at ion is defin ed (i.e,
lk_present).
You can u se differ en t gr aph ic r esou r ces accor din g t o t h e att r ibu t e’s
cu r r en t valu e.
Redefin e t h e called m et h od in differ en t su bclasses t o pr odu ce differ en t
m ask s accor din g t o t h e class m em ber sh ip of th e var iou s elem en t s of a
h et er ogen eou s set or list . You can u se t h is fu n ct ion an ywh er e
lk_protected or lk_object is u sed.
Returns
A m ask iden t ifier of type Lk_mask.
Example
Th e followin g exam ple sh ows h ow to u se t h e lk_method m et h od
Th e exam ple sh own below tak es t h e balance at tr ibu t e of an object of
class Client is displayed in red if t h e balan ce is n egat ive, an d in t h e
normal color if it is zer o or posit ive.
O2 Look User Man u al
87
3
Masks
method body redmask: integer in class Client {
Lk_mask m;
Lk_attribute_mask tmasks[3];
Lk_resource redres;
redres.name = "foregroundColor";
redres.value = "red";
tmasks[0].name = "name";
tmasks[0].mask = lk_atom (0, 0, 0);
tmasks[1].name = "client_number";
tmasks[1].mask = lk_atom (0, 0, 0);
tmasks[2].name = "balance";
if (self->balance < 0)
tmasks[2].mask = lk_atom (0, 1, &redres);
else
tmasks[2].mask = lk_atom (0, 0, 0);
m = lk_object (0, 0, 0, lk_tuple (0, 0, 0, 3, tmasks));
return m;
}
You u se t h e m ask t o bu ild a pr esen t at ion in an application pr ogr am :
o2 Person p;
Lk_presentation i;
...
i = lk_present (p, lk_method ("redmask"));
88
O2 Look User Man u al
Functions : lk_object
lk_object
Summary
Cr eat es a m ask for an object .
Syntax
lk_object (ed_name, rcount, resources, value_mask)
Arguments
ed_name
A st r in g r epr esen tin g t h e n am e of t h e m ask . Th is n am e
m ay be u sed in a r esou r ce file t o specify gr aph ic
r esou r ces for th is in dividu al m ask .
rcount
An in t eger cou n t of t h e n u m ber of special r esou r ces
given in t h e resources ar gu m en t .
resources
A poin t er to an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in t h e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
value_mask
A m ask iden t ifier (of t ype Lk_mask) for t h e valu e
en capsu lat ed in t h e object (th at is, n ot an ot h er
lk_object an d n ot lk_protected or lk_method). If
value_mask is zer o, an icon display is gen er at ed for
t h e object.
Description
Th e lk_object m ask fu n ct ion cr eates a m ask for an object . An
lk_object m ask r esem bles t h e m ask for th e valu e en capsu lat ed by t h e
object .
Th e m ain differ en ce is t h at an object m ask also pr ovides for a m en u of
pu blic m et h ods at t ach ed t o th e object .
Th e fu n ct ion m ay be u sed wit h a present m et h od or lk_present or
lk_refresh_presentation fu n ct ion , or as an elem en t m ask
specificat ion for th e followin g fu n ct ion s:
• lk_tuple for an object at t r ibu t e of a t u ple
• lk_set for a set of object s
• lk_list for a list of object s
Returns
A m ask iden t ifier of type Lk_mask.
Example
In t h e par am et er s of t h e object m ask , you give t h e m ask th at
cor r espon ds t o it s valu e.
O2 Look User Man u al
89
3
Masks
run body{
Lk_mask mk;
Lk_presentation pid;
o2 Person e = new Person;
e->name.last_name ="Swanson";
e->name.first_name="George";
e->birthdate= new Date (30, 06, 61);
e->address= new Address;
e->address->city = "Tuscon";
e->address->country =
"USA";
mk = lk_object(0, 0, 0, lk_generic());
pid = lk_present (e, mk);
lk_map (pid, LK_MOUSE, 0, 0, 0, 0);
lk_grab (pid);
}
You get t h e followin g win dow:
Fi gu r e 3 .5 : Usi n g t h e l k _object m a sk
90
O2 Look User Man u al
Functions : lk_object
lk_object sh ows all t h e at tr ibu t es even if t h ey ar e pr ivat e or r ead-on ly.
See Figu r e 3.6 wh ich sh ows h ow t o n ot display pr ivate or r ead-on ly
at t r ibu t es u sin g lk_protected.
O2 Look User Man u al
91
3
Masks
lk_protected
Cr eat es a m ask accor din g t o t h e class specificat ion .
Summary
Syntax
lk_protected (ed_name, rcount, resources)
Arguments
Description
ed_name
A st r in g r epr esen t in g t h e n am e of t h e m ask . Th is n am e
m ay be u sed in a r esou r ce file t o specify gr aph ic
r esou r ces for t h is in dividu al m ask .
rcount
An in teger cou n t of t h e n u m ber of special r esou r ces
given in th e resources ar gu m en t.
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in th e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
Th e lk_protected m ask fu n ct ion cr eates a m ask accor din g to th e class
specificat ion of an object . Th is m ask t h er efor e can n ot be applied t o
valu es.
Note
Un lik e lk_generic an d lk_object, t h e lk_protected m ask t ak es in to
accou n t t h e en capsu lat ion specified in t h e class defin ition of t h e object
bein g displayed.
Pr ivat e t u ple att r ibu t es ar e n ot displayed, an d r ead-on ly at tr ibu t es m ay
n ot be edited. If t h e en t ir e t ype st r u ct u r e of th e object is pr ivat e, t h e
object is r epr esen t ed in icon ic for m on ly.
Th is fu n ct ion m ay be u sed wit h a present m eth od or lk_present or
lk_refresh_presentation fu n ction , or as an elem en t m ask
specificat ion for t h e followin g fu n ct ion s: lk_tuple (for an object
at t r ibu te of a t u ple); lk_set (for a set of object s); an d lk_list (for a list
of object s).
92
Returns
A m ask iden t ifier of t ype Lk_mask.
Example
Th is u ses t h e sam e exam ple as for lk_object above.
O2 Look User Man u al
Functions : lk_protected
run body{
Lk_mask mk;
Lk_presentation pid;
o2 Person e = new Person;
e->name.last_name ="Swanson";
e->name.first_name="George";
e->birthdate= new Date (30, 06, 61);
e->address= new Address;
e->address->city = "Tuscon";
e->address->country =
"USA";
mk = lk_protected(0, 0, 0);
pid = lk_present (e, mk);
lk_map (pid, LK_MOUSE, 0, 0, 0, 0);
lk_grab (pid);
}
You get t h e followin g win dow:
Fi gu r e 3 .6 : Usi n g t h e l k _p r ot ect ed m a sk
lk_protected r espect s t h e class en capsu lat ion an d on ly sh ows pu blic
at t r ibu t es. See Figu r e 3.5 wh ich sh ows h ow t o display pr ivat e or r eadon ly att r ibu t es as well as pu blic at t r iu bt es u sin g lk_object.
O2 Look User Man u al
93
3
Masks
lk_set
Summary
Syntax
Arguments
Cr eat es a m ask for a set valu e.
lk_set (ed_name, rcount, resources, element_mask)
ed_name
A st r in g r epr esen t in g t h e n am e of t h e m ask . Th is n am e
m ay be u sed in a r esou r ce file t o specify gr aph ic
r esou r ces for t h is in dividu al m ask .
rcount
An in teger cou n t of t h e n u m ber of special r esou r ces
given in th e resources ar gu m en t.
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in th e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
element_mask A m ask iden tifier (of type Lk_mask) appr opr iate t o t h e
dat a t ype of th e elem en t s of t h e set .
Description
Th e lk_set m ask fu n ct ion cr eat es a m ask for a set valu e (wh et h er a
u n iqu e set or an or din ar y set ).
Th is fu n ct ion is u sed pr in cipally as an elem en t m ask specificat ion for
t h e followin g fu n ct ion s:
• lk_object for a set -valu ed object
• lk_tuple for a set -st r u ct u r ed att r ibu t e of a t u ple
• lk_set for a set of set s
• lk_list for a list of sets
It m ay also be u sed dir ect ly in an lk_present or
lk_refresh_presentationfu n ct ion , for a pr esen t at ion of a setst r u ctu r ed valu e.
94
Returns
A m ask iden t ifier of t ype Lk_mask.
Example
A gen er ic m ask for a set of st r in gs wou ld be specified as:
O2 Look User Man u al
Functions : lk_set
run body{
o2 set (string) quotes;
Lk_presentation p;
Lk_mask mk;
quotes= set ("To be or not to be",
"He who laughs last",
"Look before your leap");
mk = lk_set ("foo", 0, 0, lk_atom(0, 0,
0));
p = lk_present (quotes, mk, 0, 0, 0);
lk_map (p, LK_MANUAL, 0, 0, 0, 0);
lk_grab(p);
}
Th is gives t h e followin g win dow
Fi gu r e 3 .7 : Usi n g t h e l k _set m a sk
O2 Look User Man u al
95
3
Masks
lk_specific
Summary
Cr eat es a m ask for a specific editor .
Syntax
lk_specific (ed_name, rcount, resources, specific_editor,
mcount, masks)
Arguments
ed_name
A st r in g r epr esen t in g t h e n am e of t h e m ask . Th is n am e
m ay be u sed in a r esou r ce file t o specify gr aph ic
r esou r ces for t h is in dividu al m ask .
rcount
An in teger cou n t of t h e n u m ber of special r esou r ces
given in th e resources ar gu m en t.
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in th e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
specific_editor
A st r in g r epr esen t in g t h e n am e of t h e specific edit or .
Th e specific edit or s available ar e descr ibed below.
mcount
Th e n u m ber of su b-m ask s r equ ir ed by t h e specific
edit or . Th is n u m ber is given for each specific edit or
descr ibed below.
masks
A poin ter to a table of m ask iden t ifier s (each of t ype
Lk_mask). Th is is r equ ir ed, of cou r se, on ly if mcount is
gr eat er t h an zer o.
Description
Th e lk_specific m ask fu n ct ion cr eat es a m ask for a specific edit or .
Th e n am e of t h e specific edit or is passed as an ar gu m en t , alon g wit h
an y su b-m ask s t h at t h e specific edit or m ay r equ ir e. Th e possibilit ies ar e
descr ibed below.
Returns
A m ask iden t ifier of t ype Lk_mask.
Example
A specific edit or is a m ask for a specific t ype of object or valu e. Th e
followin g specific edit or s ar e available:
bitmap, date, dialog, graph, hyper, image an d text
For a fu ll descr ipt ion on h ow t o u se t h ese specific editor s an d t h eir
gr aph ic r esou r ces, please r efer t o th e O2 Kit Refer en ce m an u al. For t h e
specific gr aph edit or , r efer t o th e O2 Gr aph Refer en ce m an u al.
96
O2 Look User Man u al
Functions : lk_tuple
lk_tuple
Summary
Cr eat es a m ask for a tu ple valu e.
Syntax
lk_tuple (ed_name, rcount, resources, acount, apointer)
Arguments
ed_name
Th e m ask n am e wh ich can be u sed in a r esou r ce file t o
specify gr aph ic r esou r ces for th e in dividu al m ask .
rcount
Th e n u m ber in in t eger s of special r esou r ces given in
t h e resources ar gu m en t .
resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o be
cu st om ized in t h e m ask (u n less rcount is zer o). Each
r esou r ce in t h e ar r ay is of t ype Lk_resource.
acount
Th e n u m ber of t u ple at t r ibu t es t o be displayed. If zer o,
all at t r ibu t es ar e displayed, each wit h it s defau lt m ask .
apointer
A poin t er t o an ar r ay of at tr ibu t e m ask specificat ion s.
Each ar r ay elem en t cor r espon ds t o on e displayable
t u ple at t r ibu t e wh ich is an in st an ce of a C str u ct u r e:
typedef struct {
char *name;
Lk_mask mask;
} Lk_attribute_mask;
name is t h e tu ple at t r ibu t e n am e, as k n own t o t h e
callin g pr ogr am . mask is a m ask iden t ifier (of t ype
Lk_mask) cor r espon din g t o t h e at t r ibu t e t ype. If a name
is wr on g (i.e., if it does n ot cor r espon d t o an at t r ibu t e),
you get a war n in g m essage an d n o att r ibu t e is
displayed for t h at n am e. If all of t h e n am es ar e wr on g,
all at t r ibu tes ar e displayed, as if acount is zer o. Not
ever y t u ple at t r ibu te n eed be in clu ded in th e ar r ay,
an d t h ose t h at ar e in clu ded m ay appear in an y or der .
Absen t at t r ibu t es ar e t r eat ed as fu lly en capsu lat ed an d
ar e n ot in clu ded in t h e t u ple m ask ( acount m ay be
less t h an t h e n u m ber of t u ple at t r ibu t es defin ed in t h e
sch em a). Th e or der of t h e ar r ay elem en t s deter m in es
t h e or der of t h e at tr ibu t es displayed in t h e m ask .
O2 Look User Man u al
97
3
Masks
On e lk_tuple m ask m ay con t ain an ot h er as a
Lk_mask specificat ion ; t h ese m ay be n est ed t o an y
r eason able dept h .
Description
Th e lk_tuple m ask fu n ct ion cr eat es a m ask for a t u ple valu e.
Th is fu n ct ion is u sed pr in cipally as an elem en t m ask specificat ion for
t h e followin g fu n ct ion s:
• lk_object for a t u ple-valu ed object
• lk_tuple for a t u ple-st r u ct u r ed at t r ibu t e of a t u ple
• lk_set for a set of t u ples
• lk_list for a list of tu ples
It m ay also be u sed dir ectly in an lk_present or
lk_refresh_presentation fu n ction , for a pr esen t at ion of a tu plest r u ctu r ed valu e.
98
Returns
A m ask iden t ifier of t ype Lk_mask.
Example
In t h e followin g exam ple u ses t h e class Per son wh ich h as sever al t u ple
at t r ibu tes an d u ses t h e lk_tuple m ask t o display on ly t h e per son ’s last
n am e an d st ar sign :
O2 Look User Man u al
Functions : lk_tuple
run body{
Lk_mask mk;
Lk_presentation pid;
o2 Person e = new Person;
Lk_attribute_mask pers_tup_mask[2];
pers_tup_mask[0].name = "last_name";
pers_tup_mask[0].mask = lk_generic();
pers_tup_mask[1].name = "star_sign";
pers_tup_mask[1].mask = lk_atom(0, 0, 0);
e->last_name ="Swanson";
e->star_sign="Cancer";
mk = lk_object(0, 0, 0,
lk_tuple (0, 0, 0, 2, pers_tup_mask));
pid = lk_present (e, mk, 0, 0, 0);
lk_map (pid, LK_COORDINATE, LK_FREE, LK_SCREEN, 50, 10);
lk_grab(pid);
}
Th is code gives t h e followin g win dow:
Fi gu r e 3 .8 : Usi n g t h e l k -t u p l e m a sk
O2 Look User Man u al
99
3
100
Masks
O2 Look User Man u al
4
G raphic Resourc es
4
Th is ch apt er gives all th e var iou s gr aph ic r esou r ces for O2 Look an d is
divided in t o t h e followin g sect ion s:
• Usin g gr aph ic r esou r ces
• Resou r ce files
• Resou r ce ar r ays
• H ow t o r ead r esou r ce t ables
• Global r esou r ces
• Pr esen t at ion r esou r ces
• Gr aph ic r esou r ces for in t eger s
• Gr aph ic r esou r ces for r eal n u m ber s
• Gr aph ic r esou r ces for ch ar act er s
• Gr aph ic r esou r ces for str in gs
• Gr aph ic r esou r ces for boolean valu es
• Gr aph ic r esou r ces for lists
• Gr aph ic Resou r ces for set s
• Gr aph ic r esou r ces for t u ples
O2 Look User Man u al
101
4
Graphic Resources
4.1 Using graphic resources
O2 Look pr esen t at ion s ar e sim ply M ot if win dows, an d as su ch t h eir
appear an ce an d beh avior m ay be cu st om ized lik e an y ot h er Mot if
win dow, by specifyin g gr aph i c r esou r ces. A r esou r ce is an y aspect of
t h e X Win dow Syst em t h at can be cu st om ized.
Th e X Win dow Syst em m ain tain s a dat abase of cu r r en t ly-active
r esou r ces, an d O2 Look pr ovides a m ean s of alt er in g t h e con ten ts of t h at
dat abase as t h ey apply t o O 2 Look pr esen tation s.
In t h is way, defau lt applicat ion r esou r ces m ay be est ablish ed;
m u lt ilin gu al or ot h er sit u at ion -specific application appear an ce an d
beh avior m ay be pr ogr am m ed; an d t h e en d u ser m ay cu stom ize
applicat ion s t o h is/ h er par t icu lar t ast e.
Resou r ces can be specified in eith er (or bot h ) of t wo ways: t h r ou gh a
r esou r ce f i l e con t ain in g r esou r ce com m an ds, or t h r ou gh th e passin g of
a list of r esou r ce valu es in an O 2 Look fu n ct ion call.
Wh en ever an O 2 Look r esou r ce is specified wit h t wo con flict in g valu es,
on e fr om a r esou r ce file an d t h e ot h er fr om a fu n ct ion call, t h e valu e
specified in t h e fu n ct ion call t ak es pr eceden ce.
4.2 Resource files
O2 Look -r elat ed r esou r ces m ay be specified in on e or m or e r esou r ce files
wh ich O2 Look r eads as it st ar t s u p or wh en it execu t es an
lk_prologue.
Th e n am es of t h e files r ead ar e det er m in ed by sever al var iables: th e
n am e of t h e O2 in st allat ion dir ector y, as est ablish ed at in st allat ion t im e;
t h e valu es of th e u ser ’s O2RESOURCE an d HOME en vir on m en t var iables;
an d t h e valu e of t h e context_name ar gu m en t of t h e m ost r ecen t ly
execu t ed lk_prologue fu n ct ion .
Th e files t o r ead in ar e det er m in ed as follows:
If O2RESOURCE is defin ed, O2 Look at t em pt s to load t h e file
O2_installation_directory/look/$O2RESOURCE/context_name
If O2RESOURCE is n ot defin ed, O2 Look t r ies
O2_installation_directory/look/context_name
102
O2 Look User Man u al
Resource files
O 2 Look t h en look s for
$HOME/.LKdefaults
If n eit h er 1 n or 2 exist s, n o r esou r ce file is loaded. If t h ey bot h exist ,
t h ey ar e bot h loaded, an d an y con flict in g r esou r ce defin it ion s ar e
r esolved by givin g.LKdefaults pr ior it y.
Th u s an application can ch an ge it s look an d/ or beh avior en t ir ely,
m er ely by issu in g an lk_prologue fu n ct ion wit h a n ew applicat ion
n am e; in t h e sam e way, an en d-u ser m ay ch oose a wh ole n ew set of
r esou r ces by ch an gin g h is/ h er O2RESOURCE var iable.
For exam ple, on e u ser m igh t set th e var iable t o english an d an ot h er t o
french; each wou ld r u n t h e sam e applicat ion , bu t see th e pr om pt s,
t u ple at t r ibu te n am es an d so on in t h e lan gu age of t h eir ch oice.
Fr om t h e pr ogr am m er ’s poin t of view, t h e on ly action r equ ir ed in or der
t o cr eate m u lt ilin gu al application s is t h e copyin g of t h e r esou r ce file
fr om on e look su bdir ector y t o an ot h er , an d t h e t r an slat ion of t h e
r elevan t ch ar act er st r in gs.
Resou r ces ar e specified in th ese files in t h e sam e m an n er t h at ot h er X
Win dow or M ot if r esou r ces ar e defin ed in files su ch as .Xdefaults:
Each r esou r ce is specified in a sin gle lin e of t ext , con sist in g of a
r esou r ce n am e followed by a colon , th en on e or m or e spaces, an d t h en a
valu e for t h at r esou r ce:
resource_name: resource_value
If a r esou r ce specificat ion is t oo lon g to fit on on e lin e, it m ay be br ok en
wit h t h e back -slash ch ar acter (\); a back -slash at t h e en d of a lin e
sign als t h at t h e n ext lin e is ju st a con t in u at ion of t h e pr esen t on e.
Sim ilar ly, th e dou ble-qu ot e ch ar act er (") m ay appear in a r esou r ce
specificat ion on l y i f it is pr eceded by a back lash es. In eit h er case, t h e
back lash es ch ar acter does n ot appear in t h e specificat ion it self; it is
on ly a sign al. An exam ple:
tour_booking.reservation.name.foregroundColor: red
Th is r esou r ce specificat ion iden t ifies a ver y par t icu lar su b-m ask of on e
sin gle pr esen tation : “In t h e tour_book in g applicat ion , th er e is a
pr esen t at ion called reservation wh ich displays a t u ple valu e, on e of
wh ose at t r ibu t es is called name. Display t h e valu e of t h at att r ibu t e in
r ed.”
Th e cor r espon den ce bet ween t h e elem en ts of t h e r esou r ce n am e an d t h e
pr esen t at ion s an d m ask s on t h e scr een is establish ed by t h e
ed_namear gu m en t of t h e O 2 Look fu n ct ion s lk_present,
lk_refresh_presentation an d t h e m ask fu n ct ion s given lat er in th is
sect ion . Th e ed_name ar gu m en t su pplies a n am e for t h e widget (m ask )
t o wh ich t h e r esou r ce is t o be applied. In or der for O2 Look t o associat e
O2 Look User Man u al
103
4
Graphic Resources
r esou r ces fr om r esou r ce files t o m ask s, ed_name m u st be su pplied —
t h at is, n ot left n u ll or blan k . Th e m ean in g of each of t h e par t s (called
editors1 ) of th e r esou r ce n am e given above is as follows:
• tour_booking is t h e n am e of t h e applicat ion , as defin ed in t h e
context_name ar gu m en t of t h e lk_prologue fu n ction .
• reservation is t h e n am e of a pr esen t at ion , as given in th e ed_name
ar gu m en t of t h e lk_present fu n ct ion wh ich defin ed t h at
pr esen t at ion .
• name is t h e n am e of a su b-m ask of t h e reservation pr esen t at ion .
Note t h at t h e lk_present fu n ct ion wh ich defin ed t h e pr esen t at ion
cou ld n ot h ave u sed an lk_generic or lk_protected m ask , sin ce
t h ose defau lt m ask s do n ot allow t h e n am in g of specific t u ple field
su b-m ask s. Th e m ask m u st h ave been lk_tuple, an d on e of t h e su bm ask s of t h e lk_tuple m ask was n o dou bt an lk_atom m ask wh ose
ed_name ar gu m en t was "name".
• foregroundColor is t h e n am e of an O2 Look r esou r ce, on e of wh ose
legal valu es is red. Th is is on e of t h e r esou r ces available wit h t h e
lk_atom m ask .
In st ead of iden t ifyin g th e n am es of in dividu al applicat ion s,
pr esen t at ion s an d su b-m ask s, a r esou r ce specificat ion m ay iden t ify
classes2 of applicat ion s, pr esen t at ion s an d su b-m ask s.
Un der t h e X Win dow Syst em , an editor class n am e is th e sam e as t h e
edit or n am e except t h at it s fir st let t er is capitalized.
A r esou r ce specificat ion m ay also u se wild-car d ch ar act er s (*) t o
in dicat e t h at all possible pr esen t at ion s or su b-m ask s ar e affect ed. For
exam ple:
TravelAgency*Tuple*Integer.backgroundColor: LightSteelBlue
Th is r esou r ce specificat ion m ay be r ead, “In all application s t h at h ave t o
do with a t r avel agen cy, wh er ever t h er e is a tu ple wit h an in teger
com pon en t , display t h e in t eger com pon en t on a ligh t st eel blu e
back gr ou n d.”
Th e m ean in g of each par t of t h is specificat ion is:
• TravelAgency is t h e class n am e of t h e applicat ion , as defin ed in t h e
context_class ar gu m en t of t h e lk_prologue fu n ct ion . (Again , we
ar e dealin g wit h X Win dow classes h er e, an d n ot wit h O2 classes.)
1. Th e t er m edit or can be m isleadin g: An edit or is sim ply an y pr esen t at ion , m ask or su bm ask t h at displays data on th e scr een , r egardless of wh et h er t h e display allows edit in g
(ch an gin g) of t h e dat a.
2. Th e t er m “class” h er e h as n oth in g to do with O2 classes.
104
O2 Look User Man u al
Resource files
• Tuple is t h e class n am e of all lk_tuple m ask s. Th e ast er isk in fr on t
of Tuple m ean s t h at t h e specificat ion applies t o all1 t u ple displays
in t h e Travel_agency gr ou p of application s, r egar dless of th e
pr esen t at ion n am e.
• Integer is t h e class n am e of all in t eger m ask s (t h at is, lk_atom
m ask s t h at display in t eger s). Th e ast er isk in fr on t of Integer m ean s
th at all in teger com pon en t s of t u ple displays ar e affect ed, even if
th er e ar e ot h er su b-m ask s in bet ween t h e t u ple an d t h e in teger (for
exam ple, a t u ple on e of wh ose at t r ibu t es is a set of in t eger s).
• backgroundColor is t h e n am e of an O 2 Look r esou r ce available for
in teger m ask s, an d on e of wh ose legal valu es is LightSt eelBlu e.
Special resources for application icons
Wh en an O2 applicat ion is lau n ch ed u n der O 2 Look , t h e syst em defin es
an d m aps a pr esen t at ion con t ain in g an icon r epr esen tin g t h e
applicat ion . You can over r ide t h is beh avior by specifyin g a pr ogr am
n am ed dashboard for t h e applicat ion . Refer t o t h e O2 C Refer en ce
m an u al.
Th e m en u associated wit h t h is icon h olds t h e pu blic pr ogr am s of t h e
applicat ion fr om wh ich t h e en d u ser m ay select . Th e appear an ce of bot h
t h e applicat ion icon an d it s pr esen tation m ay be t ailor ed t h r ou gh t h e
specificat ion of gr aph ic r esou r ces in a r esou r ce file.
Th is is don e u sin g t h e followin g in for m at ion :
• At t h e in vocat ion of th e application , t h e syst em au t om at ically
per for m s an lk_prologue fu n ct ion , u sin g as its context_name
ar gu m en t t h e n am e of t h e sch em a u n der wh ich th e application is
oper at in g, followed by an u n der scor e ch ar acter , followed by t h e n am e
of th e application :
schema_name_appli_name
Th er efor e, r elevan t r esou r ce specificat ion s cou ld be placed in an
application -specific r esou r ce file called context_name u n der t h e
look su bdir ect or y of t h e O2 in stallat ion dir ect or y.
• All of t h e pr esen t at ion r esou r ces ar e available for t h e applicat ion icon
pr esen t at ion . Th e ed_name of t h is pr esen tation is always
“applicat ion ”; so, for an application n am ed agency oper at in g u n der a
sch em a called sch1, t h e followin g r esou r ce specification wou ld
det er m in e a pr esen t at ion tit le for t h e icon display:
1. Or, rath er, it applies to all tu ple m ask s wh ich h ave an editor n am e. An y t u ple m ask s
wh ose ed_n am e argu m en t is zer o or n u ll will r em ain u n k n own t o t h e resou r ce m an ager;
n eith er t h e Tu ple class specificat ion n or t h e u se of t h e wild car d (*) will r escu e su ch
m ask s from t heir an on ym it y. Th e sam e applies t o an y n am eless pr esen tation , m ask or
su b-m ask .
O2 Look User Man u al
105
4
Graphic Resources
*sch1_agency.application.titleString:
Just testing...
• All of t h e r esou r ces for icon ic r epr esen tation s of objects ar e available
t o t h e applicat ion icon it self; t h e ed_name of t h e icon is t h e n am e of
t h e applicat ion . Con t in u in g t h e above exam ple, if you wan t t o display
t h e pr ogr am m en u in r ed on a yellow back gr ou n d, t h e followin g
r esou r ce specification s wou ld do so:
*sch1_agency.application.agency.menuForegroundColor: red
*sch1_agency.application.agency.menuBackgroundColor: yellow
4.3 Resource arrays
Th e gr aph ic r esou r ces specified in r esou r ce files (or left at t h eir defau lt
valu es) m ay be over r idden at r u n -t im e by calls to var iou s O 2 Look
fu n ct ion s.
Th is m ay be don e eith er wh en a pr esen t at ion or m ask is cr eated (by
passin g a list of r esou r ces t o t h e fu n ct ion t h at cr eat es it ), or lat er
(t h r ou gh t h e lk_refresh_presentation fu n ct ion ).
In eit h er case, t h e caller m u st su pply t wo ar gu m en t s: a cou n t of t h e
n u m ber of r esou r ces t o be cu st om ized (gen er ally called rcount) an d a
poin t er t o an ar r ay of r esou r ce specificat ion s (u su ally called
resources).
Each elem en t in t h e ar r ay m u st be of t ype Lk_resource, wh ich is
k n own t o th e syst em as t h e followin g C st r u ct u r e:
typedef struct {
char* name;
char* value;
} Lk_resource;
Th e name st r in g iden t ifies th e r esou r ce, an d t h e value st r in g in dicat es
wh at it is to be set t o.
Note
Th e name st r in g is n ot t h e fu ll n am e specificat ion r equ ir ed for a
r esou r ce file; it is on ly t h e last par t of t h at specificat ion , su ch as
"fontList" or "foregroundColor".
106
O2 Look User Man u al
How to read resource tables
Th is is becau se t h e fu n ct ion it self alr eady k n ows wh ich pr esen t at ion or
m ask is t o be affect ed by th e ch an ge.
Th e O2 Look fu n ct ion s t h at accept r esou r ce ar r ays ar e:
• lk_prologue
r esou r ce specificat ion s affect all pr esen t at ion s u n der t h e n ewly-in it iated
applicat ion con t ext. On ly global r esou r ces m ay be specified h er e.
• lk_present
r esou r ce specificat ion s affect on ly t h e pr esen t at ion bein g cr eat ed.
• lk_refresh_presentation
r esou r ce specificat ion s affect on ly t h e pr esen t at ion bein g r efr esh ed. Th e
r esou r ces ar e th e sam e as for lk_present.
• All mask functions
r esou r ce specificat ion s affect on ly t h e m ask bein g cr eat ed. H owever ,
t h is m ask m ay be u sed as a su b-m ask in sever al pr esen t at ion s at on ce.
Th e r esou r ces th at m ay be cu st om ized var y fr om on e t ype of m ask to
an ot h er ; t h e r elevan t list is given for each m ask fu n ct ion descr ibed in
t h e pr esen t sect ion .
4.4 How to read resource tables
Th e followin g sect ion s deal wit h t ables of gr aph ic r esou r ces wh ich can
be cu stom ized for cer t ain m ask s or u n der cer t ain con dit ion s.
Th e tables h ave fou r colu m n s:
• Name
Th e r esou r ce n am e.
O2 Look User Man u al
107
4
Graphic Resources
• Type
Th e r esou r ce type.
• Default
Th e defau lt valu e of t h e r esou r ce.
• Access
How th e r esou r ce can be accessed.
Th is sect ion n ow det ails h ow t o r ead t h e gr aph ic r esou r ce t ables given in
t h is ch apt er .
Name
Th e r esou r ce n am e is given in fu ll an d is case sen sit ive.
In a r esou r ce ar r ay ar gu m en t of an O 2 Look fu n ct ion , t h is is t h e n am e (in
fu ll an d alon e) t h at m u st be assign ed t o t h e name str in g of an
Lk_resource st r u ct u r e.
In a r esou r ce file, th is n am e m u st be pr eceded by on e or m or e edit or
n am es, specifyin g t h e pr esen t at ion or m ask wh ose r esou r ce is t o be
alt er ed.
A r esou r ce n am e always begin s wit h a lower -case let t er ; t h e n am e of t h e
r esou r ce class is always t h e r esou r ce n am e wit h t h e fir st let t er
capit alized.
Im m ediately followin g each r esou r ce table, ever y r esou r ce n am e list ed in
t h e t able is explain ed br iefly.
Type
Th e t ype of t h e r esou r ce is u sefu l m ain ly t o u n der st an d t h e k in ds of
valu es t h at t h e r esou r ce m ay tak e.
Note
In an Lk_resource st r u ct u r e, t h e value at t r ibu te is al w ay s a char *.
Th e followin g type specification s ar e u sed in r esou r ce valu es:
108
O2 Look User Man u al
How to read resource tables : Type
• Boolean
A Boolean valu e accept s t h e st r in gs "true", "false", "yes", "no",
"on" an d "off", an d is case in sen sit ive.
• Font
A Fon t valu e is a st r in g descr ibin g t h e pr oper t ies of t h e fon t (r at h er th e
n am e of t h e file in wh ich t h e fon t is stor ed).
Th e st r in g
"-adobe-courier-bold-o-normal--10-100-75-75-m-60-iso8859-1"
specifies t h e fou n dr y (adobe), t h e fon t fam ily (cou r ier ), weigh t (bold),
slan t (obliqu e), set widt h (n or m al), size of th e fon t in pixels (10), size of
t h e fon t in t en th s of a poin t (100), h or izon t al r esolu t ion (75 dpi), ver t ical
r esolu t ion (75 dpi), spacin g (m for m on o-space), aver age widt h in t en t h s
of pixel (60) an d ch ar act er set (iso8859-1).
Sin ce t ypin g su ch n am es is n ot always desir able, wild car d ch ar act er s
ar e acceptable.
An y u n n ecessar y par t of a fon t n am e can be “wildcar ded” by a qu est ion
m ar k for an y sin gle ch ar act er , an d an ast er isk for an y gr ou p of
ch ar act er s. For exam ple:
"*courier-bold-o-*-100-*"
As a gen er al r u le, you sh ou ld always specify t h e followin g par t s:
-
Fon t : Ch ar t er , Cou r ier , New Cen t u r y Sch oolbook , Sym bol, Tim es)
Weigh t : m ediu m , bold
An gle: r om an , it alic, obliqu e
Size: 8, 10, 12, 14, 18, 24
Th e r est m ay be wild-car ded. Th e fon ts ar e stor ed in t h e dir ect or ies:
/usr/lib/X11/fonts/75dpi an d /usr/lib/X11/fonts/100dpi
• Color
A Color valu e m ay be eit h er a st r in g or a h exadecim al n u m ber . A set of
pr edefin ed color s is assign ed t o specific (bu t n ot n ecessar ily in t u it ive)
n am es.
Th is set is defin ed is t h e rgb.txt file locat ed in /usr/lib/X11. You
can also specify color s m or e exact ly u sin g a h exadecim al color st r in g.
Th e m odel u sed is th e RGB m odel an d t h e in t en sit y of each pr im ar y
color is con t r olled by a t h r ee-par t digit al valu e lik e #RGB, #RRGGBB,
#RRRGGGBBB an d #RRRRGGGGBBBB wh er e R, G an d B r epr esen t sim ple
h exadecim al digit valu es.
O2 Look User Man u al
109
4
Graphic Resources
For exam ple: #000 m ean s black , #FF0000 r ed, #00F blu e, an d #FF00FF
m agen t a.
Th e defau lt valu e is com pu t ed dyn am ically depen din g on t h e h ar dwar e:
• Pixmap
Th e Pixm ap valu e is th e fu ll pat h n am e of th e file con t ain in g a bit m ap in
X11 (or X10) for m at .
• C and O2 types
Th e u su al C an d O 2 t ypes ar e u sed as well: int, short, string, char *;
unsigned char gen er ally r epr esen t s an en u m er at ed type. Again , all
r esou r ce valu es ar e r epr esen ted as st r in gs in O2 Look fu n ct ion s,
r egar dless of th eir t it u lar t ypes.
Default
Th e defau lt valu e is t ak en by t h e r esou r ce if it is n ot ot h er wise specified.
Access
Th is sh ows u n der wh at con dit ion s t h e r esou r ce m ay be set.
• C
Th is r esou r ce can be set wh en t h e pr esen t at ion is cr eated an d can n ot be
ch an ged after war ds.
• S
Th e r esou r ce m ay be ch an ged su bsequ en t t o cr eat ion . Th e
lk_refresh_presentation fu n ct ion accom plish es t h is at t h e
pr esen t ation level, for t h at pr esen t at ion an d all of it s su b-m ask s.
Th e list of global r esou r ces h as n o Access colu m n , sin ce global
r esou r ces m ay be set on ly at th e in it ializat ion of an applicat ion con t ext,
an d h ave n ot h in g t o do dir ect ly wit h pr esen t at ion s or m ask s.
110
O2 Look User Man u al
Global resources : Access
4.5 Global resources
Table 4.1 list s t h e gr aph ic r esou r ces you can cu st om ize for an
application con text , eit h er in a r esou r ce file associat ed to t h e
context_name an d/ or context_class ar gu m en t of th e lk_prologue
fu n ct ion , or dir ectly in t h e resources ar gu m en t of lk_prologue.
Table 4.1
Global resources
Nam e
Type
Defaul t
pr esSpacin g
sh ort
0
h igh light Widt h
sh ort
3
h igh light Col or
Col or
Dyn am ic
cu r sorFor egrou ndColor
Col or
Dyn am ic
cu r sorBack grou ndCol or
Col or
Dyn am ic
clipUse
Bool ean
False
clipIn it ialSt at e
in t
1
clipIcon
Pixm ap
UNSPECIFIED_PIXMAP
clipLabel
str in g
"LKClip"
clipGeom et ry
str in g
NULL
clipFor egr ou n dColor
Col or
Dyn am ic
clipBack grou ndColor
Col or
Dyn am ic
clipNext Type
u n si gn edchar
STRING
clipNext St rin g
st r in g
"Next "
clipNext Pixm ap
Pixm ap
UNSPECIFIED_PIXMAP
clipIn sensit i veNext Pixm ap
Pixm ap
UNSPECIFIED_PIXMAP
clipPreviou sType
u n si gn edchar
STRING
clipPreviou sStr ing
st r in g
"Previou s"
clipPreviou sPi xm ap
Pixm ap
UNSPECIFIED_PIXMAP
clipIn sensit i vePreviou sPixm ap
Pixm ap
UNSPECIFIED_PIXMAP
clipDelet eType
u n si gn edchar
STRING
clipDelet eSt r in g
str in g
"Delete"
clipDelet ePi xm ap
Pixm ap
UNSPECIFIED_PIXMAP
clipIn sensit i veDelet ePixm ap
Pixm ap
UNSPECIFIED_PIXMAP
clipFon t List
str in g
"fixed"
lar geLower Bou n d
in t
50
O2 Look User Man u al
111
4
Graphic Resources
• presSpacing
Pixel spacin g bet ween pr esen t at ion s wh en u sin g t h e placem en t
ar gu m en t wit h t h e x an d y par am et er s of lk_map (e.g. LK_RIGHT,
LK_LEFT). H or izon tally, t h e syst em u ses presSpacing + x, an d
ver t ically, presSpacing + y.
• highlightWidth
Pixel widt h of h igh ligh ted bor der of m ask du r in g cu t , copy or
sh ar e (if a past e oper at ion is allowed on th at m ask ).
• highlightColor
Color of h igh ligh t ed bor der of m ask du r in g cu t , copy or sh ar e
oper ation s (if a past e oper ation is allowed on t h at m ask ).
• cursorForegroundColor
For egr ou n d color of special cu r sor du r in g cu t , copy or sh ar e
oper ation s.
• cursorBackgroundColor
Back gr ou n d color of special cu r sor du r in g cu t, copy or sh ar e.
• clipUse
Is t h e Clipboar d u sed or n ot
• clipInitialState
In it ial Clipboar d state. Use 0 for a fu ll win dow, or 1 for an icon
• clipIcon
Clipboar d icon bit m ap.
• clipLabel
Title of Clipboar d win dow or icon
• clipGeometry
In it ial posit ion an d size of Clipboar d win dow as specified in t h e
st r in g: "=widthxheight+x_position+y_position" , e.g.
"=200x200+300+300".
• clipForegroundColor
Clipboar d for egr ou n d color .
• clipBackgroundColor
Clipboar d back gr ou n d color .
• clipNextType
Is t h e Clipboar d Next bu t t on labeled wit h a st r in g (STRING) or a
bitm ap (PIXMAP).
• clipNextString
Next bu t t on st r in g if clipNextType is STRING.
• clipNextPixmap
Act ive Next bu t t on bit m ap if clipNextType is PIXMAP.
• clipInsensitiveNextPixmap
In active Next bu t ton bit m ap, if clipNextType is PIXMAP.
• clipPreviousType
Is Pr eviou s bu t t on labeled wit h a st r in g or a bit m ap.
• clipPreviousString
Pr eviou s bu t t on st r in g if clipPreviousType is STRING.
• clipPreviousPixmap
Act ive Pr eviou s bu t ton bit m ap if clipPreviousType is PIXMAP.
• clipInsensitivePreviousPixmap
In act ive Pr eviou s bu tt on bit m ap if clipPreviousType is PIXMAP.
• clipDeleteType
Is t h e Clipboar d Delet e bu t t on labeled wit h a st r in g (STRING) or a
bitm ap (PIXMAP).
• clipDeleteString
D elet e bu t t on st r in g, if clipDelet eType is STRING.
• clipDeletePixmap
Act ive Delet e bu t t on bit m ap, if clipDeleteType is PIXMAP.
• clipInsensitiveDeletePixmap
In act ive Delet e bu t t on bit m ap, if clipDeleteType is PIXMAP.
• clipFontList
Clipboar d fon t .
• largeLowerBound
M in im u m set an d list size above wh ich display is by page .
112
O2 Look User Man u al
Presentation resources
4.6 Presentation resources
Th e followin g t able list s th e gr aph ic r esou r ces wh ich m ay be cu st om ized
for an in dividu al pr esen tation , eith er in a r esou r ce file in associat ion
wit h t h e ed_name ar gu m en t of eit h er t h e lk_present or
lk_refresh_presentation fu n ct ion , or dir ect ly in t h e resources
ar gu m en t of t h ose fu n ct ion s.
Table 4.2
Presentation resources
Nam e
Ty pe
Defaul t
Access
for egr ou n dColor
Col or
Dyn am ic
CS
back gr ou n dColor
Col or
Dyn am ic
CS
edit abl e
Bool ean
Tru e
CS
r epl aceProcess
Bool ean
Tru e
CS
t it leFont List
Font
Dyn am ic
CS
bu t t on Fon t Li st
Font
Dyn am ic
CS
t it leSt rin g
str in g
pen
u n si gn ed char
DEFAULT
C
pen Type
u n si gn ed char
PIXMAP
CS
pen St rin g
st r in g
"save"
CS
pen Pixm ap
Pixm ap
Dyn am ic
CS
eraser
u n si gn ed char
DEFAULT
C
eraserType
u n si gn ed char
PIXMAP
CS
eraserSt r in g
str in g
"er ase"
CS
eraserPixm ap
Pixm ap
Dyn am ic
CS
l ock edPenType
u n si gn ed char
PIXMAP
CS
l ock edPenSt r in g
st r in g
"lock ed"
CS
l ock edPenPixm ap
Pixm ap
Dyn am ic
CS
l ock edEraserType
u n si gn ed char
PIXMAP
CS
l ock edEraserStr in g
str in g
"lock ed"
CS
l ock edEraserPixm ap
Pixm ap
Dyn am ic
CS
O2 Look User Man u al
""
CS
113
4
Graphic Resources
Th e gr aph ic r esou r ces for pr esen t at ion s ar e :
• foregroundColor
Pr esen t at ion for egr ou n d color .
• backgroundColor
Pr esen t at ion back gr ou n d color .
• editable
Can t h e pr esen t at ion con t en t s be m odified by t h e en d-u ser ? If
False, t h e u ser can n ot ch an ge t h e valu es displayed. If True, h e/
sh e can . You can also set t h is r esou r ce for an y com pon en t m ask
of t h e pr esen t at ion , t h er eby over r idin g pr esen tation ’s over all
sett in g.
• replaceProcess
Can pr esen t at ion con t en t s be r eplaced u sin g past e? For an object
pr esen t at ion , n ote t h at r eplacin g an object im plies u pdat in g it s
en capsu lat ed valu e an d r eplacin g it s object iden tit y.
• titleFontList
Pr esen t at ion t itle fon t .
• buttonFontList
Fon t for t h e pr esen t at ion bu tt on s.
• titleString
Pr esen t at ion t itle com pou n d st r in g.
• pen
Wh et h er t h e pen bu tt on is displayed for t h e pr esen t at ion . If t h is
r esou r ce is INVISIBLE: th e pen bu t t on is n ever displayed, if
VISIBLE: it always visible, an d if DEFAULT: it on ly appear s if th e
pr esen t at ion displays an object or is lock ed by lk_wait or
lk_grab.
• penType
Pen bu tt on t ype (STRING or PIXMAP).
• penString
Pen bu tt on st r in g if penType is STRING.
• penPixmap
Pen bu tt on bit m ap if penType is PIXMAP.
• eraser
Is t h e er aser bu t ton displayed in t h e pr esen t at ion . Th e opt ion s ar e
VISIBLE or DEFAULT (eqivalen t ), an d INVISIBLE.
• eraserType
Er aser bu t ton type (STRING or PIXMAP).
• eraserString
Er aser bu t ton st r in g if eraserType is STRING.
• eraserPixmap
Er aser bu t ton bit m ap if eraserType is PIXMAP.
• lockedPenType
Pen bu tt on t ype (STRING or PIXMAP) wh en t h e pr esen t at ion is
lock ed.
• lockedPenString
Pen bu tt on st r in g if t h e pr esen t at ion is lock ed an d
lockedPenType is STRING.
• lockedPenPixmap
Pen bu tt on bit m ap if t h e pr esen t at ion is lock ed an d
lockedPenType is PIXMAP.
• lockedEraserType
Er aser bu t ton type (STRING or PIXMAP) wh en th e pr esen t at ion is
lock ed.
• lockedEraserString
Er aser bu t ton st r in g is th e pr esen tat ion is lock ed an d
lockedEraserType is STRING.
• lockedEraserPixmap
Pen bu tt on bit m ap if t h e pr esen t at ion is lock ed an d
lockedEraserType is PIXMAP.
114
O2 Look User Man u al
Graphic resources for integers
4.7 Graphic resources for integers
An exam ple win dow t h at u ses t h e defau lt m ask for in t eger s look s lik e
t h is:
Table 4.3 lists t h e gr aph ic r esou r ces wh ich m ay be cu st om ized for an
in t eger m ask wit h t h e lk_atom fu n ction , eith er in a r esou r ce file in
associat ion wit h t h e ed_name ar gu m en t , or dir ectly in t h e resources
ar gu m en t .
Table 4.3
Graphic resources for integers
Nam e
Type
Default
Access
for egr ou n dColor
Color
Dyn am ic
CS
back gr ou n dColor
Color
Dyn am ic
CS
edit abl e
Boolean
Tr u e
CS
r epl aceProcess
Boolean
Tr u e
CS
shar ePr ocess
Boolean
Tr u e
CS
fon t List
Fon t
"fi xed"
CS
m axLen gt h
i nt
M AXINT
CS
colu m ns
sh ort
20
CS
Th e gr aph ic r esou r ces of t h e m ask for in t eger s ar e as follows:
• foregroundColor
For egr ou n d color .
• backgroundColor
Back gr ou n d color .
• editable
Can en d-u ser ch an ge t h e m ask con ten ts?
• replaceProcess
Can m ask con t en t s be r eplaced u sin g past e?
• shareProcess
Can m ask con t en t s be copied?
• fontList
Fon t u sed.
• maxLength
Maxim u m len gt h of in t eger st r in g th at can be en t er ed fr om t h e
k eyboar d.
O2 Look User Man u al
115
4
• columns
Graphic Resources
In it ial widt h of in teger m ask in ch ar acter s.
4.8 Graphic resources for real numbers
Th e followin g exam ple u ses t h e defau lt m ask for r eal n u m ber s:
Table 4.4 list s t h e gr aph ic r esou r ces wh ich m ay be cu stom ized for an
r eal n u m ber m ask wit h t h e lk_atom fu n ct ion , eit h er in a r esou r ce file in
associat ion with t h e ed_name ar gu m en t , or dir ect ly in t h e resources
ar gu m en t.
Table 4.4
Graphic resources for real numbers
Nam e
Type
Default
Access
for egr ou n dColor
Col or
Dyn am ic
CS
back grou n dColor
Col or
Dyn am ic
CS
edit able
Boolean
Tr u e
CS
r epl acePr ocess
Boolean
Tr u e
CS
shar ePr ocess
Boolean
Tr u e
CS
fon t List
Font
"fi xed"
CS
m axLen gt h
in t
M AXINT
CS
colu m ns
sh ort
20
CS
pr ecision
sh ort
6
CS
Th e gr aph ic r esou r ces of t h e m ask for r eal n u m ber s ar e as follows:
• foregroundColor
For egr ou n d color .
• backgroundColor
Back gr ou n d color .
• editable
Can en d-u ser ch an ge th e m ask con ten t s.
• replaceProcess
Can th e con t en t s of t h e m ask be r eplaced u sin g paste.
116
O2 Look User Man u al
Graphic resources for characters
• shareProcess
Can m ask con t en t s be copied?
• fontList
Fon t u sed.
• maxLength
Maxim u m len gt h of r eal n u m ber str in g en ter ed via t h e k eyboar d.
• columns
In it ial widt h of t h e r eal n u m ber m ask in ch ar act er s.
• precision
Nu m ber of digits aft er t h e r eadix separ at or .
4.9 Graphic resources for characters
Th e followin g win dow u ses t h e defau lt m ask for ch ar act er s:
Table 4.5 list s t h e gr aph ic r esou r ces wh ich m ay be cu stom ized for a
ch ar acter m ask wit h th e lk_atom fu n ct ion , eit h er in a r esou r ce file in
associat ion wit h t h e ed_name ar gu m en t , or dir ectly in t h e resources
ar gu m en t .
Table 4.5
Graphic resources for characters
Nam e
Ty pe
Default
Access
for egr ou n dColor
Col or
Dyn am ic
CS
back gr ou n dColor
Col or
Dyn am ic
CS
edit abl e
Bool ean
Tr u e
CS
r epl aceProcess
Bool ean
Tr u e
CS
shar ePr ocess
Bool ean
Tr u e
CS
fon t List
Font
"fi xed"
CS
Th e gr aph ic r esou r ces of t h e m ask for ch ar act er s ar e as follows:
• foregroundColor
For egr ou n d color .
• backgroundColor
Back gr ou n d color .
O2 Look User Man u al
117
4
Graphic Resources
• editable
Can en d-u ser ch an ge th e m ask con ten t s?
• replaceProcess
Can m ask con t en t s be r eplaced u sin g past e?
• shareProcess
Can m ask con t en t s be copied?
• fontList
Fon t u sed.
4.10 Graphic resources for strings
Th e defau lt m ask for st r in gs look s as in t h e followin g exam ple win dow:
Table 4.6 list s t h e gr aph ic r esou r ces wh ich m ay be cu stom ized for a
st r in g m ask wit h t h e lk_atom fu n ct ion , eith er in a r esou r ce file in
associat ion with t h e ed_name ar gu m en t , or dir ect ly in t h e resources
ar gu m en t.
Table 4.6
Graphic resources for strings
Nam e
Type
Default
Access
for egr ou n dColor
Col or
Dyn am ic
CS
back grou n dColor
Col or
Dyn am ic
CS
edit able
Boolean
Tr u e
CS
r epl acePr ocess
Boolean
Tr u e
CS
shar ePr ocess
Boolean
Tr u e
CS
fon t List
Font
"fi xed"
CS
m axLen gt h
in t
M AXINT
CS
colu m ns
sh ort
20
CS
Th e gr aph ic r esou r ces of t h e m ask for st r in gs ar e as follows:
• foregroundColor
118
For egr ou n d color .
O2 Look User Man u al
Graphic resources for boolean values
• backgroundColor
Back gr ou n d color .
• editable
Can en d-u ser ch an ge t h e m ask con ten ts?
• replaceProcess
Can m ask con t en t s be r eplaced u sin g past e?
• shareProcess
Can m ask con t en t s be copied?
• fontList
Fon t u sed .
• maxLength
Maxim u m len gt h of t h e st r in g t h at can be en t er ed fr om t h e k eyboar d.
• columns
In it ial widt h of t h e str in g m ask m easu r ed in ch ar act er spaces.
4.11 Graphic resources for boolean values
A boolean m ask can con sist of t wo par t s: an “in dicat or ” su ch as t h ose
pict u r ed h er e (a diam on d or squ ar e box t h at is filled if t h e boolean valu e
is true an d em pty if false), an d a label in t h e for m of a st r in g or
bitm ap.
Th e u ser m ay click on eit h er of t h ese par t s t o r ever se th e boolean valu e.
If a bit m ap label is u sed, it t oo ch an ges wit h t h e valu e; h owever , if a
st r in g label is u sed, it does n ot ch an ge.
Th ese for m at s ar e con t r olled by gr aph ic r esou r ces in t h e t able below.
Table 4.7 lists t h e gr aph ic r esou r ces wh ich m ay be cu st om ized for a
boolean m ask wit h th e lk_atom fu n ct ion , eit h er in a r esou r ce file in
associat ion wit h t h e ed_name ar gu m en t, or dir ect ly in t h e resources
ar gu m en t .
Table 4.7
Graphic resources for boolean values
Nam e
Type
Defaul t
Access
for egr ou n dColor
Col or
Dynam ic
CS
back gr ou n dColor
Col or
Dynam ic
CS
edit abl e
Bool ean
Tru e
CS
r epl aceProcess
Bool ean
Tru e
CS
shar ePr ocess
Bool ean
Tru e
CS
fon t List
st r in g
"Fixed"
CS
O2 Look User Man u al
119
4
Table 4.7
Graphic Resources
Graphic resources for boolean values
Nam e
Type
Default
Access
in di cat orOn
Boolean
Tr u e
CS
in di cat orType
u n signed ch ar
DIAM OND
CS
select Color
Color
Dyn am ic
CS
labelType
u n signed ch ar
STRING
CS
labelSt ri ng
str in g
""
CS
select Pixm ap
Pixm ap
UNSPECIFIED_PIXMAP
CS
u nsel ect Pixm ap
Pixm ap
UNSPECIFIED_PIXMAP
CS
Th e gr aph ic r esou r ces of t h e m ask for boolean s ar e as follows:
• foregroundColor
For egr ou n d color .
• backgroundColor
Back gr ou n d color .
• editable
Can en d-u ser ch an ge th e m ask con ten t s?
• replaceProcess
Can m ask con t en t s be r eplaced u sin g past e?
• shareProcess
Can m ask con t en t s be copied?
• fontList
Fon t u sed .
• indicatorOn
Can toggle in dicat or be dr awn t o t h e left of t h e label t ext or bit m ap.
• indicatorType
Sh ape of t h e t oggle in dicat or . Per m it t ed valu es ar e DIAMOND an d SQUARE.
• selectColor
Color t h at fills t h e cen t er of t h e t oggle in dicat or wh en it is set (true).
• labelType
Label t ype. If STRING, t h e t ext of labelSt r in g is displayed; if PIXMAP, th e
bit m ap specified by select Pixm ap or u n select Pixm ap is displayed.
• labelString
St r in g t o display wh en labelType is STRING.
• selectPixmap
Bit m ap t o be u sed if labelType is PIXMAP an d t h e boolean editor is
select ed (true).
• unselectPixmap
Bit m ap t o be u sed if labelType is PIXMAP an d t h e boolean editor is
u n select ed (false).
120
O2 Look User Man u al
Graphic resources for lists
4.12 Graphic resources for lists
Th e list defau lt m ask is a on e-dim en sion al ver t ical ar r ay of elem en t
m ask s.
You u se t h e gr aph ic r esou r ces in associat ion with t h e lk_list fu n ct ion
eit h er in a r esou r ce file in t h e ed_name ar gu m en t or dir ect ly in t h e
resources ar gu m en t .
Th e followin g win dow u ses t h e list m ask :
Table 4.8 lists t h e r esou r ces for list s.
Th e n u m ber of elm en t s in a l ar ge l i st exceeds th e lim it set in t h e global
r esou r ce largeLowerBound. Th ese list s also h ave special r esou r ces.
Table 4.9 t h e special r esou r ces for lar ge list s.
Table 4.8
Graphic resources for lists
Nam e
Type
Defaul t
Access
for egr ou n dColor
Color
Dyn am ic
CS
back gr ou n dColor
Color
Dyn am ic
CS
edit abl e
Boolean
Tr u e
CS
r epl aceProcess
Boolean
Tr u e
CS
shar ePr ocess
Boolean
Tr u e
CS
cu t Process
Boolean
Tr u e
CS
O2 Look User Man u al
121
4
Table 4.8
Graphic Resources
Graphic resources for lists
Nam e
Type
Def ault
Access
in sert Process
Boolean
Tr u e
CS
n ewProcess
Boolean
Tr u e
CS
m enu Foregrou n dCol or
Color
Dyn am ic
CS
m enu Back gr ou n dColor
Color
Dyn am ic
CS
m enu Tit leSt r in g
st rin g
"New"
CS
m enu Fon t List
Fon t
"fixed"
CS
ori en t at ion
u n sign ed ch ar
VERTICAL
CS
gr id
Boolean
Tr u e
CS
gr idType
u n sign ed ch ar
SHADOW_ETCHED_IN
CS
cellM axHeigh t
sh or t
1000
CS
cellM axWidt h
sh or t
1000
CS
cellM in Height
sh or t
10
CS
cellM in Widt h
sh or t
10
CS
spacin g
sh or t
10
CS
vi sibleRowCou nt
sh or t
20
C
Th e specificat ion of each r esou r ce is given below.
Th e gr aph ic r esou r ces of t h e m ask for list s ar e as follows:
• foregroundColor
For egr ou n d color .
• backgroundColor
Back gr ou n d color .
• editable
Can list valu e be edited. If False, you can n ot add or r em ove elem en ts
fr om t h e list n or delet e or r eplace t h e en tir e list .
• replaceProcess
Can t h e con t en t s of an y of t h e list elem en t s be r eplaced u sin g paste. For
an object r eplacin g an object m ean s u pdat in g it s en capsu lated valu e
an d r eplacin g it s object iden t it y wit h t h at of t h e past ed object .
• shareProcess
Can m ask con t en t s be sh ar ed; for list valu es, t h is is t h e sam e as
copyin g.
• cutProcess
Can you cu t oper at ion list elem en ts u sin g Cu t.
• insertProcess
Can you in ser t an elem en t in t o t h e list u sin g past e?
• newProcess
Can you in ser t a n ew em pt y elem en t in t o t h e list u sin g t h e in ser t pop-u p
m en u . (For an object list , t h is gen er at es a n ew n il object an d in vok es
n ew).
122
O2 Look User Man u al
Graphic resources for lists
• menuForegroundColor In ser t pop-u p m en u for egr ou n d color .
• menuBackgroundColor In ser t pop-u p m en u back gr ou n d color .
• menuTitleString
St r in g displayed in t h e in ser t pop-u p m en u .
• menuFontList
Fon t u sed in th e in ser t pop-u p m en u .
• orientation
List or ien t at ion . If VERTICAL, list elem en t s on e u n der an oth er . If
HORIZONTAL, t h e list elem en ts ar e side by side.
• grid
Ar e t h e lin es separ atin g t h e list elem en t s (t h e gr id) visible or n ot .
• gridType
St yle of t h e lin es for m in g t h e gr id. Possible valu es ar e:
-
SINGLE_LINE, DOUBLE_LINE, or NO_LINE
SINGLE_DASHED_LINE,or DOUBLE_DASHED_LINE
SHADOW_ETCHED_IN (dou ble lin e et ch ed in t o t h e win dow) or
SHADOW_ETCHED_OUT (dou ble lin e et ch ed com in g ou t fr om t h e
win dow)
• cellMaxHeight
Maxim u m h eigh t of a sin gle elem en t cell.
• cellMaxWidth
Maxim u m widt h of a sin gle elem en t cell.
• cellMinHeight
Min im u m h eigh t of a cell. (m in im u m h eigh t £ m axim u m h eigh t ).
• cellMinWidth
Min im u m widt h of a cell. (m in im u m widt h £ m axim u m widt h ).
• spacing
Space in pixels between t wo elem en t s in t wo adjacen t s cells.
• visibleRowCount
Nu m ber of visible r ows at cr eat ion .
If t h e n u m ber of elm en t s in you r list exceeds t h e lim it set in t h e global
r esou r ce largeLowerBound, t h en t h e list is a l ar ge l i st . Th ese lar ge
list s also h ave special r esou r ces given in Table 4.9.
Table 4.9
Special resources for large lists
Nam e
Type
Default
bu t t on BarForegr ou n dColor
Color
Dyn am ic
CS
bu t t on BarBack gr ou n dColor
Color
Dyn am ic
CS
bu t t on For egr ou n dColor
Color
Dyn am ic
CS
bu t t on Back gr ou n dColor
Color
Dyn am ic
CS
n ext Type
u n signed ch ar
STRING
CS
n ext St rin g
st r in g
"Next "
CS
n ext Pixm ap
Pixm ap
UNSPECIFIED_PIXMAP
CS
i nsen si t iveNext Pixm ap
Pixm ap
UNSPECIFIED_PIXMAP
CS
previou sType
u n signed ch ar
STRING
CS
O2 Look User Man u al
Access
123
4
Graphic Resources
Table 4.9
Special resources for large lists
Nam e
Type
Default
Access
pr eviou sSt r i ng
st ring
"Previou s"
CS
pr eviou sPixm ap
Pi xm ap
UNSPECIFIED_PIXMAP
CS
in sen sit ivePr eviou sPixm ap
Pi xm ap
UNSPECIFIED_PIXMAP
CS
fon t List
Fon t
"fi xed"
CS
Th e specificat ion of each r esou r ce an d t h e gr aph ic r esou r ces of t h e
m ask for lar ge list s ar e as follows:
• buttonBarForegroundColor
Bu t t on bar for egr ou n d color .
• buttonBarBackgroundColor
Bu t t on bar back gr ou n d color .
• buttonForegroundColor
For egr ou n d color of th e bu t t on bar bu t t on s .
• buttonBackgroundColor
Back gr ou n d color of t h e bu t t on s in t h e bu tt on bar .
• nextType
Is bu t t on u sed t o display n ext page u sin g STRING or PIXMAP.
• nextString
Bu t t on label for n ext page display wh en nextType is STRING.
• nextPixmap
Bu t t on bit m ap for n ext page display wh en nextType is PIXMAP
an d bu t t on is act ive.
• insensitiveNextPixmap
Bu t t on bit m ap for n ext page display, wh en bu t t on is in act ive an d
nextType is PIXMAP.
• previousType
Is bu t t on u sed t o display pr eviou s page u sin g STRING or PIXMAP.
• previousString
Bu t t on label for pr eviou s page display wh en previousType is
STRING.
• previousPixmap
Bu t t on bitm ap for pr eviou s page display wh en t h at bu t t on is active
an d previousType is PIXMAP.
• insensitivePreviousPixmap
Bu t t on bit m ap for pr eviou s page display wh en bu t ton is in act ive
an d previousType is PIXMAP.
• fontList
Fon t u sed for t h e bu t t on labels.
124
O2 Look User Man u al
Graphic Resources for sets
4.13 Graphic Resources for sets
Th e set defau lt m ask is a t wo-dim en sion al ar r ay of elem en t m ask s.
Th e gr aph ic r esou r ces ar e u sed wit h lk _set , eith er in a r esou r ce file
wit h t h e ed_name ar gu m en t , or dir ect ly in t h e resources ar gu m en t .
Th e followin g win dow in clu des th e defau lt set m ask :
Table 4.10 list s t h e gr aph ic r esou r ces for sets.
Th e elem en t s of a l ar ge set exceed t h e lim it specified in th e global
r esou r ce largeLowerBound).
In addition t o th e r esou r ces list ed above for set m ask s, lar ge set h ave
t h e followin g r esou r ces. Table 4.11 list t h e special r esou r ces for lar ge
sets.
Table 4.10
Graphic Resources for sets
Nam e
Type
Defaul t
Access
for egr ou n dColor
Color
Dynam ic
CS
back gr ou n dColor
Color
Dynam ic
CS
edit abl e
Boolean
Tru e
CS
r epl aceProcess
Boolean
Tru e
CS
shar ePr ocess
Boolean
Tru e
CS
cu t Process
Boolean
Tru e
CS
i nser t Pr ocess
Boolean
Tru e
CS
n ewProcess
Boolean
Tru e
CS
m en u For egr ou n dColor
Color
Dynam ic
CS
O2 Look User Man u al
125
4
Table 4.10
Graphic Resources
Graphic Resources for sets
Nam e
Type
m en u Back gr ou n dColor
Defaul t
Access
Color
Dyn am ic
CS
m en u Tit leSt r in g
st ri ng
"New"
CS
m en u Fon t Li st
Fon t
"fi xed"
CS
or ien t at ion
u nsign ed ch ar
VERTICAL
CS
gr id
Boolean
Tr u e
CS
gr idType
u nsign ed ch ar
SHADOW_ETCHED_IN
CS
cell MaxHeight
shor t
1000
CS
cell MaxWidt h
shor t
1000
CS
cell Min Hei gh t
shor t
10
CS
cell Min Widt h
shor t
10
CS
shor t
10
CS
shor t
20
C
i nt
2
C
shor t
20
C
spacin g
visi bleRowCou nt
in it NbColu m n s
visi bleColu m n Cou n t
Th e gr aph ic r esou r ces of t h e m ask for set s ar e as follows:
• foregroundColor
For egr ou n d color for t h e set .
• backgroundColor
Back gr ou n d color for t h e set .
• editable
Can t h e set valu e be edited. If False, th e elem en t s can n ot be added t o or
r em oved fr om t h e set; t h e set can ot be delet ed or r eplaced in it s en tir et y.
• replaceProcess
Can you r eplace set con t en t s u sin g past e. For a set of object s, r eplacin g
an object im plies u pdat in g it s en capsu lat ed valu e an d r eplacin g it s
iden t ity wit h t h at of t h e past ed object .
• shareProcess
Can m ask con t en t s be sh ar ed; for set valu es, t h is is t h e sam e as
copyin g.
• cutProcess
Can a cu t oper at ion be per for m ed on elem en ts of t h e set .
• insertProcess
Can you in ser t an elem en t in t o t h e set wit h a past e oper at ion .
• newProcess
Can you in ser t a n ew em pty elem en t in t o t h e set wit h n ew pr ocess. (For
an object set t h is gen er at es a n ew n il object an d in vok es t h e n ew
pr ocess on it .)
• menuForegroundColor In ser t pop-u p m en u for egr ou n d color .
126
O2 Look User Man u al
Graphic Resources for sets
• menuBackgroundColor In ser t pop-u p m en u back gr ou n d color .
• menuTitleString
St r in g displayed in t h e in ser t pop-u p m en u .
• menuFontList
Fon t u sed in th e in ser t pop-u p m en u .
• orientation
Set or ien t at ion . If VERTICAL, each set colu m n is displayed ver t ically, if
HORIZONTAL, h or izon t ally.
• grid
Is gr id visible (gr id lin es separ at e set elem en t s).
• gridType
St yle of t h e lin es for m in g t h e gr id. Possible valu es ar e:
-
SINGLE_LINE, DOUBLE_LINE, or NO_LINE
SINGLE_DASHED_LINE,or DOUBLE_DASHED_LINE
SHADOW_ETCHED_IN (dou ble lin e et ch ed in t o t h e win dow) or
SHADOW_ETCHED_OUT (dou ble lin e et ch ed com in g ou t fr om t h e
win dow)
• cellMaxHeight
Maxim u m h eigh t of a sin gle elem en t cell.
• cellMaxWidth
Maxim u m widt h of a sin gle elem en t cell.
• cellMinHeight
Min im u m h eigh t of a cell. Less t h an or equ al t o t h e m axim u m h eigh t .
• cellMinWidth
Min im u m widt h of a cell. Less t h an or equ al t o t h e m axim u m widt h .
• spacing
Pixel space bet ween t wo elem en t s placed in t wo adjacen ts cells. Th e
blan k fr am e ar ou n d t h e elem en t s is h alf t h is n u m ber of pixels t h ick .
• visibleRowCount
Nu m ber of visible r ows at cr eat ion . If th is n u m ber is gr eater t h an or
equ al t o th e n u m ber of elem en t s in t h e set divided by th e n u m ber of
visible colu m n s
• initNbColumns
Tot al n u m ber of colu m n s in th e set m ask at cr eation t im e.
• visibleColumnCount
Nu m ber of visible colu m n s at cr eat ion t im e. If t h is n u m ber is gr eat er
t h an or equ al t o t h e act u al n u m ber of colu m n s (initNbColumns, all
colu m n s ar e visible; ot h er wise, a scr oll bar appear s.)
If t h e elem en ts of a set exceed t h e lim it specified in th e global r esou r ce
largeLowerBound), you r set is a l ar ge set . :
Table 4.11
Special resources for large sets
Access
Nam e
Type
Defaul t
bu t t on BarForegr ou n dColor
Color
Dyn am ic
CS
bu t t on BarBack gr ou n dColor
Color
Dyn am ic
CS
bu t t on For egr ou n dColor
Color
Dyn am ic
CS
bu t t on Back gr ou n dColor
Color
Dyn am ic
CS
n ext Type
u nsign ed ch ar
STRING
CS
O2 Look User Man u al
127
4
Graphic Resources
Table 4.11
Special resources for large sets
Access
Nam e
Type
Defaul t
n ext St r in g
st ri ng
"Next "
CS
n ext Pixm ap
Pi xm ap
UNSPECIFIED_PIXM AP
CS
in sen sit iveNextPi xm ap
Pi xm ap
UNSPECIFIED_PIXM AP
CS
pr eviou sType
u nsign ed ch ar
STRING
CS
pr eviou sSt ri ng
st ri ng
"Pr eviou s"
CS
pr eviou sPixm ap
Pi xm ap
UNSPECIFIED_PIXM AP
CS
in sen sit ivePr eviou sPixm ap
Pi xm ap
UNSPECIFIED_PIXM AP
CS
fon t List
Fon t
"fixed"
CS
Th e gr aph ic r esou r ces of t h e m ask for lar ge sets ar e as follows:
• buttonBarForegroundColor
For egr ou n d color of t h e bu t ton bar .
• buttonBarBackgroundColor
Back gr ou n d color of t h e bu t t on bar .
• buttonForegroundColor
For egr ou n d color of t h e bu t ton s in th e bu t t on bar .
• buttonBackgroundColor
Back gr ou n d color of t h e bu t t on s in t h e bu t t on bar .
• nextType
Is bu t t on for n ext page display iden t ified by STRING or PIXMAP.
• nextString
Bu t t on label for n ext page display, wh en n ext Type is STRING.
• nextPixmap
Bu t t on bit m ap for n ext page display wh en bu tt on is active an d
nextType is PIXMAP.
• insensitiveNextPixmap
Bu t t on bit m ap for n ext page display wh en bu tt on is in active an d
nextType is PIXMAP.
• previousType
Is bu t t on u sed for pr eviou s page display iden t ified by STRING or
PIXMAP.
• previousString
Bu t t on label for pr eviou s page display wh en previousType is
STRING.
• previousPixmap
Bu t t on bit m ap for pr eviou s page display wh en bu tt on is active an d
previousType is PIXMAP.
• insensitivePreviousPixmap
Bu t t on bit m ap for pr eviou s page display wh en bu tt on is in act ive an d
previousType is PIXMAP.
• fontList
Fon t u sed for th e bu t t on labels.
128
O2 Look User Man u al
Graphic resources for tuples
4.14 Graphic resources for tuples
Th e followin g win dow gives an exam ple of th e t u ple m ask :
Table 4.12 list s t h e gr aph ic r esou r ces wh ich m ay be cu st om ized for a
t u ple m ask , eit h er in a r esou r ce file in associat ion with t h e ed_name
ar gu m en t , or dir ect ly in t h e resources ar gu m en t of th e fu n ction .
Table 4.12
Graphic resources for tuples
Access
Nam e
Type
Default
foregr ou n dColor
Color
Dyn am ic
CS
back grou ndCol or
Color
Dyn am ic
CS
edit able
Boolean
Tr u e
CS
replacePr ocess
Boolean
Tr u e
CS
sh arePr ocess
Boolean
Tr u e
CS
fon t Li st
Fon t
Dyn am ic
CS
ori en t at ion
u n signed ch ar
VERTICAL
CS
labelLi st
ch ar *
NULL
CS
labelAl ign m en t
u n signed ch ar
ALIGNM ENT_BEGINNING
CS
labelVert icalPosition
u n signed ch ar
CENTER
CS
labelBoxWi dt h
sh ort
0
CS
labelBoxHeigh t
sh ort
0
CS
at t r ibu t eM axWi dth
sh ort
1000
CS
at t r ibu t eM axHeigh t
sh ort
1000
CS
vi sibleRowCou nt
sh ort
10
C
gr id
Boolean
Tr u e
CS
ch ar *
NULL
CS
n ot Edit abl eAt t r ibu t eList
O2 Look User Man u al
129
4
Graphic Resources
• foregroundColor
Tu ple for egr ou n d color .
• backgroundColor
Tu ple back gr ou n d color .
• editable
Can t h e tu ple valu e be ch an ged? If False, you can n ot delet e t h e t u ple or
r eplace it in its en t ir et y, an d you can n ot ch an ge an y of it s at t r ibu t es.
• replaceProcess
Can t h e con t en t s of an y of t h e tu ple at t r ibu t es be r eplaced u sin g past e.
For an object at tr ibu t e, r eplacin g an object im plies u pdat in g it s
en capsu lat ed valu e an d r eplacin g it s object iden t it y wit h t h at of t h e
pasted object .
• shareProcess
Can m ask con t en t s be sh ar ed; th is is t h e sam e as copyin g.
• fontList
Fon t for t h e t u ple labels.
• orientation
Or ien t at ion of th e t u ple at t r ibu t e display (VERTICAL or HORIZONTAL).
• labelList
Text of t h e at t r ibu t e labels. Th is is a n ewlin e-separ ated list :
label1\nlabel2\n...labelN
Th e labels u sed, by defau lt , ar e t h e sch em a at t r ibu t e n am es.
• labelAlignment
Label align m en t t ype. Th e followin g ar e t h e possible align m en t t ypes:
- ALIGNMENT_BEGINNING: left-ju stified labels (th e defau lt)
- ALIGNMENT_CENTER: cen t er ed labels
- ALIGNMENT_END: r igh t -ju st ified labels
• labelVerticalPosition
Specifies t h e ver t ical position of t h e labels in t h e label boxes. Th e
followin g ar e ver t ical position t ypes:
- TOP: labels at t h e t op of t h e box
- CENTER: labels cen ter ed in th e box (defau lt )
- BOTTOM: labels on t h e bot t om lin e of t h e box
• labelBoxWidth
Label box widt h (in pixels) wh en or ien t at ion is VERTICAL. If zer o, th e size
of t h e t u ple’s widest box is u sed for all of th e at t r ibu tes.
• labelBoxHeight
Label box h eigh t (in pixels) wh en or ien tation is HORIZONTAL. If zer o, t h e
size of t h e t u ple’s tallest box is u sed for all of t h e at t r ibu t es.
• attributeMaxWidth
Maxim u m widt h of tu ple at t r ibu t es.
• attributeMaxHeight
Maxim u m h eigh t of t u ple at t r ibu t es.
• visibleRowCount
Specifies t h e n u m ber of visible att r ibu t es at cr eat ion t im e. If t h is
n u m ber is gr eat er t h an or equ al t o t h e n u m ber of displayable at tr ibu t es,
all att r ibu t es will be visible; ot h er wise, scr oll bar s will appear .
• grid
Ar e th e lin es t h at separ at e at t r ibu t es (gr id) displayed.
• notEditableAttributeList Wh ich t u ple at tr ibu t es h ave r ead-on ly valu es. Th e is a n ewlin esepar at ed list :
attribute1\nattribute2\nattributeN
Each att r ibu t e n am ed is pr otect ed again st an y u ser ch an ges. Not e t h at
t h e att r ibu t e n am es u sed ar e defin ed in dat abase sch em a for t h e t u ple,
an d n ot n ecessar ily t h e at t r ibu t e labels t h at appear on t h e scr een . Th e
scr een labels can be ch an ged u sin g t h e labelList r esou r ce (above).
130
O2 Look User Man u al
Graphic Resources for Objects
4.15 Graphic Resources for Objects
Th e list of gr aph ic r esou r ces wh ich m ay be cu stom ized for an object ,
eit h er in a r esou r ce file in associat ion wit h t h e ed_name ar gu m en t, or
dir ect ly in t h e resources ar gu m en t of t h e fu n ct ion , is t h e sam e as t h at
available wit h t h e lk_object m ask .
You can r epr esen t an object in fou r differ en t ways:
• expanded
A fu lly-expan ded pr esen tation sh ows t h e fu ll or par t of th e object valu e.
• iconic
An icon ic pr esen t at ion of an object is a box wit h t h e object class n am e
cen t er ed in th e box. You can add a bit m ap t o t h e icon eit h er by
r edefin in g th e bit m ap m et h od for t h e class con cer n ed or by specifyin g
t h e bitm ap r esou r ce for t h e object m ask .
• nil object
If th er e is n o object to be displayed as yet , a n il object pr esen t at ion is
u sed. A n il object is a n on exist en t object — i.e., on e wit h ou t an object
iden t it y. Th e class of a n il object is k n own , bu t t h e object h as n ot yet
been cr eat ed (in O2 C, with a n ew in st r u ct ion or by an assign m en t; or
u n der O2 Look , wit h th e n ew pr ocess). For exam ple, wh en you cr eat e a
n ew t u ple valu e, on e of wh ose at t r ibu t es is an object. Th e defau lt
r epr esen tation of a n il object is a black box.
• undefined object
An u n defin ed object is a n on exist en t object of an u n specified or
in com plet ely-specified class. An u n defin ed object differ s fr om a n il
object in t h at it can n ot be cr eat ed, or u n til it s class is pr oper ly defin ed.
Th e defau lt r epr esen t at ion is a qu est ion m ar k in side a box.
Th e followin g t able list s t h e gr aph ic r esou r ces you u se t o cu stom ize an
object m ask .
You specify t h ese r esou r ces u sin g eit h er t h e lk_object or
lk_protected fu n ct ion , an d give t h em eit h er in a r esou r ce file u sin g
t h e ed_name ar gu m en t , or dir ect ly in t h e resources ar gu m en t of t h e
fu n ct ion .
Table 4.13
Graphic resources for objects
Nam e
Ty pe
Default
Access
for egr ou n dColor
Col or
Dyn am ic
CS
back gr ou n dColor
Col or
Dyn am ic
CS
edit abl e
Bool ean
Tr u e
CS
r epl aceProcess
Bool ean
Tr u e
CS
shar ePr ocess
Bool ean
Tr u e
CS
t it leFont List
Font
"Fi xed"
CS
O2 Look User Man u al
131
4
Table 4.13
Graphic Resources
Graphic resources for objects
Nam e
Type
Default
Access
t i t leSt rin g
st r in g
NULL
CS
m en u Back gr ou n dColor
Col or
Dyn am ic
CS
m en u Foregr ou n dColor
Col or
Dyn am ic
CS
m en u Fon t Li st
Font
Dyn am ic
CS
m en u Tit leSt r in g
st r in g
"m et h ods"
CS
m en u
ch ar *
NULL
C
m et h odResu l t
Boolean
False
CS
bi t m ap
Pixm ap
UNSPECIFIED_PIXMAP
CS
st r in g
"n ew"
CS
Boolean
Tr u e
CS
n ewSt r in g
n ewProcess
• foregroundColor
Object m ask for egr ou n d color .
• backgroundColor
Object m ask back gr ou n d color .
• editable
Can u ser ch an ge t h e object r epr esen t at ion or it s en capsu lat ed valu e.
• replaceProcess
Can you r eplace object m ask con t en ts u sin g past e. Th is r efer s t o th e
en capsu lat ed valu e of t h e object, n ot t o th e object it self. Th is r esou r ce
t h er efor e on ly applies t o expan ded object r epr esen t at ion s.
However , t h e replaceProcess r esou r ce of a pr esen t at ion or m ask t h at
con t ai n s t h e object (e.g. a set of object s) det er m in es wh et h er t h e object
can be r eplaced u sin g past e. Replacin g an object m ean s u pdat in g it s
en capsu lat ed valu e an d r eplacin g it s object iden t ity.
• shareProcess
Can th e object be sh ar ed?
• titleFontList
Object m ask t it le fon t for icon ic an d expan ded r epr esen t at ion s of a r eal
object , bu t n ot r epr esen t at ion s of n il or u n defin ed object s.
• titleString
Object m ask t it le st r in g. Th e defau lt is t h e st r in g r et u r n ed by t h e
O2 Look m et h od t it le, wh ich u n less r edefin ed, is t h e object class n am e.
Th is r esou r ce applies t o icon ic or expan ded r eal object r epr esen t at ion s
bu t n ot t o n il or u n defin ed object r epr esen t ation s.
• menuBackgroundColor Met h ods m en u back gr ou n d color for icon ic or expan ded r eal object
r epr esen t at ion s, or t h e n ew pop-u p m en u for a n il object. It h as n o
effect on r epr esen t at ion s of u n defin ed object s.
• menuForegroundColor Met h ods m en u for egr ou n d color for icon ic or expan ded r epr esen tation s
of a r eal object , or th e n ew pop-u p m en u for a n il object. It h as n o effect
on r epr esen tat ion s of u n defin ed object s.
• menuFontList
132
Met h ods m en u fon t for icon ic or expan ded r epr esen t ation s of a r eal
object , or t h e n ew pr ocess m en u for a n il object . It h as n o effect for
r epr esen t at ion s on u n defin ed object s.
O2 Look User Man u al
Graphic Resources for Objects
• menuTitleString
Pu ll-down m en u t it le wh en t h e defau lt m en u is u sed (ie. m en u r esou r ce
is NULL).
• menu
Con t en t s of t h e pu blic m et h ods m en u fo icon ic or expan ded
r epr esen tation s of a r eal object , bu t n ot r epr esen t at ion s of n il or
u n defin ed object s. Th e m en u specification is h ier ar ch ical an d h as th e
syn tax:
{ {"entry1" "item1" method_name1 ... "itemN" method_nameN}
{"entry2" "item1" method_name1 ... "itemP" method_nameP}
...
{"entryM"
... }
}
Important
Th e m en u r esou r ce can on ly be set wh en you cr eat e t h e pr esen tation .
You can n ot ch an ge it aft er war ds.
If you u se t h e wor d separator befor e an y it em specificat ion , you
gen er at e a h or izon t al separ at or lin e in t h e displayed m en u .
In an expan ded object m ask , t h e m en u h ier ar ch y is a m en u bar wit h
each en tr y n am e sh own in t h e bar . You t h en select an en t r y u sin g t h e
left m ou se bu t t on wh ich t h en pu lls down a m en u displayin g th e m en u
it em s. In an icon object m ask , t h er e is on ly on e pu ll-down m en u wh ich ,
if it h as on ly on e en t r y, sh ows t h e var iou s it em n am es of t h at en t r y. If
t h e m en u h as sever al en t r es, it sh ows t h e var iou s en tr y n am es, each
followed by an ar r ow. If select an en tr y displays a su b-m en u of en t r y
it em s.
If th e menu r esou r ce specifies an er r on eou s m en u an d at r u n -t im e t h e
u ser tr ies t o select a n on -exist en t m et h od, O2 Look gives a war n in g.
Th is r esou r ce does n ot effect n il or u n defin ed object sr epr esen tation s. If
specified, t h is r esou r ce over r ides t h e fu n ct ion of t h e O2 Look m et h od
menu. If n ot specified, a sin gle-en t r y m en u is pr ovided by th e menu
m et h od wh ich , by defau lt , lists t h e pu blic m et h ods of t h e object class.
If you u se m n em on ics, t h e m en u specificat ion is h ier ar ch ical with t h e
syn t ax:
O2 Look User Man u al
133
4
Graphic Resources
{
{"entry1" [mnemonic-name]
"item1" [item1-mnemonic] [item1-accelerator] methodname1
"item2" [item2-mnemonic] [item2-accelerator] methodname2
...
}
{"entry2" [mnemonic-name]
...
}
} For example:
{
{ "Compile"
_C
"foo"
_f Alt<key>F8 Foo
"bar"
_b
"new ..."
Bar
New
}
{ "Display"
"display"
_d
Display
}
}
A m n em on ic is on ly on e lett er pr eceded by a u n der scor e. It gives you an
alt er n at e m ean s of act ivat in g a bu tt on wh en it is visible. Wh en a
m n em on ic is specified, you m u st u se t h e Alt k ey wh ile pr essin g th e
m n em on ic. You can act ivat e th e bu t t on by pr essin g eit h er t h e sh ifted or
t h e u n sh ift ed m n em on ic k ey. An acceler at or can act ivat e a visible or
in visible bu t ton . It is a st r in g t h at descr ibes a set of m odifier (Alt, Ct r l)
an d t h e k ey t h at m ay be u sed to select t h e bu t ton . Th e k ey is in t r odu ced
by t h e k eywor d key.
• methodResult
Is t h e r et u r n ed valu e of each m et h od in vok ed in t er act ively on t h is object
sh ou ld displayed on t h e scr een in an O 2 Look pr esen t at ion . Th is can be
u sefu l for debu ggin g.
• bitmap
Object m ask bit m ap. Th is r esou r ce does n ot apply t o expan ded object s.
Th e defau lt , if t h is r esou r ce is n ot specified, is a black box for n il
object s; a qu est ion m ar k in side a box for u n defin ed object s; an d for
icon ic r epr esen t at ion s of object s, t h e bitm ap valu e r et u r n ed by t h e
O2 Look m et h od bit m ap.
134
O2 Look User Man u al
Graphic Resources for Objects
• newString
St r in g of t h e pop-u p m en u u sed t o in vok e th e new pr ocess on a n il
object . Th is r esou r ce applies on ly t o n il object r epr esen t at ion s.
• newProcess
Is t h e new pr ocess, wh ich in vok es a con st r u ct or on t h e n il object ,
allowed. If t r u e, a pop-u p m en u appear s wh en t h e u ser click s t h e r igh t
m ou se bu t t on on t h e n il object m ask . If th e u ser th en select s th e sin gle
en t r y on t h is m en u (wh ose text is defin ed with newString above), t h en
t h e O2 con st r u ct or for t h e class of t h e n il object is in vok ed to cr eat e a
n ew object , an d a pr esen t at ion appear s in wh ich t h e u ser is in vit ed t o
defin e t h e n ew object ’s dat a con t en t . Th is r esou r ce applies on ly t o n il
object r epr esen t at ion s.
O2 Look User Man u al
135
4
136
Graphic Resources
O2 Look User Man u al
5
Widge t L ook
5
Th is ch apt er descr ibes t h e O2 Widget Look .
Th is is an X Toolk it com pat ible u ser -in t er face com pon en t . It con t ain s all
t h e power of O2 Look in a sim ple widget.
It h as t h e followin g sect ion s:
• In t r odu ction
• Tools
O2 Look User Man u al
137
5
Widget Look
5.1 Introduction
To face t h e t ech n ical ch allen ge of design in g an d im plem en t in g a gr aph ical u ser in t er face, O 2 h as t h r ee t ools,
• O2 Look , an in tegr at ed power fu l t ool en ablin g t h e gr aph ical display
an d m an ipu lat ion of an y object in th e O2 dat abase.
• Th e O2 - Xt , specifically design ed for u ser in t er faces developed wit h
an X Toolk it . It is a pr ogr am m in g libr ar y t ailor ed t o th e special
r equ ir em en t s of u ser in t er face con st r u ct ion wit h in an O2 dat abase
applicat ion . For det ails r efer to t h e docu m en t at ion "Usin g X t oolk it
wit h O2 ".
• O2 Look widget , u sed in con ju n ction wit h O2 Look or t h e O2 - Xt
libr ar y. Th is is an X Toolk it com pat ible u ser in t er face com pon en t. Th e
O 2 Look widget con t ain s all t h e power of O 2 Look in a sim ple widget .
Th e r est of t h is ch apt er n ow descr ibes t h e O 2 Look widget classes.
5.2 Tools
Th is sect ion descr ibes t h e followin g classes
• Xo2Look
• Xo2CreateLook
• Xo2SetO2Value
• Xo2ConsultO2Value
138
O2 Look User Man u al
Tools
Xo2Look
Summary
Th e Look widget class
Syntax
#include "Look.h"
Arguments
Non e
Description
Look is a m an ager you u se t o en capsu lat e an O 2 Look pr esen t at ion
in side a widget in or der t o in t egr at e an O 2 Look pr esen t at ion in a widget
h ier ar ch y.
It u ses geom et r y m an agem en t so t h at t h e widget size m at ch es t h e
O2 Look pr esen t at ion size wh en it is displayed dir ect ly by O2 Look .
Not ice t h at after bein g in it ialized, t h e size of t h e Look widget can n ot be
ch an ged by a r equ est fr om it s ch ild. It s fat h er is t h e on ly on e th at can
r esize it .
Classes
Look in h er it s beh avior an d r esou r ces fr om t h e Core, Composite,
Constraint an d XmManager classes.
Th e class poin t er is xo2LookWidgetClass.
Th e class n am e is Xo2Look.
Translations
Xo2Look in h er it s t r an slat ion s fr om Xm Man ager .
New resources Table 5.1 defin es t h e set of widget r esou r ces you u se t o specify dat a.
You can also set th e r esou r ce valu es for th e in h er it ed classes t o set t h e
at t r ibu t es for t h is widget .
Th e access colu m n codes in t h e followin g t ables in dicat e wh et h er
r esou r ce can be set at cr eation t im e (C) or u sin g XtSetValues(S),
wh et h er it s can be r et r ieved u sin g XtGetValues (G), or is applicable or
n ot (N/ A).
Table 5.1
Xo2Look resource set
Nam e
Ty pe
Default
Access
Xo2Nvalu e
void *
dyn am ic
CS
Xo2Nk in d
Xo2Valu eKin d
dyn am ic
CS
Xo2Nm ask
in t
dyn am ic
CS
Xo2Nedit orNam e
St r in g
dyn am ic
CS
Xo2Npr esResou r cesCou n t
in t
0
CS
Xo2Npr esResou r ces
void *
NULL
CS
O2 Look User Man u al
139
5
Widget Look
Th ese r esou r ces ar e specified below.
• Xo2Nvalue
Specifies t h e O2 valu e or object t o be displayed in side t h e Look Widget . Th e valu e
given in th is r esou r ce m u st be fir st cast t o
(o2 void).
Note
Wh en u sin g t h e Look widget in O2 C, t h e O2 valu e given to XtSetArg
can n ot be an expr ession ; it m u st be an O2 C var iable.
Th e followin g expr ession is in cor r ect :
XtSetArg(mt_args[mt_n_args], Xo2Nvalue,\
(o2 void)(*MyList)[0]);
Th e cor r ect expr ession is:
i = (*MyList)[0];
XtSetArg(mt_args[mt_n_args], Xo2Nvalue, (o2 void)i);
Important
On ly O2 valu es or object s ar e allowed as o2 valu es. Con stan t st r in gs or
(char*) var iables ar e for bidden .
• Xo2Nkind
Th is is t h e k in d of valu e is specified in th e
Xo2Nvalue r esou r ce. Xo2Nvalue can h ave
t h e followin g valu es:
140
O2 Look User Man u al
XO2_INTEGER - an in t eger valu e.
XO2_CHAR - a ch ar valu e.
XO2_REAL - a r eal valu e.
XO2_STRING - a str in g valu e.
XO2_BYTES - a byt es valu e.
XO2_BOOLEAN - a boolean valu e.
XO2_VALUE - a com plex O2 valu e.
XO2_OBJECT - an O 2 object.
Tools : Xo2Look
• Xo2Nmask
Specifies th e O2 Look m ask u sed to display
t h e O2 valu e given in Xo2Nvalue.
• Xo2NeditorName
A st r in g r epr esen t in g t h e O2 Look pr esen t at ion t h at cor r espon ds t o t h e O 2 valu e given
in Xo2Nvalue an d can be u sed in a r esou r ce
filet ospecifygr aph icalr esou r cesfort h ispr esen t at ion .
• Xo2NpresResourcesCount An in t eger cou n t of th e n u m ber of O2 Look
r esou r ces given in Xo2NpresResources.
• Xo2NpresResources
Inherited resources
A poin t er t o an ar r ay of gr aph ic r esou r ces t o
be cu st om ized in th e m ask given in
Xo2Nmask (u n less
Xo2NpresResourcesCount is zer o).
Look in h er it s beh avior an d r esou r ces fr om t h e followin g su per classes.
For a com plet e descr ipt ion of each r esou r ce, r efer t o th e OSF/ M ot if
pr ogr am m er ’s r efer en ce m an u al.
Th e in h er it ed r esou r ces in clu de t h r ee r esou r ce set s: XmManager,
Composite an d Core.
Table 5.2 gives t h e r esou r ce set for XmManager.
Table 5.2
XmManager resource set
Name
Type
Default
Access
Xm Nbott om Sh adowColor
Pixel
dyn am ic
CSG
Xm Nbott om Sh adowPixm ap
Pixm ap
Xm UNSPECIFIED_PIXM AP
CSG
Xm NFor egr ou n d
Pixel
dyn am ic
CSG
Xm Nh elpCallback
XtCallback List
NULL
C
Xm Nh igh ligh t Color
Pixel
dyn am ic
CSG
Xm Nh igh ligh t Pixm ap
Pixm ap
dyn am ic
CSG
Xm Nn avigat ion Type
Xm Navigation Type
Xm TAB_GROUP
CSG
Xm Nsh adowTh ick n ess
Dim en sion
dyn am ic
CSG
Xm Nstr in gDirection
Xm St rin gDir ect ion
dyn am ic
CG
Xm Nt opSh adowColor
Pixel
dyn am ic
CSG
Xm Nt opSh adowPixm ap
Pixm ap
dyn am ic
CSG
Xm Nt r aversalOn
Boolean
Tr u e
CSG
Xm Nu n it Type
u n sign ed ch ar
dyn am ic
CSG
Xm Nu serDat a
Poin t er
NULL
CSG
Table 5.3 gives t h e Composite r esou r ce set .
O2 Look User Man u al
141
5
Table 5.3
Widget Look
Composite resource set
Name
Type
Default
Access
Xm Nch ildr en
Widget List
NULL
G
Xm Nin sert Position
(*)()
NULL
CSG
Xm Nn u m Ch ildr en
Car din al
0
G
Table 5.4 gives th e Core r esou r ce set.
Table 5.4
142
Core resource set
Nam e
Type
Defaul t
Access
Xm Naccelerator s
XtAcceler at ors
NULL
CSG
Xm Nan cest orSen sit ive
Boolean
dyn am ic
G
Xm Nback gr ou n d
Pixel
dyn am ic
CSG
Xm Nback gr ou n dPixm ap
Pixm ap
Xm UNSPECIFIED_PIXMAP
CSG
Xm Nbor der Color
Pixel
Xt Defau lt For egr ou d
CSG
Xm Nbor der Pixm ap
Pixm ap
Xm UNSPECIFIED_PIXMAP
CSG
Xm Nbor der Widt h
Dim en sion
0
CSG
Xm Ncolorm ap
Colorm ap
dyn am ic
CG
Xm Ndepth
in t
dyn am ic
CG
Xm Ndest r oyCallback
XtCallback List
NULL
C
Xm Nh eigh t
Dim en sion
dyn am ic
CSG
Xm Nin it ialResou r cesPersist en t
Boolean
Tru e
C
Xm Nm appedWh en M an aged
Boolean
Tru e
CSG
Xm Nscreen
Scr een *
Dyn am ic
CG
Xm Nsen sit ive
Boolean
Tru e
CSG
Xm Nt ran slat ion s
XtTr an slation s
NULL
CSG
Xm Nwidth
Dim en sion
dyn am ic
CSG
Xm Nx
Posit ion
0
CSG
Xm Ny
Posit ion
0
CSG
O2 Look User Man u al
Tools : Xo2CreateLook
Xo2CreateLook
Summary
Cr eat es t h e Look widget .
Syntax
#include "Look.h"
Widget Xo2CreateLook (parent, name, arglist, argcount)
Widget parent;
String name;
ArgList arglist;
Cardinal argcount;
Arguments
Description
parent
Specifies t h e par en t widget ID
name
Specifies t h e n am e of t h e cr eat ed widget
arglist
Specifies t h e ar gu m en t list
argcount
Specifies t h e n u m ber of at t r ibu t e/ valu e pair in th e
ar gu m en t list
Xo2CreateLook cr eat es an in st an ce of a Look widget an d r et u r n s t h e
associat ed widget ID.
Befor e a widget Look is cr eat ed, t h e O 2 Look lk_proglogue fu n ct ion
m u st be called.
Example
method body create_look_widget(father_i: integer):integer
{
Widget lw, father;
Arg
mt_args[20];
int
mt_n_args = 0;
father = (Widget) father_i;
lw = Xo2CreateLook(father, "_look", mt_args,
mt_n_args);
return((o2 integer) lw);
}
O2 Look User Man u al
143
5
Widget Look
Xo2SetO2Value
Summary
Assign s a O 2 Look valu e to a Look widget .
Syntax
#include "Look.h"
void Xo2SetO2Value (lw, kind, o2value, mask, ed_name,
rcount, resources)
Xo2LookWidget lw;
Xo2ValueKind kind;
void *o2value;
int mask;
char *ed_name;
int rcount;
Lk_resource *resources;
Arguments
Description
lw
An O2 Look widget
kind
Specifies th e t ype of O2 valu e
o2value
Specifies th e O2 valu e.
mask
Th e m ask iden t ifier .
ed_name
St r in g r epr esen t in g m ask n am e.
rcount
In teger cou n t of t h e n u m ber of special r esou r ces given in th e
resources ar gu m en t .
resources
A poin ter t o an ar r ay of gr aph ic r esou r ces t o cbe cu st om ized in t h e
m ask .
Th is fu n ct ion cr eates a pr esen t at ion of th e O2 valu e o2value u sin g t h e
mask, ed_name, rcount an d resources ar gu m en t s.
It in ser ts t h e t op widget of t h is pr esen tat ion as t h e ch ild of th e O2 Look
widget lw.
Th e o2value m u st be cast in (o2 void).
Important
On ly O2 valu es or object s ar e allowed as o2 valu es. Con stan t st r in gs or
(char*) var iables ar e for bidden .
144
O2 Look User Man u al
Tools : Xo2SetO2Value
Example
An exam ple is given below.
method body text_to_widget(father_i:integer,
text:Text):integer
{
Widget lw, father;
Arg
mt_args[20];
int
mt_n_args = 0;
father = (Widget) father_i;
lw = Xo2CreateLook(father, "_look", mt_args,
mt_n_args);
Xo2SetO2Value(lw, XO2_OBJECT, (o2 void) text,
lk_object("otext", 0, 0
lk_specific("text",
0,0,"text",0,0)),
"text_test", 0, NULL);
XtManageChild(lw);
return(lw);
}
O2 Look User Man u al
145
5
Widget Look
Xo2ConsultO2Value
Summary
Updat es a dat abase object accor din g t o a Look widget con ten t.
Syntax
#include "Look.h"
void Xo2ConsultO2Value (lw, kind, address)
Xo2LookWidget lw;
Xo2ValueKind kind;
void *address;
Arguments
Description
lw
An O2 Look widget
kind
Specifies th e t ype of O2 valu e
address
Addr ess O2 C var iable.
Th e fir st ar gu m en t of t h e fu n ct ion is t h e O2 Look widget you wan t to
con su lt , t h e secon d ar gu m en t is th e k in d of t h e O2 valu e cu r r en t ly
con t ain ed in t h e widget an d t h e t h ir d ar gu m en t is t h e addr ess of an O2 C
var iable cast in (o2 void) wh en u sin g t h e fu n ct ion in O2 C an d is t h e
addr ess of a Handle wh en u sin g t h is fu n ct ion elsewh er e.
Example
method body consult_text_widget(lwi:integer): Text
{
o2 Text t = new Text;
Widget lw = (Widget) lwi;
Xo2ConsultO2Value(lw, XO2_OBJECT, &(o2 void) t);
return(t);
}
method body consult_int_widget(lwi:integer): integer
{
o2 integer i;
Widget lw = (Widget) lwi;
Xo2ConsultO2Value(lw, XO2_integer, &i);
return(i);
}
146
O2 Look User Man u al
IN DEX
O2 Look User Man u al
147
INDEX
A
D
all_presentations 27
alph a
command 67
Data
Types 74
B
bitmap 41
Boolean gr aph ic r esou r ces 119
E
edit 33
enable_method 35
En vir on m en t var iable
DISPLAY 66
HOME 67
O2RESOURCE 67
C
C 13
C t ypes 24
C++
In t er face 13
erase 43
erase_all 36
Callback m et h ods 40, 48
Ch ar act er gr aph ic r esou r ces 117
Composite 139
Constraint 139
consult 28
Copyin g elem en ts 18
Core 139
148
disable_method 29
display method 31
Display m et h ods 25–??
display option 66
Dr ag an d dr op 18
O2 Look User Man u al
INDEX
F
H
Fu n ct ion s
In t r odu ct ion 20
Libr ar y 49–72
lk_all_mapped_presentations 50
lk_all_presentations 51
lk_consult 52
lk_current_presentation 54
lk_delete_all 56
lk_delete_presentation 57
lk_epilogue 58
lk_free 59
lk_grab 60
lk_map 61
lk_present 64
lk_prologue 66
lk_refresh_presentation 68
lk_unmap 70
lk_wait 71
Mask s 79–99
HOME 67
G
GenPresentation 64
Global r esou r ces 111–112
Gr aph ic r esou r ces 102–135
Boolean valu es 119
Ch ar acter s 117
Lar ge lists 123
Lar ge set s 127
List s 121–124
Object s 131–135
Real n u m ber s 116
Set s 125–128
Str in gs 118
Tu ples 129–130
O2 Look User Man u al
J
J ava 13
L
Libr ar y fu n ct ion s 49–72
List
Lar ge list 123
List gr aph ic r esou r ces 121
lk_all_mapped_presentations 50
lk_all_presentations 51
lk_atom 80
Lk_attribute_mask 24
lk_consult 52
LK_CONTENT option 62
LK_COORDINATE option 61
lk_current_presentation 54
lk_delete_all 56
lk_delete_presentation 57
lk_epilogue 58
LK_ERASE
lk _fr ee 59
lk _gr ab 60
lk _wait 71
LK_FAILED
lk _gr ab 60
lk _wait 71
149
INDEX
lk_free 59
LK_FREE option 62
lk_generic 83
LK_GEOMETRIC option 62
lk_grab 60
lk_list 85
LK_MANUAL option 61
lk_map 61
Lk_mask 24
lk_method 87
LK_MOUSE option 61
lk_object 89
lk_present 64
Lk_presentation 24
lk_prologue 66
lk_protected 91, 92
lk_refresh_presentation 68
Lk_resource 24
LK_RIGHT option 61
LK_SAVE
lk _fr ee 59
lk _gr ab 60
lk _wait 71
LK_SCREEN argument 62
lk_set 94
LK_SLAVE option 62
lk_specific 96
LK_STACK option 61
lk_tuple 97
lk_unmap 70
lk_wait 71
LKdefaults 67
M
Mask
Fu n ct ion s 79–99
In t r odu ct ion 20
lk_atom 80
lk_destroy_mask 82
lk_generic 83
lk_list 85
lk_method 87
lk_object 89
lk_protected 92
lk_set 94
lk_specific 96
lk_tuple 98
menu 44
Met h ods
all_presentations 27
bitmap 41
Callback 40, 48
disable_method 29
Display 25–??
display 31
edit 33
enable_method 35
erase 43
erase_all 36
In t r odu ct ion 19
menu 44
present 37
refresh_all 38
rubout 39
save 46
title 47
Movin g elem en t s 18
150
O2 Look User Man u al
INDEX
N
P
n olook
Option 25
present 37
Pr esen t at ion
Defin it ion 17
Resou r ces 113–114
Pr ogr am m in g 19
O
R
O2
Pr odu ct lin e 12
o2_look.h 25
O 2 C 13
O 2C
Opt ion s 25
O 2 Cor ba 13
O 2 DBAccess 13
O 2 En gin e 12
O 2 Gr aph 13
O 2 Kit 13
O 2 Look 13
O 2 OD BC 13
O2RESOURCE 67
O 2 Stor e 12
O 2 Tools 13
O 2 Web 13
Object
Gr aph ic r esou r ces 131–135
Opt ion
display 66
lk_map 61
nolook 25
O2 C 25
Real n u m ber r esou r ces 116
refresh_all 38
Resou r ce
Ar r ays 106–107
Files 102–106
Tables 107–110
Resou r ce specificat ion 76
Resou r ces
Boolean valu es 119
Ch ar acter s 117
Global 111–112
In t r odu ct ion 20, 102
Lar ge lists 123
Lar ge set s 127
List s 121–124
Object s 131–135
Pr esen tation 113–114
Real n u m ber s 116
Set s 125–128
Str in gs 118
Tu ples 129–130
rubout 39
OQL 13
O2 Look User Man u al
151
INDEX
S
save 46
Set
Gr aph ic r esou r ces 125–128
Lar ge set s 127
St r in g gr aph ic r esou r ces 118
T
title 47
Tu ple
Gr aph ic r esou r ces 129–130
Type
C 24
Data 74
V
Var iable
DISPLAY 66
HOME 67, 102
O2RESOURCE 67, 102
X
XmManager 139
XO2_BOOLEAN 140
XO2_BYTES 140
152
O2 Look User Man u al
XO2_CHAR 140
XO2_INTEGER 140
XO2_OBJECT 140
XO2_REAL 140
XO2_STRING 140
XO2_VALUE 140
Xo2ConsultO2Value 146
Xo2CreateLook 143
Xo2Look 139
xo2LookWidgetClass 139
Xo2NeditorName 141
Xo2Nkind 140
Xo2Nmask 141
Xo2NpresResources 141
Xo2NpresResourcesCount 141
Xo2Nvalue 140
Xo2SetO2Value 144
XtGetValues 139
XtSetArg 140
XtSetValues 139