home *** CD-ROM | disk | FTP | other *** search
/ WarCraft 2000 - Nuclear Epidemic / W2000.nrg / SOURCE.War2000 / Dialogs.h < prev    next >
C/C++ Source or Header  |  1998-09-23  |  6KB  |  247 lines

  1.  
  2. class SQPicture{
  3. public:
  4.     word* PicPtr;
  5.     SQPicture();
  6.     void LoadPicture(char* Name);
  7.     void Draw(int x,int y);
  8.     void DrawTransparent(int x,int y);
  9.     ~SQPicture();
  10. };
  11. class SimpleDialog;
  12. typedef bool VCall(SimpleDialog* SD);
  13. class SimpleDialog{
  14. public:
  15.     bool Enabled:1;
  16.     bool Active:1;
  17.     bool MouseOver:1;
  18.     bool NeedToDraw:1;
  19.     bool MouseOverActive:1;
  20.     int x,y,x1,y1;
  21.     int UserParam;
  22.     SimpleDialog* Parent;
  23.     VCall* OnClick;
  24.     VCall* OnDraw;
  25.     VCall* OnActivate;
  26.     VCall* OnLeave;
  27.     VCall* OnKeyDown;
  28.     VCall* OnMouseOver;
  29.     VCall* Refresh;
  30.     VCall* Destroy;
  31.     VCall* OnUserClick;
  32.     SimpleDialog();
  33. };
  34. class Picture:public SimpleDialog{
  35. public:
  36.     SQPicture* PassivePicture;
  37.     SQPicture* ActivePicture;
  38.     SQPicture* DisabledPicture;
  39.     bool Transparent:1;
  40.     Picture(){SimpleDialog;};
  41. };
  42. class RLCPicture:public SimpleDialog{
  43. public:
  44.     RLCTable* PassivePicture;
  45.     byte ppic;
  46.     RLCTable* ActivePicture;
  47.     byte apic;
  48.     RLCTable* DisabledPicture;
  49.     byte dpic;
  50. };
  51. class TextMessage{
  52.     char* Message;
  53.     RLCFont* Font;
  54.     byte Align;
  55. };
  56. class TextButton:public SimpleDialog{
  57. public:
  58.     char* Message;
  59.     RLCFont* ActiveFont;
  60.     RLCFont* PassiveFont;
  61.     RLCFont* DisabledFont;
  62.     int    xc;
  63.     int yc;
  64.     int ActiveDX;
  65.     int ActiveDY;
  66.     byte Align;
  67. };
  68. class VScrollBar:public SimpleDialog{
  69. public:
  70.     int SMaxPos,SPos;
  71.     int sbx,sby,sblx,sbly;
  72.     int LastTime;
  73.     byte mkly,btnly;
  74.     bool Zaxvat;
  75.     SQPicture* btn_up0;
  76.     SQPicture* btn_up1;
  77.     SQPicture* btn_up1p;
  78.     SQPicture* btn_dn0;
  79.     SQPicture* btn_dn1;
  80.     SQPicture* btn_dn1p;
  81.     SQPicture* sbar0;
  82.     SQPicture* sbar1;
  83.     SQPicture* marker;
  84.     void SetMaxPos(int i){SMaxPos=i;};
  85.     int GetMaxPos(){return SMaxPos;};
  86.     int GetPos(){return SPos;};
  87. };
  88. class BpxTextButton:public TextButton{
  89. public:
  90.     SQPicture* PassivePicture;
  91.     SQPicture* ActivePicture;
  92.     SQPicture* DisabledPicture;
  93. };
  94. struct ListBoxItem{
  95.     char* Message;
  96.     int Param1;
  97.     ListBoxItem* NextItem; 
  98. };
  99. class ListBox:public SimpleDialog{
  100. public:
  101.     ListBoxItem* FirstItem;
  102.     ListBoxItem* LastItem;
  103.     SQPicture* ItemPic;
  104.     RLCFont* AFont;
  105.     RLCFont* PFont;
  106.     byte ny;
  107.     byte oneLy;
  108.     int     oneLx;
  109.     int NItems;
  110.     int CurItem;
  111.     int FLItem;
  112.     VScrollBar* VS;
  113.     ListBoxItem* GetItem(int i);
  114.     void AddItem(char* str,int info);
  115.     void ClearItems();
  116.     void SetFirstPos(int i);
  117.     void SetCurrentItem(int i);
  118. };
  119. class InputBox:public SimpleDialog{
  120. public:
  121.     char* Str;
  122.     int StrMaxLen;
  123.     RLCFont* Font;
  124.     RLCFont* AFont;
  125.     SQPicture* Pict;
  126. };
  127. class DialogsSystem;
  128. class CheckBox:public SimpleDialog{
  129. public:
  130.     DialogsSystem* DS;
  131.     SQPicture* OnPic;
  132.     SQPicture* OffPic;
  133.     char* Message;
  134.     bool State;
  135.     int GroupIndex;
  136.     RLCFont* Font;
  137.     RLCFont* AFont;
  138. };
  139. class ColoredBar:public SimpleDialog{
  140. public:
  141.     byte color;
  142. };
  143. struct LineInfo{
  144.     bool NeedFormat;
  145.     word LineSize;
  146.     word NSpaces;
  147.     int  Offset;
  148.     int  NextOffset;
  149.     word LineWidth;
  150. };
  151. class TextViewer:public SimpleDialog{
  152. public:
  153.     char* TextPtr;
  154.     int TextSize;
  155.     int NLines;
  156.     int Line;
  157.     int PageSize;
  158.     int Lx;
  159.     word SymSize;
  160.     RLCFont* Font;
  161.     void GetNextLine(LineInfo*);
  162.     void CreateLinesList();
  163.     char** LinePtrs;
  164.     word*  LineSize;
  165.     word*  LineWidth;
  166.     bool*  NeedFormat;
  167.     word*  NSpaces;
  168. };
  169. class DialogsSystem{
  170. public:
  171.     int    BaseX,BaseY;
  172.     SimpleDialog* DSS[512];
  173.     int NDial;
  174.     DialogsSystem(int x,int y);
  175.     ~DialogsSystem();
  176.     RLCFont* Active;
  177.     RLCFont* Passive;
  178.     RLCFont* Disabled;
  179.     RLCFont* Message;
  180.     void ProcessDialogs();
  181.     void MarkToDraw();
  182.     void RefreshView();
  183.     void CloseDialogs();
  184.     void SetFonts(RLCFont* Active,
  185.                   RLCFont* Passive,
  186.                   RLCFont* Disabled,
  187.                   RLCFont* Message);
  188.     Picture* addPicture(SimpleDialog* Parent,int x,int y,
  189.                         SQPicture* Active,
  190.                         SQPicture* Passive,
  191.                         SQPicture* Disabled);
  192.     RLCPicture* addRLCPicture(SimpleDialog* Parent,int x,int y,
  193.                         RLCTable* Active,byte apic,
  194.                         RLCTable* Passive,byte ppic,
  195.                         RLCTable* Disabled,byte dpic);
  196.     TextMessage* addTextMessage(SimpleDialog* Parent,int x,int y,char* str,RLCFont* Font,byte Align);
  197.     TextMessage* addsTextMessage(SimpleDialog* Parent,int x,int y,char* str);
  198.     TextButton* addTextButton(SimpleDialog* Parent,int x,int y,char* str,
  199.                         RLCFont* Active,
  200.                         RLCFont* Passive,
  201.                         RLCFont* Disabled,
  202.                         byte Align);//==0-left, ==1-center,  ==2-right
  203.     TextButton* addsTextButton(SimpleDialog* Parent,int x,int y,char* str);
  204.     BpxTextButton* addBpxTextButton(SimpleDialog* Parent,int x,int y,char* str,
  205.                         RLCFont* Active,
  206.                         RLCFont* Passive,
  207.                         RLCFont* Disabled,
  208.                         SQPicture* pActive,
  209.                         SQPicture* pPassive,
  210.                         SQPicture* pDisabled);
  211.     VScrollBar* addVScrollBar(SimpleDialog* Parent,int x,int y,int MaxPos,int Pos,
  212.                         SQPicture* btn_up0,
  213.                         SQPicture* btn_up1,
  214.                         SQPicture* btn_up1p,
  215.                         SQPicture* btn_dn0,
  216.                         SQPicture* btn_dn1,
  217.                         SQPicture* btn_dn1p,
  218.                         SQPicture* sbar0,
  219.                         SQPicture* sbar1,
  220.                         SQPicture* marker);
  221.     VScrollBar* addHScrollBar(SimpleDialog* Parent,int x,int y,int MaxPos,int Pos,
  222.                         SQPicture* btn_up0,
  223.                         SQPicture* btn_up1,
  224.                         SQPicture* btn_up1p,
  225.                         SQPicture* btn_dn0,
  226.                         SQPicture* btn_dn1,
  227.                         SQPicture* btn_dn1p,
  228.                         SQPicture* sbar0,
  229.                         SQPicture* sbar1,
  230.                         SQPicture* marker);
  231.     ListBox* addListBox(SimpleDialog* Parent,int x,int y,int Ny,
  232.                         SQPicture* ItemPic,
  233.                         RLCFont* AFont,
  234.                         RLCFont* PFont,
  235.                         VScrollBar* VS);
  236.     InputBox* addInputBox(SimpleDialog* Parent,int x,int y,char* str,int Len,SQPicture* Panel,RLCFont* RFont,RLCFont* AFont);
  237.     CheckBox* addCheckBox(SimpleDialog* Parent,int x,int y,char* Message,
  238.                         int group,bool State,
  239.                         SQPicture* OnPict,
  240.                         SQPicture* OffPict,
  241.                         RLCFont* Font,
  242.                         RLCFont* AFont);
  243.     SimpleDialog* addViewPort(int x,int y,int Nx,int Ny);
  244.     ColoredBar* addColoredBar(int x,int y,int Nx,int Ny,byte c);
  245.     TextViewer* addTextViewer(SimpleDialog* Parent,int x,int y,int Lx,int Ly,char* TextFile,RLCFont* TFont); 
  246. };
  247.