ibutton.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:8k
- /*
- * ibutton.h
- *
- * Image button control.
- *
- * Portable Windows Library
- *
- * Copyright (c) 1993-1998 Equivalence Pty. Ltd.
- *
- * The contents of this file are subject to the Mozilla Public License
- * Version 1.0 (the "License"); you may not use this file except in
- * compliance with the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS"
- * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
- * the License for the specific language governing rights and limitations
- * under the License.
- *
- * The Original Code is Portable Windows Library.
- *
- * The Initial Developer of the Original Code is Equivalence Pty. Ltd.
- *
- * Portions are Copyright (C) 1993 Free Software Foundation, Inc.
- * All Rights Reserved.
- *
- * Contributor(s): ______________________________________.
- *
- * $Log: ibutton.h,v $
- * Revision 1.22 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.21 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.20 1999/02/16 08:08:45 robertj
- * MSVC 6.0 compatibility changes.
- *
- * Revision 1.19 1998/09/23 06:23:45 robertj
- * Added open source copyright license.
- *
- * Revision 1.18 1995/03/14 12:41:29 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.17 1995/01/18 09:02:20 robertj
- * Added separate image icon for enabled and disabled button.
- *
- * Revision 1.16 1994/12/21 11:53:01 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.15 1994/10/30 11:46:39 robertj
- * Changed mechanism for doing notification callback functions.
- *
- * Revision 1.14 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.13 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.12 1994/04/03 08:34:18 robertj
- * Added help and focus functionality.
- *
- * Revision 1.11 1994/03/07 07:38:19 robertj
- * Major enhancementsacross the board.
- *
- * Revision 1.10 1994/01/15 02:50:29 robertj
- * Moved control contructors to common and added a platform dependent Construct() function.
- *
- * Revision 1.9 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.8 1993/12/31 06:42:49 robertj
- * Made inlines optional for debugging purposes.
- * Added ImgIcon class.
- *
- * Revision 1.7 1993/10/16 20:33:20 robertj
- * Only allowing pixmaps to be used in image buttons.
- *
- * Revision 1.6 1993/09/27 16:35:25 robertj
- * Removed special constructor for dialog resource loading.
- *
- * Revision 1.5 1993/08/24 00:27:59 robertj
- * Reassranged push button classes and implemented new arrangement.
- *
- * Revision 1.4 1993/08/21 01:50:33 robertj
- * Made Clone() function optional, default will assert if called.
- *
- * Revision 1.3 1993/07/14 12:49:16 robertj
- * Fixed RCS keywords.
- *
- */
- #define _PIMAGEBUTTON
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A simple push button control with an image icon in it, which is used to
- initiate an action.
- */
- class PImageButton : public PPushButton
- {
- PCLASSINFO(PImageButton, PPushButton);
- public:
- /** Create an icon button control with the specified attributes. */
- PImageButton(
- PInteractor * parent, /// Interactor into which the control is placed.
- ButtonType deflt = OrdinaryButton /// Flag for is the default button.
- );
- PImageButton(
- PInteractor * parent, /// Interactor into which the control is placed.
- const PImgIcon & img, /// Image to be placed in the button.
- ButtonType deflt = OrdinaryButton /// Flag for is the default button.
- );
- PImageButton(
- PInteractor * parent, /// Interactor into which the control is placed.
- const PImgIcon & img, /// Image to be placed in the button.
- const PNotifier & notify, /// Function to call when changes state.
- ButtonType deflt = OrdinaryButton /// Flag for is the default button.
- );
- PImageButton(
- PInteractor * parent, /// Interactor into which the control is placed.
- const PImgIcon & enabImg, /// Image to be placed in the enabled button.
- const PImgIcon & disabImg, /// Image to be placed in the disabled button.
- ButtonType deflt = OrdinaryButton /// Flag for is the default button.
- );
- PImageButton(
- PInteractor * parent, /// Interactor into which the control is placed.
- const PImgIcon & enabImg, /// Image to be placed in the enabled button.
- const PImgIcon & disabImg, /// Image to be placed in the disabled button.
- const PNotifier & notify, /// Function to call when changes state.
- ButtonType deflt = OrdinaryButton /// Flag for is the default button.
- );
- /**Create control from interactor layout with the specified control ID.
- This is mainly used in support of resource based dialogs.
- */
- PImageButton(
- PInteractorLayout * parent, /// Interactor into which the box is placed.
- PRESOURCE_ID ctlID, /// Identifier for the control in the layout.
- const PNotifier & notify, /// Function to call when changes state.
- void * valuePtr /// Variable to change to the button state.
- );
- /** Destroy the icon push button control and image. */
- virtual ~PImageButton();
- /**@name New functions for class */
- /**Set the default (minimum) dimensions for the control. This will be just
- enough to contain the iamge and the buttons 3d surround.
- */
- void DefaultDimensions();
- /**Set the current image used in the button. This will be updated on the
- screen immediately (within OS contsraints).
- */
- void SetImage(
- const PImgIcon & img /// New image to set in the button.
- );
- void SetImage(
- const PImgIcon & enabledImg, /// New enabled image to set in the button.
- const PImgIcon & disabledImg /// New disabled image to set in the button.
- );
- /**Get the current image being drawn in the face of the button when it is
- enabled.
-
- @return
- image icon that is used in the button.
- */
- PImgIcon GetEnabledImage() const;
- /**Get the current image being drawn in the face of the button when it is
- disabled.
-
- @return
- image icon that is used in the button.
- */
- PImgIcon GetDisabledImage() const;
- /**@name System callback functions. */
- /**Draw the contents (face) of the pushbutton.
-
- The default action for this function is to draw the image centred in the
- specified rectrangle. A slight offset is applied to this when the
- #isSelected# flag is TRUE indicating that the button is down.
- This aids the visual appearance.
- */
- virtual void OnDrawFace(
- PCanvas & canvas, /// Canvas into which to draw the button face.
- const PRect & rect, /// Bounds in which to draw the button face.
- BOOL hasFocus, /// Flag indicating that the button has the focus.
- BOOL isSelected /// Flag indicating the button is currently down.
- );
- protected:
- /** The small pixel image to be used in the button when enabled. */
- PImgIcon enabledImage;
- /** The small pixel image to be used in the button when disabled. */
- PImgIcon disabledImage;
- private:
- // New functions for class
- void Construct();
- // Common constructor code
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////