imgicon.h
上传用户:hzhsqp
上传日期:2007-01-06
资源大小:1600k
文件大小:5k
- /*
- * imgicon.h
- *
- * Image icon class.
- *
- * 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: imgicon.h,v $
- * Revision 1.12 1999/03/10 03:49:51 robertj
- * More documentation adjustments.
- *
- * Revision 1.11 1999/03/09 08:01:48 robertj
- * Changed comments for doc++ support (more to come).
- *
- * Revision 1.10 1998/09/23 06:23:55 robertj
- * Added open source copyright license.
- *
- * Revision 1.9 1995/03/14 12:41:34 robertj
- * Updated documentation to use HTML codes.
- *
- * Revision 1.8 1995/01/06 10:31:24 robertj
- * Documentation.
- *
- * Revision 1.7 1994/12/21 11:53:08 robertj
- * Documentation and variable normalisation.
- *
- * Revision 1.6 1994/12/05 11:22:47 robertj
- * Added constructor to convert from PPixelImage to PImgIcon.
- *
- * Revision 1.5 1994/08/23 11:32:52 robertj
- * Oops
- *
- * Revision 1.4 1994/08/22 00:46:48 robertj
- * Added pragma fro GNU C++ compiler.
- *
- * Revision 1.3 1994/06/25 11:55:15 robertj
- * Unix version synchronisation.
- *
- * Revision 1.2 1994/01/03 04:42:23 robertj
- * Mass changes to common container classes and interactors etc etc etc.
- *
- * Revision 1.1 1993/12/31 06:42:23 robertj
- * Initial revision
- *
- */
- #define _PIMGICON
- #ifdef __GNUC__
- #pragma interface
- #endif
- /**A class representing an image icon. This differs from a Ref{PPixelImage}
- class object in its internal representation of the pixels. The
- Ref{PPixelImage} is a device and largely platform independent format. The
- PImgIcon is tied to a particular device (screen, printer etc) and platform.
- Generally, a PImgIcon is faster to draw but may consume limited resources.
- There is also less flexibility for image processing as the image pixels are
- not available to be modified.
- For example, for X-Windows a PPixelImage is a client resource and every time
- it needs to be drawn the pixel data must be transfered to the X server. A
- PImgIcon is an X server resource and does not need this transfer so is much
- faster. However, as X server memory may be limited, this may not be used
- with impunity.
- This class is typically used for small user interface images such as icons
- within image push buttons in a tool bar. For this purpose the images are
- usually created via a resource.
-
- There is no intrinsic requirement that the image be small or drawn to the
- device it was created for. However, not doing this can have unexpected
- results, especially in colours and scaling.
- */
- class PImgIcon : public PContainer
- {
- PCONTAINERINFO(PImgIcon, PContainer);
- public:
- /**Create image icons. If no resource is specified then an empty image is
- created. With these contructors the screen is assumed to be the device
- that the image is to be drawn to.
- */
- PImgIcon();
- PImgIcon(
- PRESOURCE_ID resID /// Resource identifier for the image.
- );
- /**Create an image icon from the arbitrary pixel image using the canvas as
- the target device.
- */
- PImgIcon(
- PCanvas & canvas, /// Canvas for the device dependent image.
- const PPixelImage & pix /// Device independent image to convert.
- );
- /**@name Overrides from class PObject */
- /**Determine if the two icons are the same. Note that this is different
- from having two icons that merely {bf look} the same. They must be
- references to the same icon or if loaded from resources, the same
- resource ID.
- @return
- #EqualTo# if reference the same icon,
- #GreaterThan# if different.
- */
- virtual Comparison Compare(
- const PObject & obj /// Image icon to compare against.
- ) const;
- /**@name New functions for class */
- /**Get the dimensions of the image.
-
- @return
- width and height of image icon.
- */
- virtual PDim GetDimensions() const;
- private:
- // Overrides from class PContainer
- virtual BOOL SetSize(
- PINDEX size /// New size of image icon container, ignored.
- );
- // Do nothing, size is always one image icon.
- #ifdef DOC_PLUS_PLUS
- };
- #endif
- // Class declaration continued in platform specific header file ///////////////