home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / progpas / tegl6b.arj / INTROPAK.EXE / lha / TWKERNEL.DOC < prev    next >
Text File  |  1991-08-16  |  11KB  |  259 lines

  1. {-----------------------------------------------------------------------------}
  2. {               TEGL Windows ToolKit II                  }
  3. {          Copyright (C) 1990, 1991 TEGL Systems Corporation              }
  4. {                All Rights Reserved.                  }
  5. {-----------------------------------------------------------------------------}
  6. {$I Switches.inc }
  7.  
  8. UNIT TwKernel;
  9.  
  10. INTERFACE
  11.  
  12. USES
  13.  
  14.   FastGrph,
  15.   Virtmem,
  16.   {$IFDEF NoGr}
  17.   TGraph,
  18.   {$ELSE}
  19.   Graph,
  20.   {$ENDIF}
  21.  
  22.   teglfont,
  23.   teglintr,
  24.   teglmain,
  25.   teglunit,
  26.   teglmenu,
  27.   teglspec,
  28.   twcommon;
  29.  
  30.  
  31. TYPE
  32.  
  33.   {-- TYPE definitions for DIALOGUES }
  34.  
  35.  
  36.   twDialogPtr = ^twDialogItem;
  37.  
  38.   twDialogItem = RECORD
  39.     x1, y1 : integer;        {-- display relative on window }
  40.     x2, y2 : integer;
  41.     sx1, sy1 : integer;     {-- xor box selection indicator locations }
  42.     sx2, sy2 : integer;
  43.     active : boolean;        {-- set true if active, false if non-selectable }
  44.     len    : byte;        {-- length of input string (max) }
  45.     places : byte;        {-- for floating point display }
  46.     ms       : msclickptr;    {-- store the associate mouse click ptr }
  47.     ms_edit: msclickptr;    {-- associated editior mouse clikc ptr }
  48.     tdtype : integer;        {-- type of dialogue item, def in twcommon }
  49.     message: ^string;        {-- prompt or message }
  50.     msnum  : integer;        {-- mouse click number association }
  51.     number : integer;        {-- simply the counter }
  52.     clusNum: integer;        {-- cluster number, for grouping items together }
  53.     clusItem: integer;        {-- cluster item, item of group }
  54.     data   : pointer;        {-- points to data item, nil if not required }
  55.     strdata: ^string;        {-- store intermediate string }
  56.     Prev   : twdialogPtr;    {-- point to previous dialog item }
  57.     Next   : twdialogPtr;    {-- point to next dialog item }
  58.     action : CallProc;        {-- user event (attaches to button) }
  59.   END;
  60.  
  61.  
  62.   twMenuPtr = ^MenuItem;
  63.  
  64.   MenuItem = RECORD
  65.     Next    : Pointer;    {-- points to next, NIL if last }
  66.     Item    : byte;     {-- just a counter }
  67.     prompt    : String[20];    {-- the menu item name }
  68.     om        : OptionmPtr;    {-- what pulls down from it }
  69.     MouseNum    : Integer;    {-- store associated mouse num }
  70.     Entries    : byte;     {-- }
  71.     EntryActive : Boolean;    {-- true if active }
  72.     EntryCall    : CallProc;    {-- point to event if its not a pull down}
  73.   END;
  74.  
  75. {-- The WinFrame record is an 'object-like' data structure. It contains }
  76. {-- all the data items required to program and manipulate a complex window.}
  77. {-- All the procedure and functions which access this data record start with }
  78. {-- tw<name> and the parameter list is AT LEAST ONE but may be more, and the
  79. {-- first parameter is always a WinFramePtr. In this respect the WinFramePtr }
  80. {-- points to what would be called 'self' in an object-oriented version. }
  81. {-- Note that this only mimics an object version. It is done to make }
  82. {-- the switch to a true object oriented version easier. }
  83.  
  84.   winframe = RECORD
  85.     ifs : ImageStkPtr;          {-- pointer from image stack }
  86.     iconifs : ImageStkPtr;
  87.     firsttime : boolean;      {-- flag for window drawing. DO NOT TOUCH!}
  88.     redrawonmove : boolean;    {-- force redraw after a window move }
  89.     style : FrameDrawFunc;         { -- window framestyle }
  90.     thickness : integer;      { -- window framethickness }
  91.     x1,y1,x2,y2 : Word;         { -- window coordinates }
  92.     mx1,my1,mx2,my2 : word;      {-- store window size before maximize }
  93.     wx1,wy1,wx2,wy2 : Word;        { -- window working coordinates }
  94.                   { -- these are the absolute coordinates inside }
  95.                   { -- the window allowing for header, border, }
  96.                   { -- menu and sliders. }
  97.     wmaxx,wmaxy : Word;       { -- the maximum working area }
  98.     minx,miny,maxx,maxy : Word;   { -- min max for resize }
  99.     font    : Pointer;      { -- font to use for text output }
  100.     displayfont : Pointer;      { -- font for header, menus }
  101.     theight    : Byte;       { -- text height in pixels }
  102.     twidth    : Byte;       { -- text width in pixels }
  103.     rows    : Byte;       { -- number of rows in the working window }
  104.     cols    : Byte;       { -- number of cols in the working window }
  105.     curx    : Integer;      { -- cursor location (col, row) }
  106.     cury    : Integer;
  107.     textattr    : byte;       { -- traditional text char attribute }
  108.     CharClear    : Boolean;      { -- clear character before drawing new one }
  109.     bordercolor : Integer;      { -- color scheme }
  110.     headercolor : Integer;
  111.     framecolor    : Integer;
  112.     framecolor2 : Integer;
  113.     fillcolor    : Integer;
  114.     textcolor    : Integer;
  115.  
  116.     {-- Header and buttons stuff }
  117.  
  118.     Header     : boolean;      { -- if header shown }
  119.     HeaderStr     : String[twMaxHeaderLen];
  120.     Maximize     : boolean;      { -- true if minimize, maximize OK }
  121.     Maximized     : boolean;      { -- true if we are maximized }
  122.     ThickStore     : integer;      { -- remember thickness when maximized }
  123.     Minimized     : boolean;      { -- true if we are now an icon }
  124.     Icon     : Pointer;      { -- icon to display when window minimized }
  125.  
  126.     {-- SLIDERS - up down   }
  127.  
  128.     UpDownslider : Boolean;      { -- true if updown slider shown }
  129.     UpDnSlidePer : Integer;      { -- set to sliders relative position %}
  130.     UpbuttonPress: Boolean;      { -- set true if up button was pressed }
  131.     DnButtonPress: Boolean;      { -- set true if down button was pressed }
  132.     UpDownEvent  : CallProc;      { -- user event to process up down slider action }
  133.     UpDownSldPtr : SliderPtr;      { -- store slider pointer }
  134.     UpDownRange  : Integer;      { -- scale of the slider }
  135.     UpDownStep     : Integer;      {-- button step value }
  136.  
  137.     {-- Left right }
  138.  
  139.     LeftRightSlider : Boolean;      { -- true if leftright slider shown }
  140.     LfRtSlidePer : Integer;      { -- }
  141.     LfButtonPress: Boolean;      { -- true if left button was pressed }
  142.     RtButtonPress: Boolean;      { -- ture if right button was pressed }
  143.     LeftRightEvent: CallProc;      { -- user event to process left right slider action }
  144.     LeftRightSldPtr: SliderPtr;   { -- store slider pointer }
  145.     LeftRightRange: Integer;
  146.     LeftRightStep: Integer;
  147.  
  148.  
  149.     Resize    : Boolean;      { -- true if resizeable }
  150.     Moveable    : Boolean;      { -- true if window is moveable }
  151.     Buffered    : Boolean;
  152.     Proportional: Boolean;      { -- true if text is displayed proportionally }
  153.     Wrap    : Boolean;      { -- true if text is to wrap at border }
  154.  
  155.     {-- framemenu }
  156.     Om        : OptionmPtr;      { -- the alt-space bar menu }
  157.     {-- twMenu }
  158.  
  159.     MenuEntries : Byte;       { -- number of main menu bar selections }
  160.     MenuThickness: Byte;      { -- depends on number of lines }
  161.     Menu    : twMenuPtr;      { -- points to first item, NIL if none }
  162.     MenuLast    : twMenuPtr;      { -- last item added }
  163.     {-- }
  164.  
  165.     {$IFDEF twWorld }
  166.     {-- world coordinate data items follow, procedures in 'twWorld.pas' }
  167.     wcx1,wcy1,wcx2,wcy2   : wcFloat; {-- coordinate system range to use }
  168.     wcHeight,wcWidth,             {-- width an hight in defined system }
  169.     wcXoff,wcYoff,             {-- offset to normalize }
  170.     wcXfac,wcYfac      : wcFloat; {-- factor to multiply by (transforms) }
  171.     {$ENDIF }
  172.  
  173.  
  174.     {-- for 'twGraph.pas' - standard graph calls, window relative }
  175.     clipping        : Boolean;          {-- clipping for twgraph & twworld }
  176.     gvars        : GraphVars;  {-- used to set the graph unit state }
  177.  
  178.     {-- for 'twdialog.pas' - anchor pointer for dialog list }
  179.     twdanchor        : twDialogPtr; {-- anchor, starting point for list }
  180.     twdcurrent        : twDialogPtr; {-- current is also the last item }
  181.     twdcount        : Word;       {-- counts the number of dialog entries }
  182.     twdfont        : pointer;
  183.  
  184.     {-- procedural pointers follow }
  185.     closeevent    : Callproc;      { -- userdefined Close from mouse click}
  186.     menucloseevent : CallProc;      { -- userdefined close from menu }
  187.     redrawevent : Callproc;      { -- redraw window event }
  188.     aboutevent    : CallProc      { -- the about selection from space bar menu }
  189.   end;
  190.  
  191.  
  192.   WinFramePtr = ^WinFrame;
  193.  
  194.  
  195. Function FindWinFrame(ifs : ImageStkPtr) : WinFramePtr;
  196. Procedure twClear(wf : WinFramePtr);
  197. Procedure twClose(wf : WinFramePtr);
  198.  function twcloseEvent(ifs : ImageStkPtr; ms : MsClickPtr) : Word;
  199. function twMenuCloseEvent(ifs : ImageStkPtr; ms : MsClickPtr) : Word;
  200. Procedure twSetCloseEvent(wf: WinFramePtr; event: CallProc);
  201. Procedure twSelect(wf : WinFramePtr);
  202. Procedure twWriteXY(wf : WinFramePtr; col,row :Integer; s : string);
  203. Procedure twFixUp(wf : WinFramePtr);
  204. Procedure twDefineMouseClickArea(wf : WinFramePtr;
  205.                  x1_, y1_, x2_, y2_ : Word;
  206.                  active : Boolean;
  207.                  action : CallProc);
  208.  
  209. Procedure twPutPict(wf : WinFramePtr; x,y : Integer; Image:Pointer; Color :Integer);
  210. Procedure twMenuItem(wf : WinFramePtr; s : String; Active: Boolean);
  211. Procedure twSubMenuItem(wf : WinFramePtr; s : String; Active: Boolean; event : CallProc);
  212. Procedure twSetBorderColor(wf : WinFramePtr; Color : Byte);
  213. Procedure twSetFont(wf : WinFramePtr; font: pointer);
  214.  
  215. Procedure twSetDisplayFont(wf : winFramePtr; Font: Pointer);
  216.  
  217. Procedure twSetMaximize(wf : WinFramePtr; tf : Boolean);
  218. Procedure twSetMinimizeIcon(wf : WinFramePtr; Icon : Pointer);
  219. Procedure twSetRedraw(wf : WinFramePtr; Redraw_ : CallProc);
  220. Procedure twSetResize(wf : WinFramePtr; tf: Boolean);
  221.  
  222. Procedure twSetUpDownSlider(wf : WinFramePtr; Active : Boolean);
  223. Procedure twSetLeftRightSlider(wf : WinFramePtr; Active : Boolean);
  224. Procedure twSetUpDownRange(wf: WinFramePtr; range,step : Integer);
  225. Procedure twSetLeftRightRange(wf: WinFramePtr; range,step: Integer);
  226.  
  227. Procedure twSetUpDownEvent(wf: WinFramePtr; Event : CallProc);
  228. Procedure twSetLeftRightEvent(wf : WinFramePtr; Event : CallProc);
  229.  
  230.  
  231. Procedure twScrollDown(wf : winFramePtr; Num : Integer);
  232. Procedure twScrollUp(wf : WinFramePtr; Num : Integer);
  233. Procedure twSetFillColor(wf : WinFramePtr; Color: Byte);  {-- background }
  234. Procedure twSetColor(wf : WinFramePtr; Color: Byte);      {-- foreground }
  235. Procedure twSetThickness(wf : WinFramePtr; Thickness : Byte);
  236.  
  237. Procedure twInit(VAR wf : WinFramePtr; x_,y_,x1_,y1_ : Word);
  238. Procedure twSetWinFrameColors(wf : WinFramePtr; Color1, Color2 : Byte);
  239. Procedure twSetWindowStyle(wf: WinFramePtr; Style : FrameDrawFunc);
  240. Procedure twSetHeader(wf : WinFramePtr; s : String);
  241. Procedure twUnSelect(wf : WinFramePtr);
  242. Procedure twDrawWindowFrame(wf : winframeptr);
  243.  
  244. TYPE
  245.  
  246.   WinFrameStkPtr = ^WinFrameStk;
  247.  
  248.   WinFrameStk = Record           {-- for maintaining linked list of windows }
  249.     Next   : WinFrameStkPtr;   {-- points to next window frame, NIL if no more }
  250.     Item   : WinFramePtr;      {-- points to actual window frame data }
  251.     num    : integer;           {-- count it. }
  252.   END;
  253.  
  254. CONST
  255.   WinFrameAnchor : WinFrameStkPtr = NIL;  {-- anchor linked list in data seg}
  256.   WinCount : Integer = 0;  {-- increment as each window is opened }
  257.  
  258. IMPLEMENTATION
  259.