home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IRADIOBT_
- #define _IRADIOBT_
- /*******************************************************************************
- * FILE NAME: iradiobt.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * Iradiobt - This class creates and manages the radio button conrol window.*
- * *
- * COPYRIGHT: *
- * Licensed Materials - Property of IBM *
- * (C) Copyright IBM Corporation 1992, 1993 *
- * All Rights Reserved *
- * US Government Users Restricted Rights - Use, duplication, or disclosure *
- * restricted by GSA ADP Schedule Contract with IBM Corp. *
- * *
- * $Log: R:/IBMCLASS/IBASECTL/VCS/IRADIOBT.HPV $
- //
- // Rev 1.6 25 Oct 1992 17:05:58 nunn
- //changed library name to ICLUI
- //
- // Rev 1.5 25 Oct 1992 10:56:40 boezeman
- //Add documentation and converted file to skeleton.hpp format.
-
- Rev 1.4 13 Oct 1992 21:22:30 tsuji
- Correct comments around log directive.
-
- Rev 1.3 13 Oct 1992 20:57:36 tsuji
- Correct log directive, remove IBM Confidential classification.
-
- Rev 1.2 13 Oct 1992 19:06:08 tsuji
- Remove no-op virtual destructor, add Inherited typedef.
- *******************************************************************************/
- #ifndef _ISETBUT_
- #include <isetbut.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IRadioButton; /* rb */
- class IRectangle;
- class ISize;
- class IWindowHandle;
- #ifndef _IBITFLAG_
- #include <ibitflag.hpp>
- #endif
-
- class IRadioButton : public ISettingButton {
- /*******************************************************************************
- * This class creates and manages the radio button control window. *
- * *
- * To use this class, create an instance of this class as follows: *
- * IRadioButton rbChoice(ID_CHOICE, this, IRectangle(10,10,30,12)); *
- * rbChoice.setText("Cold and Bitter"); *
- * User action or invoking an operation on the radio button will cause an *
- * IControlEvent. Use the id() and notifyCode() operations in IControlEvent to *
- * process the event (e.g. a notification code of BN_CLICKED or BN_DBLCLICKED). *
- * *
- * NOTE:Not sure the following is still true??? *
- * Because OS/2 PM does not properly implement the BS_NOCURSORSELECT style of *
- * radio buttons on non-dialog template created windows, the application must *
- * add processing to implement this radio button style. The example and *
- * following comments will help the application developer code this. *
- * case WM_CHAR: *
- * if (tab or arrow key) *
- * if (the control before the radio button has focus) *
- * if (rbTest->isCursorSelect()) *
- * { *
- * if (rb_test->isSelected()) *
- * rb_test->select(FALSE); *
- * else *
- * rb_test->select(TRUE); *
- * } *
- * *
- * OS/2 PM enumerates the controls in a dialog template as they appear in the *
- * template from the top to the bottom. In non-template windows, PM enumerates *
- * the controls from the last created control to the first created control. *
- * This causes a problem, for example, with the grouping of controls around the *
- * WS_GROUP and WS_TABSTOP styles. As a result, controls on a non-dialog *
- * template window should be created in the opposite order than the controls *
- * would have appeared in a dialog template. The following illustration of *
- * controls on a window (not in a dialog template) would require that the push *
- * button be created first, the "Radio 2" radio button second, the "Radio 1" *
- * radio button third, and the entry field last. *
- * __________________ *
- * | Entry Field | *
- * ------------------ *
- * o Radio 1 *
- * o Radio 2 *
- * ______ *
- * |______| <--- Push button *
- * *
- * To insure that OS/2 PM's implementation of the radio button control works *
- * properly, create all radio button controls in the same group one after the *
- * other (or place the radio buttons together in a dialog template). *
- * *
- * Also, invoke the setStyle() function, specifying a style that includes *
- * IControl::group (or place the WS_GROUP style in dialog template) for the *
- * first control in each group and for the first control AFTER each group. *
- * *
- * User action or invoking an operation on the radio button will cause an *
- * IControlEvent. The low 2 bytes of the first parameter will be equal to the *
- * radio button ID and the high 2 bytes of the first parameter will equal to *
- * either BN_CLICKED or BN_DBLCLICKED. The second parameter is not used. *
- * *
- * EXAMPLE: *
- * <sample code> *
- *******************************************************************************/
- /* *** Like to handle #2 automatically ** */
- /* *** Need test case to understand this ** */
- /* *** better. ** */
- /* ** should we update IControlEvent to ** */
- /* ** provide this ** */
- typedef ISettingButton
- Inherited;
- public:
- INESTEDBITFLAGCLASSDEF3(Style, IRadioButton,
- IWindow, IControl, IButton);
- // style class definition
- static const Style
- autoSelect,
- noCursorSelect;
- static const Style&
- defStyle;
-
- /*------------------------ CONSTRUCTORS/DESTRUCTORS ----------------------------
- | There are 3 ways to construct instances of this class: |
- | 1. default |
- | 2. From a Dialog Template |
- | 3. From a Window |
- ------------------------------------------------------------------------------*/
- IRadioButton(unsigned long Id,
- const IWindow* parent,
- const IWindow* owner,
- const IRectangle& initial,
- Style style = defStyle);
-
- IRadioButton(unsigned long ulId,
- const IWindow* parentDialog);
-
- IRadioButton(IWindowHandle handle);
-
- /*-------------------------------- STYLES --------------------------------------
- | These function provide means of getting and setting the default style |
- | attributes of instances of this class: |
- | defaultStyle - returns the radio button control default style setting |
- | setDefaultStyle - sets the radio button control default style |
- ------------------------------------------------------------------------------*/
- static Style
- defaultStyle();
- static void
- setDefaultStyle(Style style);
-
- /*-------------------------------- OVERLOADED AUTOSELECT------------------------
- | These operations are overloaded since the actual style setting is different. |
- | enableAutoSelect - sets/removes the radio button control to/from the |
- | autoselect style |
- | disableAutoSelect - removes the autoselect style from the radio button control|
- | isAutoSelect - returns true is the radio button control has the |
- | autoselect style set else it returns false |
- ------------------------------------------------------------------------------*/
- virtual void
- enableAutoSelect(),
- disableAutoSelect();
- virtual Boolean
- isAutoSelect() const;
-
- /*----------------------------- CURSOR SELECT STYLE ----------------------------
- | These operation test, enable and disable the radio button cursor select style.|
- | enableCursorSelect - Makes the radio button cursor selectable. |
- | disableCursorSelect - Adds the non-cursor-selectable radio button style. |
- | isCursorSelect - Return true if the radio button is cursor selectable.|
- ------------------------------------------------------------------------------*/
- void
- enableCursorSelect(),
- disableCursorSelect();
- Boolean
- isCursorSelect() const;
-
- /*----------------------------- SELECT BUTTON INDEX ----------------------------
- | selectedIndex - Return the 0-based index of the selected radio button in |
- | a group. If no radio button is selected, a value of -1 |
- | is returned. |
- ------------------------------------------------------------------------------*/
- long
- selectedIndex() const;
-
- protected:
- /*----------------------------- LAYOUT SIZE ------------------------------------
- | calcMinSize - returns the minimum size that this radio button control |
- | should be. |
- ------------------------------------------------------------------------------*/
- virtual ISize
- calcMinSize();
-
- static Style
- classDefaultStyle;
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- IRadioButton(const IRadioButton&);
- //IRadioButton& operator=(const IRadioButton&);
-
- static const Style
- radioButton;
- }; // class IRadioButton
-
- INESTEDBITFLAGCLASSFUNCS(Style, IRadioButton);
- // global style functions
- #endif // _IRADIOBT_