home *** CD-ROM | disk | FTP | other *** search
/ CD/PC Actual 9 / CDACTUAL9.iso / progs / CB / DATA.Z / MENUS.HPP < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-06  |  12.4 KB  |  291 lines

  1. //----------------------------------------------------------------------------
  2. // Menus.hpp - dcc32 generated hdr (DO NOT EDIT) rev: -2
  3. // From: Menus.pas
  4. //----------------------------------------------------------------------------
  5. #ifndef MenusHPP
  6. #define MenusHPP
  7. //----------------------------------------------------------------------------
  8. #ifndef MessagesHPP
  9. #include <Messages.hpp>
  10. #endif
  11.  
  12. #ifndef ClassesHPP
  13. #include <Classes.hpp>
  14. #endif
  15.  
  16. #ifndef SysUtilsHPP
  17. #include <SysUtils.hpp>
  18. #endif
  19.  
  20. #ifndef WindowsHPP
  21. #include <Windows.hpp>
  22. #endif
  23.  
  24. #ifndef SystemHPP
  25. #include <System.hpp>
  26. #endif
  27.  
  28. namespace Menus
  29. {
  30. //-- type declarations -------------------------------------------------------
  31. class __declspec(delphiclass) EMenuError;
  32. class __declspec(pascalimplementation) EMenuError : public Sysutils::Exception
  33. {
  34.     typedef EMenuError ThisClass;
  35.     typedef Sysutils::Exception inherited;
  36.     
  37. public:
  38.     /* !! Exception.Create */ __fastcall EMenuError(const System::AnsiString Msg) : Sysutils::Exception(
  39.         Msg) { }
  40.     /* !! Exception.CreateFmt */ __fastcall EMenuError(const System::AnsiString Msg, const TVarRec *Args
  41.         , const System::Integer Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  42.     /* !! Exception.CreateRes */ __fastcall EMenuError(System::Integer Ident) : Sysutils::Exception(Ident
  43.         ) { }
  44.     /* !! Exception.CreateResFmt */ __fastcall EMenuError(System::Integer Ident, const TVarRec *Args, const 
  45.         System::Integer Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  46.     /* !! Exception.CreateHelp */ __fastcall EMenuError(const System::AnsiString Msg, System::Integer AHelpContext
  47.         ) : Sysutils::Exception(Msg, AHelpContext) { }
  48.     /* !! Exception.CreateFmtHelp */ __fastcall EMenuError(const System::AnsiString Msg, const TVarRec 
  49.         *Args, const System::Integer Args_Size, System::Integer AHelpContext) : Sysutils::Exception(Msg, Args
  50.         , Args_Size, AHelpContext) { }
  51.     /* !! Exception.CreateResHelp */ __fastcall EMenuError(System::Integer Ident, System::Integer AHelpContext
  52.         ) : Sysutils::Exception(Ident, AHelpContext) { }
  53.     /* !! Exception.CreateResFmtHelp */ __fastcall EMenuError(System::Integer Ident, const TVarRec *Args
  54.         , const System::Integer Args_Size, System::Integer AHelpContext) : Sysutils::Exception(Ident, Args
  55.         , Args_Size, AHelpContext) { }
  56.     
  57. public:
  58.     /* !! TObject.Destroy */ __fastcall virtual ~EMenuError(void) { }
  59.     
  60. };
  61.  
  62. enum TMenuBreak { mbNone, mbBreak, mbBarBreak };
  63.  
  64. typedef System::Word TShortCut;
  65.  
  66. typedef void __fastcall (__closure *TMenuChangeEvent)(System::TObject *Sender, System::Boolean Rebuild
  67.     );
  68.  
  69. class __declspec(delphiclass) TMenuItem;
  70. class __declspec(delphiclass) TMenu;
  71. enum TFindItemKind { fkCommand, fkHandle, fkShortCut };
  72.  
  73. class __declspec(pascalimplementation) TMenu : public Classes::TComponent
  74. {
  75.     typedef TMenu ThisClass;
  76.     typedef Classes::TComponent inherited;
  77.     
  78. private:
  79.     TMenuItem *FItems;
  80.     System::Integer FWindowHandle;
  81.     System::AnsiString FMenuImage;
  82.     virtual void __fastcall MenuChanged(System::TObject *Sender, System::Boolean Rebuild);
  83.     void __fastcall SetWindowHandle(System::Integer Value);
  84.     System::Boolean __fastcall UpdateImage(void);
  85.     
  86. protected:
  87.     virtual void __fastcall GetChildren(Classes::TGetChildProc Proc);
  88.     virtual System::Integer __fastcall GetHandle(void);
  89.     virtual void __fastcall SetChildOrder(Classes::TComponent *Child, System::Integer Order);
  90.     
  91. public:
  92.     __fastcall virtual TMenu(Classes::TComponent *AOwner);
  93.     __fastcall virtual ~TMenu(void);
  94.     System::Boolean __fastcall DispatchCommand(System::Word ACommand);
  95.     System::Boolean __fastcall DispatchPopup(System::Integer AHandle);
  96.     TMenuItem *__fastcall FindItem(System::Integer Value, TFindItemKind Kind);
  97.     Classes::THelpContext __fastcall GetHelpContext(System::Word Value, System::Boolean ByCommand);
  98.     System::Boolean __fastcall IsShortCut(Messages::TWMKey &Message);
  99.     __property System::Integer Handle = {read=GetHandle, nodefault};
  100.     __property System::Integer WindowHandle = {read=FWindowHandle, write=SetWindowHandle, nodefault};
  101.     
  102. __published:
  103.     __property TMenuItem * Items = {read=FItems, nodefault};
  104. };
  105.  
  106. class __declspec(pascalimplementation) TMenuItem : public Classes::TComponent
  107. {
  108.     typedef TMenuItem ThisClass;
  109.     typedef Classes::TComponent inherited;
  110.     
  111. private:
  112.     System::AnsiString FCaption;
  113.     System::Integer FHandle;
  114.     System::Boolean FChecked;
  115.     System::Boolean FEnabled;
  116.     System::Boolean FDefault;
  117.     System::Boolean FRadioItem;
  118.     System::Boolean FVisible;
  119.     System::Byte FGroupIndex;
  120.     TMenuBreak FBreak;
  121.     System::Word FCommand;
  122.     Classes::THelpContext FHelpContext;
  123.     System::AnsiString FHint;
  124.     Classes::TList *FItems;
  125.     TShortCut FShortCut;
  126.     TMenuItem *FParent;
  127.     TMenuItem *FMerged;
  128.     TMenu *FMenu;
  129.     TMenuChangeEvent FOnChange;
  130.     Classes::TNotifyEvent FOnClick;
  131.     void __fastcall AppendTo(System::Integer Menu);
  132.     void __fastcall ClearHandles(void);
  133.     void __fastcall ReadShortCutText(Classes::TReader *Reader);
  134.     void __fastcall MergeWith(TMenuItem *Menu);
  135.     void __fastcall RebuildHandle(void);
  136.     void __fastcall PopulateMenu(void);
  137.     void __fastcall SubItemChanged(System::TObject *Sender, System::Boolean Rebuild);
  138.     void __fastcall WriteShortCutText(Classes::TWriter *Writer);
  139.     void __fastcall VerifyGroupIndex(System::Integer Position, System::Byte Value);
  140.     
  141. protected:
  142.     virtual void __fastcall DefineProperties(Classes::TFiler *Filer);
  143.     System::Integer __fastcall GetHandle(void);
  144.     System::Integer __fastcall GetCount(void);
  145.     virtual void __fastcall GetChildren(Classes::TGetChildProc Proc);
  146.     TMenuItem *__fastcall GetItem(System::Integer Index);
  147.     System::Integer __fastcall GetMenuIndex(void);
  148.     virtual Classes::TComponent *__fastcall GetParentComponent(void);
  149.     virtual void __fastcall MenuChanged(System::Boolean Rebuild);
  150.     virtual System::Boolean __fastcall HasParent(void);
  151.     void __fastcall SetBreak(TMenuBreak Value);
  152.     void __fastcall SetCaption(const System::AnsiString Value);
  153.     void __fastcall SetChecked(System::Boolean Value);
  154.     virtual void __fastcall SetChildOrder(Classes::TComponent *Child, System::Integer Order);
  155.     void __fastcall SetDefault(System::Boolean Value);
  156.     void __fastcall SetEnabled(System::Boolean Value);
  157.     void __fastcall SetGroupIndex(System::Byte Value);
  158.     void __fastcall SetMenuIndex(System::Integer Value);
  159.     virtual void __fastcall SetParentComponent(Classes::TComponent *Value);
  160.     void __fastcall SetRadioItem(System::Boolean Value);
  161.     void __fastcall SetShortCut(TShortCut Value);
  162.     void __fastcall SetVisible(System::Boolean Value);
  163.     
  164. public:
  165.     __fastcall virtual TMenuItem(Classes::TComponent *AOwner);
  166.     __fastcall virtual ~TMenuItem(void);
  167.     void __fastcall Insert(System::Integer Index, TMenuItem *Item);
  168.     void __fastcall Delete(System::Integer Index);
  169.     virtual void __fastcall Click(void);
  170.     System::Integer __fastcall IndexOf(TMenuItem *Item);
  171.     void __fastcall Add(TMenuItem *Item);
  172.     void __fastcall Remove(TMenuItem *Item);
  173.     __property System::Word Command = {read=FCommand, nodefault};
  174.     __property System::Integer Handle = {read=GetHandle, nodefault};
  175.     __property System::Integer Count = {read=GetCount, nodefault};
  176.     __property TMenuItem * Items[System::Integer Index] = {read=GetItem/*, default*/};
  177.     __property System::Integer MenuIndex = {read=GetMenuIndex, write=SetMenuIndex, nodefault};
  178.     __property TMenuItem * Parent = {read=FParent, nodefault};
  179.     
  180. __published:
  181.     __property TMenuBreak Break = {read=FBreak, write=SetBreak, default=0};
  182.     __property System::AnsiString Caption = {read=FCaption, write=SetCaption, nodefault};
  183.     __property System::Boolean Checked = {read=FChecked, write=SetChecked, default=0};
  184.     __property System::Boolean Default = {read=FDefault, write=SetDefault, default=0};
  185.     __property System::Boolean Enabled = {read=FEnabled, write=SetEnabled, default=1};
  186.     __property System::Byte GroupIndex = {read=FGroupIndex, write=SetGroupIndex, default=0};
  187.     __property Classes::THelpContext HelpContext = {read=FHelpContext, write=FHelpContext, default=0};
  188.     __property System::AnsiString Hint = {read=FHint, write=FHint, nodefault};
  189.     __property System::Boolean RadioItem = {read=FRadioItem, write=SetRadioItem, default=0};
  190.     __property TShortCut ShortCut = {read=FShortCut, write=SetShortCut, nodefault};
  191.     __property System::Boolean Visible = {read=FVisible, write=SetVisible, default=1};
  192.     __property Classes::TNotifyEvent OnClick = {read=FOnClick, write=FOnClick};
  193. };
  194.  
  195. class __declspec(delphiclass) TMainMenu;
  196. class __declspec(pascalimplementation) TMainMenu : public TMenu
  197. {
  198.     typedef TMainMenu ThisClass;
  199.     typedef TMenu inherited;
  200.     
  201. private:
  202.     TMenuItem *MergedMenu;
  203.     System::Integer FOle2Menu;
  204.     System::Boolean FAutoMerge;
  205.     System::Byte FReserved;
  206.     void __fastcall ItemChanged(void);
  207.     virtual void __fastcall MenuChanged(System::TObject *Sender, System::Boolean Rebuild);
  208.     void __fastcall SetAutoMerge(System::Boolean Value);
  209.     
  210. protected:
  211.     virtual System::Integer __fastcall GetHandle(void);
  212.     
  213. public:
  214.     void __fastcall Merge(TMainMenu *Menu);
  215.     void __fastcall Unmerge(TMainMenu *Menu);
  216.     void __fastcall PopulateOle2Menu(System::Integer SharedMenu, const Integer *Groups, const System::Integer 
  217.         Groups_Size, Longint *Widths, const System::Integer Widths_Size);
  218.     void __fastcall GetOle2AcceleratorTable(System::Integer &AccelTable, System::Integer &AccelCount, const 
  219.         Integer *Groups, const System::Integer Groups_Size);
  220.     void __fastcall SetOle2MenuHandle(System::Integer Handle);
  221.     
  222. __published:
  223.     __property System::Boolean AutoMerge = {read=FAutoMerge, write=SetAutoMerge, default=0};
  224. public:
  225.     /* !! TMenu.Create */ __fastcall virtual TMainMenu(Classes::TComponent *AOwner) : Menus::TMenu(AOwner
  226.         ) { }
  227.     /* !! TMenu.Destroy */ __fastcall virtual ~TMainMenu(void) { }
  228.     
  229. };
  230.  
  231. enum TPopupAlignment { paLeft, paRight, paCenter };
  232.  
  233. class __declspec(delphiclass) TPopupMenu;
  234. class __declspec(pascalimplementation) TPopupMenu : public TMenu
  235. {
  236.     typedef TPopupMenu ThisClass;
  237.     typedef TMenu inherited;
  238.     
  239. private:
  240.     TPopupAlignment FAlignment;
  241.     System::Boolean FAutoPopup;
  242.     Classes::TComponent *FPopupComponent;
  243.     Classes::TNotifyEvent FOnPopup;
  244.     void __fastcall DoPopup(System::TObject *Item);
  245.     Classes::THelpContext __fastcall GetHelpContext(void);
  246.     void __fastcall SetHelpContext(Classes::THelpContext Value);
  247.     
  248. public:
  249.     __fastcall virtual TPopupMenu(Classes::TComponent *AOwner);
  250.     __fastcall virtual ~TPopupMenu(void);
  251.     virtual void __fastcall Popup(System::Integer X, System::Integer Y);
  252.     __property Classes::TComponent * PopupComponent = {read=FPopupComponent, write=FPopupComponent, nodefault
  253.         };
  254.     
  255. __published:
  256.     __property TPopupAlignment Alignment = {read=FAlignment, write=FAlignment, default=0};
  257.     __property System::Boolean AutoPopup = {read=FAutoPopup, write=FAutoPopup, default=1};
  258.     __property Classes::THelpContext HelpContext = {read=GetHelpContext, write=SetHelpContext, default=0
  259.         };
  260.     __property Classes::TNotifyEvent OnPopup = {read=FOnPopup, write=FOnPopup};
  261. };
  262.  
  263. //-- var, const, procedure ---------------------------------------------------
  264. #define scShift System::Smallint(8192)
  265. #define scCtrl System::Smallint(16384)
  266. #define scAlt System::Integer(32768)
  267. #define scNone System::Byte(0)
  268. extern TShortCut __fastcall ShortCut(System::Word Key,  Classes::TShiftState Shift);
  269. extern void __fastcall ShortCutToKey(TShortCut ShortCut, System::Word &Key,  Classes::TShiftState *Shift
  270.     );
  271. extern System::AnsiString __fastcall ShortCutToText(TShortCut ShortCut);
  272. extern TShortCut __fastcall TextToShortCut( System::AnsiString Text);
  273. extern TMainMenu *__fastcall NewMenu(Classes::TComponent *Owner, const System::AnsiString AName, const 
  274.     TMenuItem *Items, const System::Integer Items_Size);
  275. extern TPopupMenu *__fastcall NewPopupMenu(Classes::TComponent *Owner, const System::AnsiString AName
  276.     , TPopupAlignment Alignment, System::Boolean AutoPopup, const TMenuItem *Items, const System::Integer 
  277.     Items_Size);
  278. extern TMenuItem *__fastcall NewSubMenu(const System::AnsiString ACaption, System::Word hCtx, const System::AnsiString 
  279.     AName, const TMenuItem *Items, const System::Integer Items_Size);
  280. extern TMenuItem *__fastcall NewItem(const System::AnsiString ACaption, TShortCut AShortCut, System::Boolean 
  281.     AChecked, System::Boolean AEnabled, Classes::TNotifyEvent AOnClick, System::Word hCtx, const System::AnsiString 
  282.     AName);
  283. extern TMenuItem *__fastcall NewLine(void);
  284.  
  285. }    /* namespace Menus */
  286. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  287. using namespace Menus;
  288. #endif
  289. //-- end unit ----------------------------------------------------------------
  290. #endif    // Menus
  291.