home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c082_122 / 3.ddi / OWLINC.ZIP / COMBOBOX.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-10  |  3.0 KB  |  106 lines

  1. // ObjectWindows - (C) Copyright 1992 by Borland International
  2.  
  3. #ifndef __COMBOBOX_H
  4. #define __COMBOBOX_H
  5.  
  6. #ifndef __LISTBOX_H
  7. #include <listbox.h>
  8. #endif
  9.  
  10. #pragma option -Vo-
  11. #if     defined(__BCOPT__) && !defined(_ALLOW_po)
  12. #pragma option -po-
  13. #endif
  14.  
  15. _CLASSDEF(TComboBox)
  16. _CLASSDEF(TComboBoxData)
  17.  
  18. /* --------------------------------------------------------
  19.   TComboBox object
  20.   -------------------------------------------------------- */
  21.  
  22. class _EXPORT TComboBox : public TListBox
  23. {
  24. public:
  25.     WORD TextLen;
  26.  
  27.     TComboBox(PTWindowsObject AParent, int AnId, int X, int Y, int W,
  28.               int H, DWORD AStyle, WORD ATextLen, PTModule AModule = NULL);
  29.     TComboBox(PTWindowsObject AParent, int ResourceId, WORD ATextLen,
  30.               PTModule AModule = NULL);
  31.  
  32.     /* Returns the length of the associated edit control's text. */
  33.     int GetTextLen()
  34.         { return GetWindowTextLength(HWindow); }
  35.  
  36.     /* Fills the supplied string with the text of the associated
  37.        edit control. Returns the number of characters copied. */
  38.     int GetText(LPSTR AString, int MaxChars)
  39.         { return GetWindowText(HWindow, AString, MaxChars); }
  40.  
  41.     void SetText(LPSTR AString);
  42.  
  43.     /* Selects characters in the edit control of the combo box
  44.        which are between StartPos and EndPos. Returns CB_ERR if
  45.        the combo box does not have an edit control. */
  46.     int SetEditSel(int StartPos, int EndPos)
  47.         { return (int)SendMessage(HWindow, CB_SETEDITSEL,
  48.                       0, MAKELONG(StartPos, EndPos)); }
  49.  
  50.     int GetEditSel(Rint StartPos, Rint EndPos);
  51.  
  52.     /* Clears the text of the associated edit control. */
  53.     void Clear()
  54.         { SetText(""); }
  55.  
  56.     void ShowList();
  57.     void HideList();
  58.     virtual WORD Transfer(Pvoid DataPtr, WORD TransferFlag);
  59.     virtual Pchar nameOf() const
  60.         { return "TComboBox"; }
  61.  
  62.     static PTStreamable build();
  63.  
  64. protected:
  65.     virtual LPSTR GetClassName()
  66.         {return "COMBOBOX";}
  67.     virtual WORD GetMsgID(WORD AnId);
  68.     virtual void SetupWindow();
  69.  
  70.     TComboBox(StreamableInit) : TListBox(streamableInit) {};
  71.     virtual void write (Ropstream os);
  72.     virtual Pvoid read (Ripstream is);
  73.  
  74. private:
  75.     virtual const Pchar streamableName() const
  76.         { return "TComboBox"; }
  77. };
  78.  
  79. inline Ripstream operator >> ( Ripstream is, RTComboBox cl )
  80.     { return is >> (RTStreamable )cl; }
  81. inline Ripstream operator >> ( Ripstream is, RPTComboBox cl )
  82.     { return is >> (RPvoid)cl; }
  83.  
  84. inline Ropstream operator << ( Ropstream os, RTComboBox cl )
  85.     { return os << (RTStreamable )cl; }
  86. inline Ropstream operator << ( Ropstream os, PTComboBox cl )
  87.     { return os << (PTStreamable )cl; }
  88.  
  89. class _EXPORT TComboBoxData
  90. {
  91. public:
  92.     PArray Strings;
  93.     Pchar Selection;
  94.  
  95.     TComboBoxData();
  96.     ~TComboBoxData();
  97.     void AddString(Pchar AString, BOOL IsSelected = FALSE);
  98. };
  99.  
  100. #pragma option -Vo.
  101. #if     defined(__BCOPT__) && !defined(_ALLOW_po)
  102. #pragma option -po.
  103. #endif
  104.  
  105. #endif
  106.