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

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