home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / BC_502 / AWARE_H.PAK / DBMEMO.H < prev    next >
Encoding:
C/C++ Source or Header  |  1997-05-06  |  6.6 KB  |  208 lines

  1. //--------------------------------------------------------
  2. // DBMEMO.H generated from BDBCTL.VBX
  3. // Copyright (C) 1996 Borland International
  4. //--------------------------------------------------------
  5.  
  6. #if !defined(DBMEMO_H_)
  7. #define DBMEMO_H_
  8.  
  9. #include <vdbt/dbcontrl.h>
  10.  
  11. //--------------------------------------------------------
  12. // TDBMemo (VB3, subclassed from EDIT)
  13. //--------------------------------------------------------
  14.  
  15. class _DBAWARECLASS TDBMemo : public TDBControl {
  16.   DBPMECLASS( TDBMemo );
  17.  
  18.   // constructors
  19.   DECLARE_CONSTRUCTORS( TDBMemo );
  20.  
  21.   public:
  22.     // Properties
  23.     DECLARE_DB_PROP_RW2( TField, DataField );
  24.     DECLARE_DB_PROP_RW0( Bool,    DataChanged,    Prop_TDBMemo_DataChanged );
  25.     DECLARE_DB_PROP_RW0( COLORREF,ForeColor,      Prop_TDBMemo_ForeColor );
  26.     DECLARE_DB_PROP_RW0( COLORREF,BackColor,      Prop_TDBMemo_BackColor );
  27.     DECLARE_DB_PROP_RW2( string,  FontName );
  28.     DECLARE_DB_PROP_RW0( Bool,    FontBold,       Prop_TDBMemo_FontBold );
  29.     DECLARE_DB_PROP_RW0( Bool,    FontItalic,     Prop_TDBMemo_FontItalic );
  30.     DECLARE_DB_PROP_RW0( Bool,    FontStrikethru, Prop_TDBMemo_FontStrikethru );
  31.     DECLARE_DB_PROP_RW0( Bool,    FontUnderline,  Prop_TDBMemo_FontUnderline );
  32.     DECLARE_DB_PROP_RW0( float,   FontSize,       Prop_TDBMemo_FontSize );
  33.     DECLARE_DB_PROP_RW1( ENUM, TAlignment
  34.                              ,    Alignment,      Prop_TDBMemo_Alignment );
  35.     DECLARE_DB_PROP_RW0( Bool,    AutoDisplay,    Prop_TDBMemo_AutoDisplay );
  36.     DECLARE_DB_PROP_RW1( ENUM, TBorderStyle
  37.                              ,    BorderStyle,    Prop_TDBMemo_BorderStyle );
  38.     DECLARE_DB_PROP_RWS( TDBMemo, Lines );
  39.     DECLARE_DB_PROP_RW0( int,     MaxLength,      Prop_TDBMemo_MaxLength );
  40.     DECLARE_DB_PROP_RW0( Bool,    Modified,       Prop_TDBMemo_Modified );
  41.     DECLARE_DB_PROP_RW0( Bool,    ReadOnly,       Prop_TDBMemo_ReadOnly );
  42.     DECLARE_DB_PROP_RW1( ENUM, TScrollBars
  43.                              ,    ScrollBars,     Prop_TDBMemo_ScrollBars );
  44.     DECLARE_DB_PROP_RW0( int,     SelLength,      Prop_TDBMemo_SelLength );
  45.     DECLARE_DB_PROP_RW0( int,     SelStart,       Prop_TDBMemo_SelStart );
  46.     DECLARE_DB_PROP_RW2( string,  SelText );
  47.     DECLARE_DB_PROP_RW0( Bool,    WantReturns,    Prop_TDBMemo_WantReturns );
  48.     DECLARE_DB_PROP_RW0( Bool,    WantTabs,       Prop_TDBMemo_WantTabs );
  49.     DECLARE_DB_PROP_RW0( Bool,    WordWrap,       Prop_TDBMemo_WordWrap );
  50.  
  51.   public:
  52.     // Methods
  53.     void Clear();
  54.     void ClearSelection();
  55.     void CopyToClipboard();
  56.     void CutToClipboard();
  57.     int  GetSelTextBuf( LPSTR, int );
  58.     void LoadMemo();
  59.     void PasteFromClipboard();
  60.     void SelectAll();
  61.     void SetSelTextBuf( LPCSTR );
  62.  
  63.  
  64.   private:
  65.     void FireOnClick()
  66.     {
  67.       OnClickSource( *this );
  68.     }
  69.     void FireOnDragDrop( TVbxControl& Source, SHORT x, SHORT y )
  70.     {
  71.       OnDragDropSource( *this, Source, x, y );
  72.     }
  73.     void FireOnDragOver( TVbxControl& Source, SHORT x, SHORT y, TDragState State )
  74.     {
  75.       OnDragOverSource( *this, Source, x, y, State );
  76.     }
  77.     void FireOnEndDrag( TVbxControl& Source, SHORT x, SHORT y )
  78.     {
  79.       OnEndDragSource( *this, Source, x, y );
  80.     }
  81.     void FireOnChange()
  82.     {
  83.       OnChangeSource( *this );
  84.     }
  85.     void FireOnDblClick()
  86.     {
  87.       OnDblClickSource( *this );
  88.     }
  89.     void FireOnEnter()
  90.     {
  91.       OnEnterSource( *this );
  92.     }
  93.     void FireOnExit()
  94.     {
  95.       OnExitSource( *this );
  96.     }
  97.     void FireOnKeyDown( SHORT *Key, TShiftState State )
  98.     {
  99.       OnKeyDownSource( *this, Key, State );
  100.     }
  101.     void FireOnKeyPress( SHORT Key )
  102.     {
  103.       OnKeyPressSource( *this, Key );
  104.     }
  105.     void FireOnKeyUp( SHORT *Key, TShiftState State )
  106.     {
  107.       OnKeyUpSource( *this, Key, State );
  108.     }
  109.     void FireOnMouseDown( TMouseButton Button, TShiftState State, SHORT x, SHORT y )
  110.     {
  111.       OnMouseDownSource( *this, Button, State, x, y );
  112.     }
  113.     void FireOnMouseMove( TMouseButton Button, TShiftState State, SHORT x, SHORT y )
  114.     {
  115.       OnMouseMoveSource( *this, Button, State, x, y );
  116.     }
  117.     void FireOnMouseUp( TMouseButton Button, TShiftState State, SHORT x, SHORT y )
  118.     {
  119.       OnMouseUpSource( *this, Button, State, x, y );
  120.     }
  121.  
  122.   public:
  123.     // Event Source
  124.     DECLARE_SOURCE( OnClick,     TDBMemoNotify );
  125.     DECLARE_SOURCE( OnDragDrop,  TDBMemoDrag );
  126.     DECLARE_SOURCE( OnDragOver,  TDBMemoDragOver );
  127.     DECLARE_SOURCE( OnEndDrag,   TDBMemoDrag );
  128.     DECLARE_SOURCE( OnDblClick,  TDBMemoNotify );
  129.     DECLARE_SOURCE( OnChange,    TDBMemoNotify );
  130.     DECLARE_SOURCE( OnEnter,     TDBMemoNotify );
  131.     DECLARE_SOURCE( OnExit,      TDBMemoNotify );
  132.     DECLARE_SOURCE( OnKeyDown,   TDBMemoKey );
  133.     DECLARE_SOURCE( OnKeyPress,  TDBMemoKeyPress );
  134.     DECLARE_SOURCE( OnKeyUp,     TDBMemoKey );
  135.     DECLARE_SOURCE( OnMouseDown, TDBMemoMouse );
  136.     DECLARE_SOURCE( OnMouseMove, TDBMemoMouse );
  137.     DECLARE_SOURCE( OnMouseUp,   TDBMemoMouse );
  138.  
  139.     // Event handlers
  140.     DECLARE_DB_EVENT( OnClick,     TNotifyEvent );
  141.     DECLARE_DB_EVENT( OnDragDrop,  TDragEvent );
  142.     DECLARE_DB_EVENT( OnDragOver,  TDragOverEvent );
  143.     DECLARE_DB_EVENT( OnEndDrag,   TDragEvent );
  144.     DECLARE_DB_EVENT( OnChange,    TNotifyEvent );
  145.     DECLARE_DB_EVENT( OnDblClick,  TNotifyEvent );
  146.     DECLARE_DB_EVENT( OnEnter,     TNotifyEvent );
  147.     DECLARE_DB_EVENT( OnExit,      TNotifyEvent );
  148.     DECLARE_DB_EVENT( OnKeyDown,   TKeyEvent );
  149.     DECLARE_DB_EVENT( OnKeyPress,  TKeyPressEvent );
  150.     DECLARE_DB_EVENT( OnKeyUp,     TKeyEvent );
  151.     DECLARE_DB_EVENT( OnMouseDown, TMouseEvent );
  152.     DECLARE_DB_EVENT( OnMouseMove, TMouseEvent );
  153.     DECLARE_DB_EVENT( OnMouseUp,   TMouseEvent );
  154.  
  155.   protected:
  156.     char far* GetClassName();
  157.  
  158. #ifdef __OWL_VBXCTL_H
  159.   DECLARE_RESPONSE_TABLE( TDBMemo );
  160. #endif __OWL_VBXCTL_H
  161. };
  162.  
  163. // Inlines
  164. // Properties
  165. DEFINE_DB_PROP_DATAFIELD( TDBMemo, _TDBMemo )
  166. DEFINE_DB_PROP_TSTRINGS( TDBMemo, _TDBMemo, Lines )
  167. DEFINE_DB_PROP_STRING( TDBMemo, _TDBMemo, FontName );
  168. DEFINE_DB_PROP_STRING( TDBMemo, _TDBMemo, SelText );
  169.  
  170. // Methods
  171. inline void TDBMemo::Clear()
  172. {
  173.   ::VBXMethodClear( GetHCTL() );
  174. }
  175.  
  176. inline void TDBMemo::ClearSelection()
  177. {
  178.   SelText = &string();
  179. }
  180.  
  181. inline void TDBMemo::CutToClipboard()
  182. {
  183.   CopyToClipboard();
  184.   ClearSelection();
  185. }
  186.  
  187. inline void TDBMemo::LoadMemo()
  188. {
  189.   if( ! AutoDisplay )
  190.     ::VBXMethodRefresh( GetHCTL() );
  191. }
  192.  
  193. inline void TDBMemo::SelectAll()
  194. {
  195.   int i = 0;
  196.  
  197.   SelStart  = i;
  198.   i = 0xFFFF;
  199.   SelLength = i;
  200. }
  201.  
  202. inline char far* TDBMemo::GetClassName()
  203. {
  204.   return "DBMEMO";
  205. }
  206.  
  207. #endif DBMEMO_H_
  208.