toolmanager1.pas 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. Program ToolManager1;
  2. (*
  3. * OpenTriton -- A free release of the triton.library source code
  4. * Copyright (C) 1993-1998 Stefan Zeiger
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * Toolmanager1.c - Looks like the original ToolManager
  21. *
  22. *)
  23. {
  24. A demo in FPC Pascal using triton.library
  25. Updated for fpc 1.0.7
  26. 11 Jan 2003.
  27. [email protected]
  28. }
  29. uses exec, triton, tritonmacros, amigalib, utility, linklist;
  30. const
  31. cycle_entries : array [0..7] of PChar = ('Exec','Image','Sound','Menu','Icon','Dock','Access',NIL);
  32. liststrings : array [0..8] of PChar = (
  33. '2024view' ,
  34. 'Add to archive',
  35. 'Delete',
  36. 'Edit text',
  37. 'Env',
  38. 'Exchange',
  39. 'Global Help System',
  40. 'Multiview',
  41. 'Paint');
  42. var
  43. i : Longint;
  44. LVList : pList;
  45. MyNode : pFPCNode;
  46. Triton_App : pTR_App;
  47. procedure CleanUp(why : string; err : longint);
  48. begin
  49. if assigned(Triton_App) then TR_DeleteApp(Triton_App);
  50. if assigned(LVList) then DestroyList(LVList);
  51. if why <> '' then writeln(why);
  52. halt(err);
  53. end;
  54. begin
  55. CreateList(LVList);
  56. FOR i := 0 TO 8 DO BEGIN
  57. MyNode := AddNewNode(LVList,liststrings[i]);
  58. END;
  59. Triton_App := TR_CreateAppTags([
  60. TRCA_Name,'ToolManagerGUIDemo1',
  61. TRCA_LongName,'ToolManager GUI demo 1',
  62. TRCA_Info,'Looks like the original ToolManager',
  63. TAG_END]);
  64. if Triton_App = nil then CleanUp('Can''t create application',20);
  65. ProjectStart;
  66. WindowID(0); WindowPosition(TRWP_BELOWTITLEBAR);
  67. WindowTitle('ToolManager GUI demo 1'); WindowFlags(TRWF_NOSIZEGADGET OR TRWF_NODELZIP OR TRWF_NOZIPGADGET OR TRWF_NOESCCLOSE);
  68. WindowBackfillNone;
  69. VertGroupA;
  70. Space;
  71. HorizGroupAC;
  72. Space;
  73. TextID('_Object Type',1);
  74. Space;
  75. CycleGadget(@cycle_entries,0,1);
  76. Space;
  77. EndGroup;
  78. Space;
  79. HorizGroupAC;
  80. Space;
  81. VertGroupAC;
  82. CenteredTextID('Object List',2);
  83. Space;
  84. ListSSCN(LVList,2,0,0);
  85. EndGroup;
  86. Space;
  87. VertGroupA;
  88. TextN('');
  89. Space;
  90. Button('Top',3);
  91. Space;
  92. Button('Up',4);
  93. Space;
  94. Button('Down',5);
  95. Space;
  96. Button('Bottom',6);
  97. Space;
  98. Button('So_rt',7);
  99. EndGroup;
  100. Space;
  101. EndGroup;
  102. Space;
  103. HorizGroupEA;
  104. Space;
  105. Button('_New...',8);
  106. Space;
  107. Button('_Edit...',9);
  108. Space;
  109. Button('Co_py',10);
  110. Space;
  111. Button('Remove',11);
  112. Space;
  113. EndGroup;
  114. Space;
  115. HorizGroupEA;
  116. Space;
  117. Button('_Save',12);
  118. Space;
  119. Button('_Use',13);
  120. Space;
  121. Button('_Test',14);
  122. Space;
  123. Button('_Cancel',15);
  124. Space;
  125. EndGroup;
  126. Space;
  127. EndGroup;
  128. EndProject;
  129. i := TR_AutoRequest(Triton_App,NIL,@tritontags);
  130. CleanUp('',0);
  131. end.