home *** CD-ROM | disk | FTP | other *** search
/ Power GUI Programming with VisualAge C++ / powergui.iso / trialva / ibmcppw / include / icombobs.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-02-22  |  9.3 KB  |  317 lines

  1. #ifndef _ICOMBOBS_
  2.   #define _ICOMBOBS_
  3. /*******************************************************************************
  4. * FILE NAME: icombobs.hpp                                                      *
  5. *                                                                              *
  6. * DESCRIPTION:                                                                 *
  7. *   Declaration of the classes:                                                *
  8. *     IBaseComboBox                                                            *
  9. *                                                                              *
  10. * COPYRIGHT:                                                                   *
  11. *   IBM Open Class Library                                                     *
  12. *   (C) Copyright International Business Machines Corporation 1992, 1996       *
  13. *   Licensed Material - Program-Property of IBM - All Rights Reserved.         *
  14. *   US Government Users Restricted Rights - Use, duplication, or disclosure    *
  15. *   restricted by GSA ADP Schedule Contract with IBM Corp.                     *
  16. *                                                                              *
  17. *******************************************************************************/
  18. #include <ientryfd.hpp>
  19. #include <irect.hpp>
  20.  
  21. class IBaseComboBoxData;
  22. class IBaseComboBoxCursorData;
  23. class IComboBoxHandler;
  24.  
  25. #pragma pack(4)
  26.  
  27. class IBaseComboBox : public IEntryField {
  28. typedef IEntryField
  29.   Inherited;
  30.  
  31. public:
  32. class Style;
  33. class Cursor;
  34. /*------------------------------- Constructors -------------------------------*/
  35.   IBaseComboBox       ( unsigned long     id,
  36.                         IWindow*          parent,
  37.                         IWindow*          owner,
  38.                         const IRectangle& initial = IRectangle  ( ),
  39.                         const Style&      style   = defaultStyle( ) );
  40.  
  41.   IBaseComboBox       ( unsigned long     id,
  42.                         IWindow*          parent );
  43.  
  44.   IBaseComboBox       ( const IWindowHandle& handle );
  45.  
  46. virtual
  47.   ~IBaseComboBox      ( );
  48.  
  49. /*---------------------------------- Styles ----------------------------------*/
  50. INESTEDBITFLAGCLASSDEF2(Style, IBaseComboBox, IWindow, IControl);
  51.  
  52. static const Style
  53.   IC_IMPORTU classDefaultStyle,
  54.   IC_IMPORTU simpleType,
  55.   IC_IMPORTU dropDownType,
  56.   IC_IMPORTU readOnlyDropDownType,
  57.   IC_IMPORTU horizontalScroll;
  58. static const Style
  59.   IC_IMPORTU autoScroll;
  60. static const Style
  61.    IC_IMPORTU  oemData;
  62. #ifndef IC_MOTIFPM_FLAGNOP
  63. static const Style
  64.   IC_IMPORTU border3D;
  65. #endif
  66.  
  67. static Style
  68.   defaultStyle        ( );
  69.  
  70. static void
  71.   setDefaultStyle     ( const Style&    style );
  72.  
  73. virtual unsigned long
  74.   convertToGUIStyle   ( const IBitFlag& style,
  75.                         Boolean         extendedOnly = false ) const;
  76.  
  77. Boolean
  78.   isHorizontalScroll  ( ) const;
  79.  
  80. /*------------------------- Type Members -------------------------------------*/
  81. enum ControlType {
  82.   simple,
  83.   dropDown,
  84.   dropDownList,
  85.   readOnlyDropDown = dropDownList
  86. };
  87.  
  88. ControlType
  89.   type                ( ) const;
  90.  
  91. /*-------------------------------- Text Limit --------------------------------*/
  92. virtual IBaseComboBox
  93.  &setLimit  ( unsigned long      textLimit ),
  94.  &setLimit  ( const IResourceId& textLimit );
  95.  
  96. virtual unsigned long
  97.   limit     ( ) const;
  98.  
  99. /*------------------------- List Box Operations ------------------------------*/
  100. Boolean
  101.   isListShowing       ( ) const;
  102.  
  103. virtual IBaseComboBox
  104.   &showList           ( Boolean show=true ),
  105.   &hideList           ( );
  106.  
  107. /*------------------------- Get and Change Items -----------------------------*/
  108. virtual IString
  109.   itemText            ( unsigned long      index ) const;
  110.  
  111. virtual IBaseComboBox
  112.  &setItemText         ( unsigned long      index,
  113.                         const char*        string,
  114.                         Boolean            updateEntryField = false ),
  115.  &setItemText         ( unsigned long      index,
  116.                         const IResourceId& string,
  117.                         Boolean            updateEntryField = false );
  118.  
  119. virtual IString
  120.   elementAt           ( const Cursor& cursor ) const;
  121.  
  122. /*------------------------- Selection ----------------------------------------*/
  123. virtual IBaseComboBox
  124.   &select             ( unsigned long index,
  125.                         Boolean       select = true ),
  126.   &deselect           ( unsigned long index ),
  127.   &deselectAll        ( );
  128.  
  129. virtual Boolean
  130.   isSelected          ( unsigned long index ) const;
  131.  
  132. virtual unsigned long
  133.   numberOfSelections  ( ) const;
  134.  
  135. virtual long
  136.   selection           ( ) const;
  137.  
  138. /*------------------------- Scrolling Members --------------------------------*/
  139. virtual IBaseComboBox&
  140.   setTop              ( unsigned long index );
  141.  
  142. virtual unsigned long
  143.   top                 ( ) const;
  144.  
  145. /*------------------------- Attributes ---------------------------------------*/
  146. virtual Boolean
  147.   hasFocus            ( ) const;
  148.  
  149. /*------------------------- Handle Members -----------------------------------*/
  150. virtual IBaseComboBox&
  151.   setItemHandle       ( unsigned long index,
  152.                         unsigned long handle );
  153.  
  154. virtual unsigned long
  155.   itemHandle          ( unsigned long index ) const;
  156.  
  157. /*------------------------- Search List --------------------------------------*/
  158. static const unsigned long
  159.   IC_IMPORTU notFound,
  160.   IC_IMPORTU first;
  161.  
  162. enum SearchType {
  163.   prefix,
  164.   substring,
  165.   exactMatch
  166. };
  167.  
  168. virtual unsigned long
  169.   locateText           ( const char*   searchString,
  170.                          Boolean       caseSensitive = true,
  171.                          SearchType    search        = exactMatch,
  172.                          unsigned long index         = first ) const;
  173.  
  174. /*------------------------- Content ------------------------------------------*/
  175. virtual unsigned long
  176.   count                ( ) const;
  177.  
  178. virtual Boolean
  179.   isEmpty              ( ) const;
  180.  
  181.  
  182. /*------------------------- Color --------------------------------------------*/
  183.  
  184. /*------------------------- Window Positioning -------------------------------*/
  185.  
  186. virtual IRectangle
  187.   nativeRect           ( ) const;
  188.  
  189.  
  190. /*------------------------- Notification Members -----------------------------*/
  191. static INotificationId const
  192.   IC_IMPORTU enterId,
  193.   IC_IMPORTU selectId;
  194.  
  195. virtual IBaseComboBox
  196.   &enableNotification  ( Boolean enable = true );
  197.  
  198. /*------------------------- Layout Support -----------------------------------*/
  199. virtual IRectangle
  200.   layoutAdjustment     ( ) const,
  201.   visibleRectangle     ( ) const;
  202.  
  203. virtual IBaseComboBox
  204.   &setMinimumRows      ( unsigned long minimumRows );
  205.  
  206. unsigned long
  207.   minimumRows          ( ) const;
  208.  
  209.  
  210. class Cursor : public IVBase {
  211.  
  212. public:
  213. /*---------------------- Filters --------------------------------*/
  214. enum Filter {
  215.   selectedItems,
  216.   allItems
  217. };
  218.  
  219. /*------------------------------- Constructors -------------------------------*/
  220.   Cursor               ( const IBaseComboBox& comboBox,
  221.                          Filter               type = selectedItems );
  222. virtual
  223.   ~Cursor              ( );
  224.  
  225. /*---------------------- Cursor Movement ------------------------*/
  226. virtual Boolean
  227.   setToFirst           ( ),
  228.   setToNext            ( ),
  229.   setToPrevious        ( ),
  230.   setToLast            ( ),
  231.   setToIndex           ( unsigned long index );
  232.  
  233. /*---------------------- Cursor Validation and Conversion -------*/
  234. virtual Boolean
  235.   isValid              ( ) const;
  236.  
  237. virtual void
  238.   invalidate           ( );
  239.  
  240. virtual unsigned long
  241.   asIndex              ( ) const;
  242.  
  243.  
  244. private:
  245. /*------------------------------ Hidden Members ------------------------------*/
  246. Cursor                 ( const Cursor& cursor );
  247. Cursor
  248.  &operator=            ( const Cursor& cursor );
  249.  
  250. /*--------------------------------- Private ----------------------------------*/
  251. const IBaseComboBox
  252.  &rlbCl;
  253. unsigned long
  254.   lClCurrent;
  255. Filter
  256.   cursorTypeCl;
  257. unsigned long
  258.   sameValidation;
  259.  
  260. IBaseComboBoxCursorData
  261.  *fCursorData;
  262. };
  263.  
  264.  
  265. protected:
  266. /*---------------------------- Layout Support --------------------------------*/
  267. virtual ISize
  268.   calcMinimumSize      ( ) const;
  269.  
  270.  
  271.  
  272. /*------------------------------ Item Changes --------------------------------*/
  273. unsigned long
  274.   changeCount          ( ) const;
  275.  
  276. void
  277.   incrementChangeCount ( );
  278.  
  279. private:
  280. /*------------------------------ Hidden Members ------------------------------*/
  281. IBaseComboBox          ( const IBaseComboBox& comboBox );
  282. IBaseComboBox
  283.  &operator=            ( const IBaseComboBox& comboBox );
  284.  
  285. /*--------------------------------- Private ----------------------------------*/
  286. friend class IBaseComboBox::Cursor;
  287. friend class IBaseComboBoxData;
  288. friend class IComboBoxHandler;
  289.  
  290. friend class IBaseComboHandler;
  291. friend long  __stdcall
  292.    icomboboxEntryWinProc(void*         hwnd,
  293.                          unsigned int  msg,
  294.                          unsigned int  mp1,
  295.                          long          mp2);
  296.  
  297. IEntryField::Alignment
  298.   alignment            ( ) const;
  299. virtual IBaseComboBox
  300.  &setAlignment         ( IEntryField::Alignment alignment );
  301.  
  302. static Style
  303.   currentDefaultStyle;
  304.  
  305. unsigned long
  306.   needValidation;
  307.  
  308. IBaseComboBoxData
  309.  *fBaseComboBoxData;
  310. };  /* IBaseComboBox */
  311.  
  312. INESTEDBITFLAGCLASSFUNCS(Style, IBaseComboBox);
  313.  
  314. #pragma pack()
  315.  
  316. #endif  /* _ICOMBOBS_ */
  317.