home *** CD-ROM | disk | FTP | other *** search
/ Chip 1997 April / Chip_1997-04_cd.bin / prezent / cb / data.z / OUTLINE.HPP < prev    next >
C/C++ Source or Header  |  1997-01-16  |  17KB  |  396 lines

  1. //----------------------------------------------------------------------------
  2. // Outline.hpp - bcbdcc32 generated hdr (DO NOT EDIT) rev: 0
  3. // From: Outline.pas
  4. //----------------------------------------------------------------------------
  5. #ifndef OutlineHPP
  6. #define OutlineHPP
  7. //----------------------------------------------------------------------------
  8. #include <SysUtils.hpp>
  9. #include <Controls.hpp>
  10. #include <Grids.hpp>
  11. #include <StdCtrls.hpp>
  12. #include <Menus.hpp>
  13. #include <Graphics.hpp>
  14. #include <Classes.hpp>
  15. #include <Forms.hpp>
  16. #include <Messages.hpp>
  17. #include <Windows.hpp>
  18. #include <System.hpp>
  19. #pragma warn -par
  20. #pragma warn -hid 
  21. #pragma warn -inl
  22.  
  23. namespace Outline
  24. {
  25. //-- type declarations -------------------------------------------------------
  26. class __declspec(delphiclass) OutlineError;
  27. class __declspec(pascalimplementation) OutlineError : public System::TObject
  28. {
  29.     typedef System::TObject inherited;
  30.     
  31. public:
  32.     /* TObject.Create */ __fastcall OutlineError(void) : System::TObject() { }
  33.     /* TObject.Destroy */ __fastcall virtual ~OutlineError(void) { }
  34.     
  35. };
  36.  
  37. class __declspec(delphiclass) EOutlineError;
  38. class __declspec(pascalimplementation) EOutlineError : public Sysutils::Exception
  39. {
  40.     typedef Sysutils::Exception inherited;
  41.     
  42. public:
  43.     /* Exception.Create */ __fastcall EOutlineError(const System::AnsiString Msg) : Sysutils::Exception(
  44.         Msg) { }
  45.     /* Exception.CreateFmt */ __fastcall EOutlineError(const System::AnsiString Msg, const System::TVarRec 
  46.         *Args, const int Args_Size) : Sysutils::Exception(Msg, Args, Args_Size) { }
  47.     /* Exception.CreateRes */ __fastcall EOutlineError(int Ident) : Sysutils::Exception(Ident) { }
  48.     /* Exception.CreateResFmt */ __fastcall EOutlineError(int Ident, const System::TVarRec *Args, const 
  49.         int Args_Size) : Sysutils::Exception(Ident, Args, Args_Size) { }
  50.     /* Exception.CreateHelp */ __fastcall EOutlineError(const System::AnsiString Msg, int AHelpContext)
  51.          : Sysutils::Exception(Msg, AHelpContext) { }
  52.     /* Exception.CreateFmtHelp */ __fastcall EOutlineError(const System::AnsiString Msg, const System::TVarRec 
  53.         *Args, const int Args_Size, int AHelpContext) : Sysutils::Exception(Msg, Args, Args_Size, AHelpContext
  54.         ) { }
  55.     /* Exception.CreateResHelp */ __fastcall EOutlineError(int Ident, int AHelpContext) : Sysutils::Exception(
  56.         Ident, AHelpContext) { }
  57.     /* Exception.CreateResFmtHelp */ __fastcall EOutlineError(int Ident, const System::TVarRec *Args, const 
  58.         int Args_Size, int AHelpContext) : Sysutils::Exception(Ident, Args, Args_Size, AHelpContext) { }
  59.     
  60. public:
  61.     /* TObject.Destroy */ __fastcall virtual ~EOutlineError(void) { }
  62.     
  63. };
  64.  
  65. enum TOutlineNodeCompare { ocLess, ocSame, ocGreater, ocInvalid };
  66.  
  67. enum TAttachMode { oaAdd, oaAddChild, oaInsert };
  68.  
  69. typedef Shortint TChangeRange;
  70.  
  71. class __declspec(delphiclass) TOutlineNode;
  72. class __declspec(delphiclass) TCustomOutline;
  73. enum TOutlineBitmap { obPlus, obMinus, obOpen, obClose, obLeaf };
  74.  
  75. typedef Set<TOutlineBitmap, obPlus, obLeaf>  TOutlineBitmaps;
  76.  
  77. typedef Graphics::TBitmap* TBitmapArray[5];
  78.  
  79. typedef void __fastcall (__closure *EOutlineChange)(System::TObject* Sender, long Index);
  80.  
  81. enum TOutlineStyle { osText, osPlusMinusText, osPictureText, osPlusMinusPictureText, osTreeText, osTreePictureText 
  82.     };
  83.  
  84. enum TOutlineType { otStandard, otOwnerDraw };
  85.  
  86. enum TOutlineOption { ooDrawTreeRoot, ooDrawFocusRect, ooStretchBitmaps };
  87.  
  88. typedef Set<TOutlineOption, ooDrawTreeRoot, ooStretchBitmaps>  TOutlineOptions;
  89.  
  90. class __declspec(pascalimplementation) TCustomOutline : public Grids::TCustomGrid
  91. {
  92.     typedef Grids::TCustomGrid inherited;
  93.     
  94. private:
  95.     bool FBlockInsert;
  96.     TOutlineNode* FRootNode;
  97.     TOutlineNode* FGoodNode;
  98.     int UpdateCount;
  99.     TOutlineNode* FCurItem;
  100.     System::AnsiString FSeparator;
  101.     int FFontSize;
  102.     Classes::TStrings* FStrings;
  103.     TOutlineBitmaps FUserBitmaps;
  104.     TOutlineBitmaps FOldBitmaps;
  105.     Graphics::TBitmap* FPictures[5];
  106.     EOutlineChange FOnExpand;
  107.     EOutlineChange FOnCollapse;
  108.     TOutlineStyle FOutlineStyle;
  109.     Graphics::TColor FMaskColor;
  110.     int FItemHeight;
  111.     TOutlineType FStyle;
  112.     TOutlineOptions FOptions;
  113.     bool FIgnoreScrollResize;
  114.     TOutlineNode* FSelectedItem;
  115.     Stdctrls::TDrawItemEvent FOnDrawItem;
  116.     bool FSettingWidth;
  117.     bool FSettingHeight;
  118.     HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
  119.     long __fastcall GetItemCount(void);
  120.     long __fastcall AttachNode(long Index,  System::AnsiString Str, void * Ptr, TAttachMode AttachMode)
  121.         ;
  122.     TOutlineNode* __fastcall Get(long Index);
  123.     long __fastcall GetSelectedItem(void);
  124.     void __fastcall SetSelectedItem(long Value);
  125.     TOutlineNodeCompare __fastcall CompareNodes(TOutlineNode* Value1, TOutlineNode* Value2);
  126.     void __fastcall Error(int ErrorStringID);
  127.     HIDESBASE MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
  128.     bool __fastcall ResizeGrid(void);
  129.     void __fastcall DoExpand(TOutlineNode* Node);
  130.     void __fastcall Init(void);
  131.     void __fastcall MoveNode(long Destination, long Source, TAttachMode AttachMode);
  132.     void __fastcall ClearBitmap(Graphics::TBitmap* &Bitmap, TOutlineBitmap Kind);
  133.     void __fastcall ChangeBitmap(Graphics::TBitmap* Value, TOutlineBitmap Kind);
  134.     void __fastcall SetRowHeight(void);
  135.     void __fastcall SetCurItem(long Value);
  136.     void __fastcall CreateGlyph(void);
  137.     void __fastcall SetStrings(Classes::TStrings* Value);
  138.     Classes::TStrings* __fastcall GetStrings(void);
  139.     bool __fastcall IsCurItem(long Value);
  140.     void __fastcall SetPicture(int Index, Graphics::TBitmap* Value);
  141.     Graphics::TBitmap* __fastcall GetPicture(int Index);
  142.     void __fastcall DrawPictures(Graphics::TBitmap* const *BitMaps, const int BitMaps_Size, const Windows::TRect 
  143.         &ARect);
  144.     void __fastcall DrawText(TOutlineNode* Node, const Windows::TRect &Rect);
  145.     void __fastcall SetOutlineStyle(TOutlineStyle Value);
  146.     void __fastcall DrawTree(const Windows::TRect &ARect, TOutlineNode* Node);
  147.     void __fastcall SetMaskColor(Graphics::TColor Value);
  148.     void __fastcall SetItemHeight(int Value);
  149.     void __fastcall SetStyle(TOutlineType Value);
  150.     void __fastcall SetOutlineOptions(TOutlineOptions Value);
  151.     bool __fastcall StoreBitmap(int Index);
  152.     void __fastcall ReadBinaryData(Classes::TStream* Stream);
  153.     void __fastcall WriteBinaryData(Classes::TStream* Stream);
  154.     void __fastcall SetHorzScrollBar(void);
  155.     void __fastcall ResetSelectedItem(void);
  156.     void __fastcall SetRowFromNode(TOutlineNode* Node);
  157.     
  158. protected:
  159.     virtual void __fastcall Loaded(void);
  160.     virtual void __fastcall Click(void);
  161.     virtual void __fastcall KeyDown(Word &Key, Classes::TShiftState Shift);
  162.     virtual void __fastcall KeyPress(char &Key);
  163.     TOutlineNode* __fastcall SetGoodIndex(TOutlineNode* Value);
  164.     virtual void __fastcall DrawCell(long ACol, long ARow, const Windows::TRect &ARect, Grids::TGridDrawState 
  165.         AState);
  166.     virtual void __fastcall DblClick(void);
  167.     void __fastcall SetLevel(TOutlineNode* Node, Cardinal CurLevel, Cardinal NewLevel);
  168.     bool __fastcall BadIndex(TOutlineNode* Value);
  169.     void __fastcall DeleteNode(TOutlineNode* Node, long CurIndex);
  170.     virtual void __fastcall Expand(long Index);
  171.     virtual void __fastcall Collapse(long Index);
  172.     virtual void __fastcall DefineProperties(Classes::TFiler* Filer);
  173.     virtual void __fastcall MouseDown(Controls::TMouseButton Button, Classes::TShiftState Shift, int X, 
  174.         int Y);
  175.     void __fastcall Move(long Destination, long Source, TAttachMode AttachMode);
  176.     void __fastcall SetDisplayWidth(int Value);
  177.     __property Classes::TStrings* Lines = {read=GetStrings, write=SetStrings, nodefault};
  178.     __property TOutlineStyle OutlineStyle = {read=FOutlineStyle, write=SetOutlineStyle, default=5};
  179.     __property EOutlineChange OnExpand = {read=FOnExpand, write=FOnExpand};
  180.     __property EOutlineChange OnCollapse = {read=FOnCollapse, write=FOnCollapse};
  181.     __property TOutlineOptions Options = {read=FOptions, write=SetOutlineOptions, default=3};
  182.     __property TOutlineType Style = {read=FStyle, write=SetStyle, default=0};
  183.     __property int ItemHeight = {read=FItemHeight, write=SetItemHeight, nodefault};
  184.     __property Stdctrls::TDrawItemEvent OnDrawItem = {read=FOnDrawItem, write=FOnDrawItem};
  185.     __property System::AnsiString ItemSeparator = {read=FSeparator, write=FSeparator, nodefault};
  186.     __property Graphics::TBitmap* PicturePlus = {read=GetPicture, write=SetPicture, stored=StoreBitmap, 
  187.         index=0, nodefault};
  188.     __property Graphics::TBitmap* PictureMinus = {read=GetPicture, write=SetPicture, stored=StoreBitmap
  189.         , index=1, nodefault};
  190.     __property Graphics::TBitmap* PictureOpen = {read=GetPicture, write=SetPicture, stored=StoreBitmap, 
  191.         index=2, nodefault};
  192.     __property Graphics::TBitmap* PictureClosed = {read=GetPicture, write=SetPicture, stored=StoreBitmap
  193.         , index=3, nodefault};
  194.     __property Graphics::TBitmap* PictureLeaf = {read=GetPicture, write=SetPicture, stored=StoreBitmap, 
  195.         index=4, nodefault};
  196.     
  197. public:
  198.     __fastcall virtual TCustomOutline(Classes::TComponent* AOwner);
  199.     __fastcall virtual ~TCustomOutline(void);
  200.     long __fastcall Add(long Index, const System::AnsiString Text);
  201.     long __fastcall AddChild(long Index, const System::AnsiString Text);
  202.     long __fastcall AddChildObject(long Index, const System::AnsiString Text, void * const Data);
  203.     long __fastcall AddObject(long Index, const System::AnsiString Text, void * const Data);
  204.     HIDESBASE long __fastcall Insert(long Index, const System::AnsiString Text);
  205.     long __fastcall InsertObject(long Index, const System::AnsiString Text, void * const Data);
  206.     void __fastcall Delete(long Index);
  207.     long __fastcall GetDataItem(void * Value);
  208.     long __fastcall GetItem(int X, int Y);
  209.     int __fastcall GetNodeDisplayWidth(TOutlineNode* Node);
  210.     long __fastcall GetTextItem(const System::AnsiString Value);
  211.     TOutlineNode* __fastcall GetVisibleNode(long Index);
  212.     void __fastcall FullExpand(void);
  213.     void __fastcall FullCollapse(void);
  214.     void __fastcall LoadFromFile(const System::AnsiString FileName);
  215.     void __fastcall LoadFromStream(Classes::TStream* Stream);
  216.     void __fastcall SaveToFile(const System::AnsiString FileName);
  217.     void __fastcall SaveToStream(Classes::TStream* Stream);
  218.     void __fastcall BeginUpdate(void);
  219.     void __fastcall EndUpdate(void);
  220.     void __fastcall SetUpdateState(bool Value);
  221.     void __fastcall Clear(void);
  222.     __property long ItemCount = {read=GetItemCount, nodefault};
  223.     __property TOutlineNode* Items[long Index] = {read=Get/*, default*/};
  224.     __property long SelectedItem = {read=GetSelectedItem, write=SetSelectedItem, nodefault};
  225.     __property Row ;
  226.     __property Canvas ;
  227. public:
  228.     /* TWinControl.CreateParented */ __fastcall TCustomOutline(HWND ParentWindow) : Grids::TCustomGrid(
  229.         ParentWindow) { }
  230.     
  231. };
  232.  
  233. class __declspec(pascalimplementation) TOutlineNode : public Classes::TPersistent
  234. {
  235.     typedef Classes::TPersistent inherited;
  236.     
  237. private:
  238.     Classes::TList* FList;
  239.     System::AnsiString FText;
  240.     void *FData;
  241.     TOutlineNode* FParent;
  242.     long FIndex;
  243.     bool FState;
  244.     TCustomOutline* FOutline;
  245.     long FExpandCount;
  246.     void __fastcall ChangeExpandedCount(long Value);
  247.     void __fastcall CloseNode(void);
  248.     void __fastcall Clear(void);
  249.     void __fastcall Error(int ErrorStringID);
  250.     long __fastcall GetExpandedNodeCount(void);
  251.     System::AnsiString __fastcall GetFullPath(void);
  252.     long __fastcall GetIndex(void);
  253.     long __fastcall GetLastIndex(void);
  254.     Cardinal __fastcall GetLevel(void);
  255.     Classes::TList* __fastcall GetList(void);
  256.     Cardinal __fastcall GetMaxDisplayWidth(Cardinal Value);
  257.     TOutlineNode* __fastcall GetNode(long Index);
  258.     long __fastcall GetTopItem(void);
  259.     TOutlineNode* __fastcall GetVisibleParent(void);
  260.     bool __fastcall HasChildren(void);
  261.     bool __fastcall HasVisibleParent(void);
  262.     bool __fastcall IsEqual(TOutlineNode* Value);
  263.     void __fastcall ReIndex(TOutlineNode* StartNode, TOutlineNode* EndNode, long NewIndex, bool IncludeStart
  264.         );
  265.     void __fastcall Repaint(void);
  266.     bool __fastcall Resync(long &NewIndex, TOutlineNode* EndNode);
  267.     void __fastcall SetExpandedState(bool Value);
  268.     void __fastcall SetGoodIndex(void);
  269.     void __fastcall SetHorzScrollBar(void);
  270.     void __fastcall SetLevel(Cardinal Level);
  271.     void __fastcall SetText(const System::AnsiString Value);
  272.     
  273. protected:
  274.     __fastcall TOutlineNode(TCustomOutline* AOwner);
  275.     __fastcall virtual ~TOutlineNode(void);
  276.     TOutlineNode* __fastcall GetVisibleNode(long TargetCount);
  277.     long __fastcall AddNode(TOutlineNode* Value);
  278.     long __fastcall InsertNode(long Index, TOutlineNode* Value);
  279.     TOutlineNode* __fastcall GetNodeAtIndex(long TargetIndex);
  280.     long __fastcall GetDataItem(void * Value);
  281.     long __fastcall GetTextItem(const System::AnsiString Value);
  282.     bool __fastcall HasAsParent(TOutlineNode* Value);
  283.     bool __fastcall GetRowOfNode(TOutlineNode* TargetNode, long &RowCount);
  284.     void __fastcall InternalRemove(TOutlineNode* Value, int Index);
  285.     void __fastcall Remove(TOutlineNode* Value);
  286.     void __fastcall WriteNode(char * Buffer, Classes::TStream* Stream);
  287.     __property TCustomOutline* Outline = {read=FOutline, nodefault};
  288.     __property Classes::TList* List = {read=GetList, nodefault};
  289.     __property long ExpandCount = {read=FExpandCount, nodefault};
  290.     __property TOutlineNode* Items[long Index] = {read=GetNode/*, default*/};
  291.     
  292. public:
  293.     void __fastcall ChangeLevelBy(TChangeRange Value);
  294.     void __fastcall Collapse(void);
  295.     void __fastcall Expand(void);
  296.     void __fastcall FullExpand(void);
  297.     int __fastcall GetDisplayWidth(void);
  298.     long __fastcall getFirstChild(void);
  299.     long __fastcall GetLastChild(void);
  300.     long __fastcall GetNextChild(long Value);
  301.     long __fastcall GetPrevChild(long Value);
  302.     void __fastcall MoveTo(long Destination, TAttachMode AttachMode);
  303.     __property TOutlineNode* Parent = {read=FParent, nodefault};
  304.     __property bool Expanded = {read=FState, write=SetExpandedState, nodefault};
  305.     __property System::AnsiString Text = {read=FText, write=SetText, nodefault};
  306.     __property void * Data = {read=FData, write=FData, nodefault};
  307.     __property long Index = {read=GetIndex, nodefault};
  308.     __property Cardinal Level = {read=GetLevel, write=SetLevel, nodefault};
  309.     __property bool HasItems = {read=HasChildren, nodefault};
  310.     __property bool IsVisible = {read=HasVisibleParent, nodefault};
  311.     __property long TopItem = {read=GetTopItem, nodefault};
  312.     __property System::AnsiString FullPath = {read=GetFullPath, nodefault};
  313. };
  314.  
  315. typedef Shortint TBitmapArrayRange;
  316.  
  317. class __declspec(delphiclass) TOutline;
  318. class __declspec(pascalimplementation) TOutline : public TCustomOutline
  319. {
  320.     typedef TCustomOutline inherited;
  321.     
  322. __published:
  323.     __property Lines ;
  324.     __property OutlineStyle ;
  325.     __property OnExpand ;
  326.     __property OnCollapse ;
  327.     __property Options ;
  328.     __property Style ;
  329.     __property ItemHeight ;
  330.     __property OnDrawItem ;
  331.     __property Align ;
  332.     __property Enabled ;
  333.     __property Font ;
  334.     __property Color ;
  335.     __property ParentColor ;
  336.     __property ParentCtl3D ;
  337.     __property Ctl3D ;
  338.     __property TabOrder ;
  339.     __property TabStop ;
  340.     __property Visible ;
  341.     __property OnClick ;
  342.     __property DragMode ;
  343.     __property DragCursor ;
  344.     __property OnDragDrop ;
  345.     __property OnDragOver ;
  346.     __property OnEndDrag ;
  347.     __property OnStartDrag ;
  348.     __property OnEnter ;
  349.     __property OnExit ;
  350.     __property OnMouseDown ;
  351.     __property OnMouseMove ;
  352.     __property OnMouseUp ;
  353.     __property OnDblClick ;
  354.     __property OnKeyDown ;
  355.     __property OnKeyPress ;
  356.     __property OnKeyUp ;
  357.     __property BorderStyle ;
  358.     __property ItemSeparator ;
  359.     __property PicturePlus ;
  360.     __property PictureMinus ;
  361.     __property PictureOpen ;
  362.     __property PictureClosed ;
  363.     __property PictureLeaf ;
  364.     __property ParentFont ;
  365.     __property ParentShowHint ;
  366.     __property ShowHint ;
  367.     __property PopupMenu ;
  368.     __property ScrollBars ;
  369. public:
  370.     /* TCustomOutline.Create */ __fastcall virtual TOutline(Classes::TComponent* AOwner) : Outline::TCustomOutline(
  371.         AOwner) { }
  372.     /* TCustomOutline.Destroy */ __fastcall virtual ~TOutline(void) { }
  373.     
  374. public:
  375.     /* TWinControl.CreateParented */ __fastcall TOutline(HWND ParentWindow) : Outline::TCustomOutline(ParentWindow
  376.         ) { }
  377.     
  378. };
  379.  
  380. //-- var, const, procedure ---------------------------------------------------
  381. //-- template instantiations -------------------------------------------------
  382. template class TOutlineOptions ;
  383. template class TOutlineBitmaps ;
  384.  
  385. }    /* namespace Outline */
  386.  
  387. #pragma warn .par
  388. #pragma warn .hid 
  389. #pragma warn .inl
  390.  
  391. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  392. using namespace Outline;
  393. #endif
  394. //-- end unit ----------------------------------------------------------------
  395. #endif    // Outline
  396.