home *** CD-ROM | disk | FTP | other *** search
/ DOS/V Power Report 1997 May / VPR9705A.ISO / VPR_DATA / PROGRAM / CBTRIAL / SETUP / DATA.Z / MENUS.HPP < prev    next >
C/C++ Source or Header  |  1997-02-14  |  11KB  |  274 lines

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