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

  1. //----------------------------------------------------------------------------
  2. // DBLookup.hpp - dcc32 generated hdr (DO NOT EDIT) rev: -2
  3. // From: DBLookup.pas
  4. //----------------------------------------------------------------------------
  5. #ifndef DBLookupHPP
  6. #define DBLookupHPP
  7. //----------------------------------------------------------------------------
  8. #ifndef GridsHPP
  9. #include <Grids.hpp>
  10. #endif
  11.  
  12. #ifndef DBTablesHPP
  13. #include <DBTables.hpp>
  14. #endif
  15.  
  16. #ifndef DBGridsHPP
  17. #include <DBGrids.hpp>
  18. #endif
  19.  
  20. #ifndef ButtonsHPP
  21. #include <Buttons.hpp>
  22. #endif
  23.  
  24. #ifndef MenusHPP
  25. #include <Menus.hpp>
  26. #endif
  27.  
  28. #ifndef GraphicsHPP
  29. #include <Graphics.hpp>
  30. #endif
  31.  
  32. #ifndef FormsHPP
  33. #include <Forms.hpp>
  34. #endif
  35.  
  36. #ifndef SysUtilsHPP
  37. #include <SysUtils.hpp>
  38. #endif
  39.  
  40. #ifndef MessagesHPP
  41. #include <Messages.hpp>
  42. #endif
  43.  
  44. #ifndef ControlsHPP
  45. #include <Controls.hpp>
  46. #endif
  47.  
  48. #ifndef DBHPP
  49. #include <DB.hpp>
  50. #endif
  51.  
  52. #ifndef StdCtrlsHPP
  53. #include <StdCtrls.hpp>
  54. #endif
  55.  
  56. #ifndef ClassesHPP
  57. #include <Classes.hpp>
  58. #endif
  59.  
  60. #ifndef WindowsHPP
  61. #include <Windows.hpp>
  62. #endif
  63.  
  64. #ifndef SystemHPP
  65. #include <System.hpp>
  66. #endif
  67.  
  68. namespace Dblookup
  69. {
  70. //-- type declarations -------------------------------------------------------
  71. enum TDBLookupComboStyle { csDropDown, csDropDownList };
  72.  
  73. enum TDBLookupListOption { loColLines, loRowLines, loTitles };
  74.  
  75. typedef Set<TDBLookupListOption, loColLines, loTitles>  TDBLookupListOptions;
  76.  
  77. class __declspec(delphiclass) TDBLookupCombo;
  78. class __declspec(delphiclass) TPopupGrid;
  79. class __declspec(delphiclass) TDBLookupList;
  80. class __declspec(pascalimplementation) TDBLookupList : public Dbgrids::TCustomDBGrid
  81. {
  82.     typedef TDBLookupList ThisClass;
  83.     typedef Dbgrids::TCustomDBGrid inherited;
  84.     
  85. private:
  86.     Dbtables::TFieldDataLink *FFieldLink;
  87.     System::AnsiString FLookupDisplay;
  88.     System::AnsiString FLookupField;
  89.     Db::TField *FDisplayFld;
  90.     Db::TField *FValueFld;
  91.     System::AnsiString FValue;
  92.     System::AnsiString FDisplayValue;
  93.     System::Integer FHiliteRow;
  94.     TDBLookupListOptions FOptions;
  95.     System::Integer FTitleOffset;
  96.     System::Boolean FFoundValue;
  97.     System::Boolean FInCellSelect;
  98.     Classes::TNotifyEvent FOnListClick;
  99.     System::AnsiString __fastcall GetDataField(void);
  100.     Db::TDataSource *__fastcall GetDataSource(void);
  101.     Db::TDataSource *__fastcall GetLookupSource(void);
  102.     System::Boolean __fastcall GetReadOnly(void);
  103.     void __fastcall FieldLinkActive(System::TObject *Sender);
  104.     void __fastcall DataChange(System::TObject *Sender);
  105.     void __fastcall SetDataField(const System::AnsiString Value);
  106.     void __fastcall SetDataSource(Db::TDataSource *Value);
  107.     void __fastcall SetLookupSource(Db::TDataSource *Value);
  108.     void __fastcall SetLookupDisplay(const System::AnsiString Value);
  109.     void __fastcall SetLookupField(const System::AnsiString Value);
  110.     void __fastcall SetValue(const System::AnsiString Value);
  111.     void __fastcall SetDisplayValue(const System::AnsiString Value);
  112.     void __fastcall SetReadOnly(System::Boolean Value);
  113.     void __fastcall SetOptions( TDBLookupListOptions Value);
  114.     void __fastcall UpdateData(System::TObject *Sender);
  115.     void __fastcall NewLayout(void);
  116.     void __fastcall DoLookup(void);
  117.     MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
  118.     MESSAGE void __fastcall CMEnter(Messages::TWMNoParams &Message);
  119.     MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message);
  120.     
  121. protected:
  122.     virtual System::Boolean __fastcall HighlightCell(System::Integer DataCol, System::Integer DataRow, 
  123.         const System::AnsiString Value,  Grids::TGridDrawState AState);
  124.     virtual System::Boolean __fastcall CanGridAcceptKey(System::Word Key,  Classes::TShiftState Shift);
  125.         
  126.     virtual void __fastcall DefineFieldMap(void);
  127.     virtual void __fastcall SetColumnAttributes(void);
  128.     virtual void __fastcall MouseDown(Controls::TMouseButton Button,  Classes::TShiftState Shift, System::Integer 
  129.         X, System::Integer Y);
  130.     virtual void __fastcall MouseMove( Classes::TShiftState Shift, System::Integer X, System::Integer Y
  131.         );
  132.     virtual void __fastcall MouseUp(Controls::TMouseButton Button,  Classes::TShiftState Shift, System::Integer 
  133.         X, System::Integer Y);
  134.     virtual System::Boolean __fastcall CanEdit(void);
  135.     void __fastcall InitFields(System::Boolean ShowError);
  136.     virtual void __fastcall CreateWnd(void);
  137.     virtual void __fastcall KeyDown(System::Word &Key,  Classes::TShiftState Shift);
  138.     virtual void __fastcall KeyPress(System::Char &Key);
  139.     virtual void __fastcall LinkActive(System::Boolean Value);
  140.     virtual void __fastcall Paint(void);
  141.     virtual void __fastcall Scroll(System::Integer Distance);
  142.     virtual void __fastcall ListClick(void);
  143.     virtual void __fastcall Loaded(void);
  144.     virtual void __fastcall Notification(Classes::TComponent *AComponent, Classes::TOperation Operation
  145.         );
  146.     
  147. public:
  148.     __fastcall virtual TDBLookupList(Classes::TComponent *AOwner);
  149.     __fastcall virtual ~TDBLookupList(void);
  150.     __property System::AnsiString Value = {read=FValue, write=SetValue, nodefault};
  151.     __property System::AnsiString DisplayValue = {read=FDisplayValue, write=SetDisplayValue, nodefault}
  152.         ;
  153.     
  154. __published:
  155.     __property System::AnsiString DataField = {read=GetDataField, write=SetDataField, nodefault};
  156.     __property Db::TDataSource * DataSource = {read=GetDataSource, write=SetDataSource, nodefault};
  157.     __property Db::TDataSource * LookupSource = {read=GetLookupSource, write=SetLookupSource, nodefault
  158.         };
  159.     __property System::AnsiString LookupDisplay = {read=FLookupDisplay, write=SetLookupDisplay, nodefault
  160.         };
  161.     __property System::AnsiString LookupField = {read=FLookupField, write=SetLookupField, nodefault};
  162.     __property TDBLookupListOptions Options = {read=FOptions, write=SetOptions, default=0};
  163.     __property Classes::TNotifyEvent OnClick = {read=FOnListClick, write=FOnListClick};
  164.     __property System::Boolean ReadOnly = {read=GetReadOnly, write=SetReadOnly, default=0};
  165.     __property Align ;
  166.     __property BorderStyle ;
  167.     __property Color ;
  168.     __property Ctl3D ;
  169.     __property DragCursor ;
  170.     __property DragMode ;
  171.     __property Enabled ;
  172.     __property Font ;
  173.     __property ParentColor ;
  174.     __property ParentCtl3D ;
  175.     __property ParentFont ;
  176.     __property ParentShowHint ;
  177.     __property PopupMenu ;
  178.     __property ShowHint ;
  179.     __property TabOrder ;
  180.     __property TabStop ;
  181.     __property Visible ;
  182.     __property OnDblClick ;
  183.     __property OnDragDrop ;
  184.     __property OnDragOver ;
  185.     __property OnEndDrag ;
  186.     __property OnEnter ;
  187.     __property OnExit ;
  188.     __property OnKeyDown ;
  189.     __property OnKeyPress ;
  190.     __property OnKeyUp ;
  191.     __property OnStartDrag ;
  192. };
  193.  
  194. class __declspec(pascalimplementation) TPopupGrid : public TDBLookupList
  195. {
  196.     typedef TPopupGrid ThisClass;
  197.     typedef TDBLookupList inherited;
  198.     
  199. private:
  200.     TDBLookupCombo *FCombo;
  201.     MESSAGE void __fastcall CMHintShow(Messages::TMessage &Message);
  202.     
  203. protected:
  204.     virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
  205.     virtual void __fastcall CreateWnd(void);
  206.     MESSAGE void __fastcall WMLButtonUp(Messages::TWMMouse &Message);
  207.     virtual void __fastcall MouseDown(Controls::TMouseButton Button,  Classes::TShiftState Shift, System::Integer 
  208.         X, System::Integer Y);
  209.     virtual System::Boolean __fastcall CanEdit(void);
  210.     virtual void __fastcall LinkActive(System::Boolean Value);
  211.     
  212. public:
  213.     __property RowCount ;
  214.     __fastcall virtual TPopupGrid(Classes::TComponent *AOwner);
  215. public:
  216.     /* !! TDBLookupList.Destroy */ __fastcall virtual ~TPopupGrid(void) { }
  217.     
  218. };
  219.  
  220. class __declspec(pascalimplementation) TDBLookupCombo : public Stdctrls::TCustomEdit
  221. {
  222.     typedef TDBLookupCombo ThisClass;
  223.     typedef Stdctrls::TCustomEdit inherited;
  224.     
  225. private:
  226.     Controls::TControlCanvas *FCanvas;
  227.     System::Integer FDropDownCount;
  228.     System::Integer FDropDownWidth;
  229.     System::Integer FTextMargin;
  230.     Dbtables::TFieldDataLink *FFieldLink;
  231.     TPopupGrid *FGrid;
  232.     Buttons::TSpeedButton *FButton;
  233.     Controls::TWinControl *FBtnControl;
  234.     TDBLookupComboStyle FStyle;
  235.     Classes::TNotifyEvent FOnDropDown;
  236.     System::AnsiString __fastcall GetDataField(void);
  237.     Db::TDataSource *__fastcall GetDataSource(void);
  238.     Db::TDataSource *__fastcall GetLookupSource(void);
  239.     System::AnsiString __fastcall GetLookupDisplay(void);
  240.     System::AnsiString __fastcall GetLookupField(void);
  241.     System::Boolean __fastcall GetReadOnly(void);
  242.     System::AnsiString __fastcall GetValue(void);
  243.     System::AnsiString __fastcall GetDisplayValue(void);
  244.     System::Integer __fastcall GetMinHeight(void);
  245.     TDBLookupListOptions __fastcall GetOptions(void);
  246.     System::Boolean __fastcall CanEdit(void);
  247.     System::Boolean __fastcall Editable(void);
  248.     void __fastcall SetValue(const System::AnsiString NewValue);
  249.     void __fastcall SetDisplayValue(const System::AnsiString NewValue);
  250.     void __fastcall DataChange(System::TObject *Sender);
  251.     void __fastcall EditingChange(System::TObject *Sender);
  252.     void __fastcall SetDataField(const System::AnsiString Value);
  253.     void __fastcall SetDataSource(Db::TDataSource *Value);
  254.     void __fastcall SetLookupSource(Db::TDataSource *Value);
  255.     void __fastcall SetLookupDisplay(const System::AnsiString Value);
  256.     void __fastcall SetLookupField(const System::AnsiString Value);
  257.     void __fastcall SetReadOnly(System::Boolean Value);
  258.     void __fastcall SetOptions( TDBLookupListOptions Value);
  259.     void __fastcall SetStyle(TDBLookupComboStyle Value);
  260.     void __fastcall UpdateData(System::TObject *Sender);
  261.     void __fastcall FieldLinkActive(System::TObject *Sender);
  262.     void __fastcall NonEditMouseDown(Messages::TWMMouse &Message);
  263.     void __fastcall DoSelectAll(void);
  264.     void __fastcall SetEditRect(void);
  265.     MESSAGE void __fastcall WMPaste(Messages::TMessage &Message);
  266.     MESSAGE void __fastcall WMCut(Messages::TMessage &Message);
  267.     MESSAGE void __fastcall WMKillFocus(Messages::TWMKillFocus &Message);
  268.     MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
  269.     MESSAGE void __fastcall CMCancelMode(Controls::TCMCancelMode &Message);
  270.     MESSAGE void __fastcall CMExit(Messages::TWMNoParams &Message);
  271.     MESSAGE void __fastcall WMLButtonDown(Messages::TWMMouse &Message);
  272.     MESSAGE void __fastcall WMLButtonDblClk(Messages::TWMMouse &Message);
  273.     MESSAGE void __fastcall WMLButtonUp(Messages::TWMMouse &Message);
  274.     MESSAGE void __fastcall WMSetFocus(Messages::TWMSetFocus &Message);
  275.     MESSAGE void __fastcall CMEnter(Messages::TWMNoParams &Message);
  276.     MESSAGE void __fastcall CMHintShow(Messages::TMessage &Message);
  277.     MESSAGE void __fastcall WMPaint(Messages::TWMPaint &Message);
  278.     MESSAGE void __fastcall CMFontChanged(Messages::TMessage &Message);
  279.     MESSAGE void __fastcall CMEnabledChanged(Messages::TMessage &Message);
  280.     
  281. protected:
  282.     virtual void __fastcall Notification(Classes::TComponent *AComponent, Classes::TOperation Operation
  283.         );
  284.     virtual void __fastcall Change(void);
  285.     virtual void __fastcall MouseMove( Classes::TShiftState Shift, System::Integer X, System::Integer Y
  286.         );
  287.     virtual void __fastcall KeyDown(System::Word &Key,  Classes::TShiftState Shift);
  288.     virtual void __fastcall KeyPress(System::Char &Key);
  289.     virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
  290.     virtual void __fastcall CreateWnd(void);
  291.     void __fastcall GridClick(System::TObject *Sender);
  292.     virtual void __fastcall Loaded(void);
  293.     
  294. public:
  295.     __fastcall virtual TDBLookupCombo(Classes::TComponent *AOwner);
  296.     __fastcall virtual ~TDBLookupCombo(void);
  297.     virtual void __fastcall DropDown(void);
  298.     virtual void __fastcall CloseUp(void);
  299.     __property System::AnsiString Value = {read=GetValue, write=SetValue, nodefault};
  300.     __property System::AnsiString DisplayValue = {read=GetDisplayValue, write=SetDisplayValue, nodefault
  301.         };
  302.     
  303. __published:
  304.     __property System::AnsiString DataField = {read=GetDataField, write=SetDataField, nodefault};
  305.     __property Db::TDataSource * DataSource = {read=GetDataSource, write=SetDataSource, nodefault};
  306.     __property Db::TDataSource * LookupSource = {read=GetLookupSource, write=SetLookupSource, nodefault
  307.         };
  308.     __property System::AnsiString LookupDisplay = {read=GetLookupDisplay, write=SetLookupDisplay, nodefault
  309.         };
  310.     __property System::AnsiString LookupField = {read=GetLookupField, write=SetLookupField, nodefault};
  311.         
  312.     __property TDBLookupListOptions Options = {read=GetOptions, write=SetOptions, default=0};
  313.     __property TDBLookupComboStyle Style = {read=FStyle, write=SetStyle, default=0};
  314.     __property AutoSelect ;
  315.     __property Color ;
  316.     __property Ctl3D ;
  317.     __property DragCursor ;
  318.     __property DragMode ;
  319.     __property System::Integer DropDownCount = {read=FDropDownCount, write=FDropDownCount, default=8};
  320.     __property System::Integer DropDownWidth = {read=FDropDownWidth, write=FDropDownWidth, default=0};
  321.     __property Enabled ;
  322.     __property Font ;
  323.     __property ImeMode ;
  324.     __property MaxLength ;
  325.     __property ParentColor ;
  326.     __property ParentCtl3D ;
  327.     __property ParentFont ;
  328.     __property ParentShowHint ;
  329.     __property PopupMenu ;
  330.     __property System::Boolean ReadOnly = {read=GetReadOnly, write=SetReadOnly, default=0};
  331.     __property ShowHint ;
  332.     __property TabOrder ;
  333.     __property TabStop ;
  334.     __property Visible ;
  335.     __property OnChange ;
  336.     __property OnClick ;
  337.     __property OnDblClick ;
  338.     __property OnDragDrop ;
  339.     __property OnDragOver ;
  340.     __property Classes::TNotifyEvent OnDropDown = {read=FOnDropDown, write=FOnDropDown};
  341.     __property OnEndDrag ;
  342.     __property OnEnter ;
  343.     __property OnExit ;
  344.     __property OnKeyDown ;
  345.     __property OnKeyPress ;
  346.     __property OnKeyUp ;
  347.     __property OnMouseDown ;
  348.     __property OnMouseMove ;
  349.     __property OnMouseUp ;
  350.     __property OnStartDrag ;
  351. };
  352.  
  353. class __declspec(delphiclass) TComboButton;
  354. class __declspec(pascalimplementation) TComboButton : public Buttons::TSpeedButton
  355. {
  356.     typedef TComboButton ThisClass;
  357.     typedef Buttons::TSpeedButton inherited;
  358.     
  359. protected:
  360.     virtual void __fastcall MouseMove( Classes::TShiftState Shift, System::Integer X, System::Integer Y
  361.         );
  362.     virtual void __fastcall MouseDown(Controls::TMouseButton Button,  Classes::TShiftState Shift, System::Integer 
  363.         X, System::Integer Y);
  364. public:
  365.     /* !! TSpeedButton.Create */ __fastcall virtual TComboButton(Classes::TComponent *AOwner) : Buttons::TSpeedButton(
  366.         AOwner) { }
  367.     /* !! TSpeedButton.Destroy */ __fastcall virtual ~TComboButton(void) { }
  368.     
  369. };
  370.  
  371. //-- var, const, procedure ---------------------------------------------------
  372. //-- template instantiations -------------------------------------------------
  373. template class TDBLookupListOptions ;
  374.  
  375. }    /* namespace Dblookup */
  376. #if !defined(NO_IMPLICIT_NAMESPACE_USE)
  377. using namespace Dblookup;
  378. #endif
  379. //-- end unit ----------------------------------------------------------------
  380. #endif    // DBLookup
  381.