1 Program ToolManager2;
2 
3 (*
4  *  OpenTriton -- A free release of the triton.library source code
5  *  Copyright (C) 1993-1998  Stefan Zeiger
6  *
7  *  This program is free software; you can redistribute it and/or modify
8  *  it under the terms of the GNU General Public License as published by
9  *  the Free Software Foundation; either version 2 of the License, or
10  *  (at your option) any later version.
11  *
12  *  This program is distributed in the hope that it will be useful,
13  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *  GNU General Public License for more details.
16  *
17  *  You should have received a copy of the GNU General Public License
18  *  along with this program; if not, write to the Free Software
19  *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
20  *  MA 02110-1301, USA.
21  *
22  *  Toolmanager2.c - Looks like the ToolManager demo 2 of GUIFront
23  *
24  *)
25 
26 uses exec, triton, tritonmacros, linklist, utility;
27 
28 {
29    A demo in FPC Pascal using triton.library
30 
31    Updated for fpc 1.0.7
32    11 Jan 2003.
33 
34    nils.sjoholm@mailbox.swipnet.se
35 }
36 
37 
38 
39 
40 const
41      cycle_entries : array [0..7] of pchar = ('Exec','Image','Sound','Menu','Icon','Dock','Access',NIL);
42 
43      liststrings : array [0..8] of pchar = (
44                      '2024view' ,
45                      'Add to archive',
46                      'Delete',
47                      'Edit text',
48                      'Env',
49                      'Exchange',
50                      'Global Help System',
51                      'Multiview',
52                      'Paint');
53 
54 var
55    i : longint;
56    LVList : pList;
57    MyNode : pFPCNode;
58    Triton_App : pTR_App;
59 
60 procedure CleanUp(why : string; err : longint);
61 begin
62    if assigned(Triton_App) then TR_DeleteApp(Triton_App);
63    if assigned(LVList) then DestroyList(LVList);
64    if why <> '' then writeln(why);
65    halt(err);
66 end;
67 
68 begin
69   if not Assigned(TritonBase) then
70   begin
71     writeln('cannot open ' + TRITONNAME);
72     Halt(5);
73   end;
74     CreateList(LVList);
75     FOR i := 0 TO 8 DO BEGIN
76         MyNode := AddNewNode(LVList, liststrings[i]);
77     END;
78 
79     Triton_App := TR_CreateAppTags([
80                           TRCA_Name, AsTag('ToolManagerGUIDemo2'),
81                           TRCA_LongName, AsTag('ToolManager GUI demo 2'),
82                           TRCA_Info, AsTag('Looks like the ToolManager demo 2 of GUIFront'),
83                           TAG_END]);
84 
85     if Triton_App = nil then CleanUp('Can''t create application',20);
86 
87       ProjectStart;
88       WindowID(0); WindowPosition(TRWP_MOUSEPOINTER);
89       WindowTitle('ToolManager GUI demo 2'); WindowFlags(TRWF_NOSIZEGADGET OR TRWF_NODELZIP OR TRWF_ZIPTOCURRENTPOS);
90       WindowBackfillNone;
91 
92       VertGroupA;
93 
94         Space;
95 
96         HorizGroupAC;
97           Space;
98           TextID('_Object Type',1);
99           Space;
100           CycleGadget(@cycle_entries,0,1);
101           Space;
102         EndGroup;
103 
104         Space;
105 
106         HorizGroup;
107           Space;
108           NamedFrameBox('Object List');
109             HorizGroupAC;
110               Space;
111               VertGroupA;
112                 Space;
113                 ListSSCN(LVList,2,0,0);
114                 Space;
115               EndGroup;
116               Space;
117               SetTRTag(TRGR_Vert, TRGR_ALIGN OR TRGR_FIXHORIZ);
118                 Space;
119                 Button('Top',3);
120                 Space;
121                 Button('Up',4);
122                 Space;
123                 Button('Down',5);
124                 Space;
125                 Button('Bottom',6);
126                 Space;
127                 Button('So_rt',7);
128                 Space;
129               EndGroup;
130               Space;
131             EndGroup;
132           Space;
133         EndGroup;
134 
135         Space;
136 
137         HorizGroupEA;
138           Space;
139           Button('_New...',8);
140           Space;
141           Button('_Edit...',9);
142           Space;
143           Button('Co_py',10);
144           Space;
145           Button('Remove',11);
146           Space;
147         EndGroup;
148 
149         Space;
150 
151         HorizGroupEA;
152           Space;
153           Button('_Save',12);
154           Space;
155           Button('_Use',13);
156           Space;
157           Button('_Test',14);
158           Space;
159           Button('_Cancel',15);
160           Space;
161         EndGroup;
162 
163         Space;
164 
165       EndGroup;
166 
167       EndProject;
168 
169 
170     i := TR_AutoRequest(Triton_App,NIL,@tritontags);
171     CleanUp('',0);
172 end.
173