home *** CD-ROM | disk | FTP | other *** search
- #ifndef _IPUSHBUT_
- #define _IPUSHBUT_
- /*******************************************************************************
- * FILE NAME: ipushbut.hpp *
- * *
- * DESCRIPTION: *
- * Declaration of the class(es): *
- * Ipushbut - This class creates and manages the pushbutton control 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/IPUSHBUT.HPV $
- //
- // Rev 1.6 25 Oct 1992 17:05:54 nunn
- //changed library name to ICLUI
- //
- // Rev 1.5 25 Oct 1992 10:56:28 boezeman
- //Add documentation and converted file to skeleton.hpp format.
-
- Rev 1.4 13 Oct 1992 21:22:24 tsuji
- Correct comments around log directive.
-
- Rev 1.3 13 Oct 1992 20:57:22 tsuji
- Correct log directive, remove IBM Confidential classification.
-
- Rev 1.2 13 Oct 1992 19:06:04 tsuji
- Remove no-op virtual destructor, add Inherited typedef.
- *******************************************************************************/
- #ifndef _IBUTTON_
- #include <ibutton.hpp>
- #endif
-
- // Forward declarations for other classes:
- class IPushButton; /* pb */
- class IRectangle;
- class ISize;
- class IWindowHandle;
- #ifndef _IBITFLAG_
- #include <ibitflag.hpp>
- #endif
-
-
- class IPushButton : public IButton {
- /*******************************************************************************
- * This class creates and manages the pushbutton control window. *
- * *
- * To use this class, create an instance of this class as follows: *
- IPushButton pbCancel(ID_CANCEL, this, IRectangle(10,10,30,12)); *
- pbCancel.setText("Cancel"); *
- * The standard pushbutton will generate an ICommandEvent. The application can *
- * change the window style value to generate a help event or ISysCommandEvent. *
- * *
- * The class user of this control can change the push button event (message) *
- * processing by calling the setStyle(IPushButton::Style) function with a style *
- * including IPushButton::help or IPushButton::systemCommand to cause an IEvent *
- * with a WM_HELP or a WM_SYSCOMMAND message, respectively. *
- * Valid styles for a push button control are: *
- * IPushButton::help, *
- * IPushButton::systemCommand, *
- * IPushButton::defaultButton, *
- * IPushButton::noBorder, *
- * IPushButton::defStyle, *
- * any of the IButton styles, *
- * any of the IControl styles, and *
- * any of the IWindow styles. *
- * *
- * If the push button was not created from a dialog template, then the *
- * application is responsible for processing the Enter key and calling the push *
- * button's inherited click() function. *
- * *
- * EXAMPLE: *
- * <sample code> *
- *******************************************************************************/
- typedef IButton
- Inherited;
- public:
- INESTEDBITFLAGCLASSDEF3(Style, IPushButton, IWindow,
- IControl, IButton);
- // style class definition
- static const Style
- // userButton, add later? $HT!!
- help,
- systemCommand,
- defaultButton,
- noBorder;
- 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 |
- ------------------------------------------------------------------------------*/
- IPushButton(unsigned long Id,
- const IWindow* parent,
- const IWindow* owner,
- const IRectangle& initial,
- Style style = defStyle);
-
- IPushButton(unsigned long Id,
- const IWindow* parentDialog);
-
- IPushButton(IWindowHandle handle);
-
- /*-------------------------------- STYLES --------------------------------------
- | These function provide means of getting and setting the default style |
- | attributes of instances of this class: |
- | defaultStyle - returns the pushbutton control default style setting |
- | setDefaultStyle - sets the pushbutton control default style |
- ------------------------------------------------------------------------------*/
- static Style
- defaultStyle();
- static void
- setDefaultStyle(Style style);
-
- /*-------------------------------- TEST/SET DEFAULT STYLE-----------------------
- | These operations test and set the default state of a pushbutton. Making a |
- | pushbutton the default allows it to be selected with the enter key without |
- | having the cursor on the pushbutton. Visually a default pushbutton has a |
- | darker and thicker border. |
- | isDefault - Return true if the BS_DEFAULT style is set. |
- | setDefault - Adds a BS_DEFAULT style to the pushbutton. |
- | unsetDefault - Removes a BS_DEFAULT style to the pushbutton. |
- ------------------------------------------------------------------------------*/
- Boolean
- isDefault() const;
- void
- setDefault(),
- unsetDefault();
- /***********************************************************/
- /* Ideally, only one push button should be made a default */
- /* push button. Don't know whether PM handles this */
- /* automatically (I'd guess it doesn't). */
- /* Should test this out, and maybe add code to do this if */
- /* it's not handled by PM (have unsetDefault() called for */
- /* all other push buttons owned by the window?). */
- /***********************************************************/
-
- protected:
- /*----------------------------- LAYOUT SIZE ------------------------------------
- | calcMinSize - returns the minimum size that this pushbutton control should be|
- ------------------------------------------------------------------------------*/
- virtual ISize
- calcMinSize();
-
- static Style
- classDefaultStyle;
-
- private:
- /*--------------------------------- PRIVATE ----------------------------------*/
- IPushButton(const IPushButton&);
- //IPushButton& operator=(const IPushButton&);
-
- static const Style
- pushButton;
- }; // class IPushButton
-
- INESTEDBITFLAGCLASSFUNCS(Style, IPushButton);
- // global style functions
- #endif // _IPUSHBUT_