IIconControl

The IIconControl class creates and manages a window to display a icon image. You can set a bitmap image by using the inherited setBitmap functions, and you likewise can add text to the window by using the inherited setText functions.

AIX Considerations

AIX does not support system bitmaps and dialog templates.


IIconControl - Member Functions and Data by Group

Constructors & Destructor

You can construct and destruct objects of this class. You cannot copy or assign IIconControl objects because both the copy constructor and assignment operator are private functions.


[view class]
~IIconControl
public:
virtual ~IIconControl()

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IIconControl


Overload 1
public:
IIconControl(unsigned long id, IWindow* parentDialog)

Create an IIconControl object for the specified icon from the dialog control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IIconControl( unsigned long id, IWindow* parent, IWindow* owner, unsigned long iconId, const IRectangle& initial = IRectangle ( ), const Style& style = defaultStyle ( ) )

Create an icon control with the specified ID, parent and owner windows, default resource library with its specified icon ID, and window style. If you have not already loaded the icon and you want to load it from the default resource library, use this constructor.

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
IIconControl( unsigned long id, IWindow* parent, IWindow* owner, ISystemPointerHandle::EPointerType icon, const IRectangle& initial = IRectangle ( ), const Style& style = defaultStyle ( ) )

Create an icon control with the specified window ID, parent and owner windows, specified system icon, screen position and size, and window style. If you want to use a system icon, use this constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
public:
IIconControl(const IWindowHandle& handle)

Create an IIconControl object for the specified icon window handle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 5
public:
IIconControl( unsigned long id, IWindow* parent, IWindow* owner, const IPointerHandle& iconId = IPointerHandle ( ), const IRectangle& initial = IRectangle ( ), const Style& style = defaultStyle ( ) )

Create an icon control with the specified window ID, parent and owner windows, icon, screen position and size, and window style. If you already have an icon handle, use this constructor.

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 6
public:
IIconControl( unsigned long id, IWindow* parent, IWindow* owner, const IResourceId& iconId, const IRectangle& initial = IRectangle ( ), const Style& style = defaultStyle ( ) )

Create an icon control using the specified window ID, parent and owner windows, resource library with its specified icon ID, screen position and size, and window style. If you have not already loaded the resource, use this constructor.

Exception

IInvalidParameter The parent window pointer specified was invalid. You must specify a valid IWindow pointer as the parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Canvas Support

These members override the inherited visibleRectangle function.


[view class]
visibleRectangle
public:
virtual IRectangle visibleRectangle() const

Returns a rectangle that represents the area of the window that is actually painted by the icon control.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Icons

Use these functions to query and set the icon image in an icon control window.


[view class]
icon
public:
IPointerHandle icon() const

Returns the handle of the currently set icon.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setIcon

Sets the icon image of the icon control window.


Overload 1
public:
virtual IIconControl& setIcon(const IResourceId& iconId)

Set the icon by specifying an IResourceId. If you want to load the icon from a specific resource library, use this function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual IIconControl& setIcon( ISystemPointerHandle::Identifier icon )

Set the icon using a system icon.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
public:
virtual IIconControl& setIcon(unsigned long iconId)

Set the icon using the default resource library with the specified icon ID.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 4
public:
virtual IIconControl& setIcon(const IPointerHandle& handle)

Set the icon using an existing icon handle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Layout Support

Layout is information used by the canvas classes to provide dialog-like behavior.


[view class]
calcMinimumSize
protected:
virtual ISize calcMinimumSize() const

Returns the minimum size this icon control can be, based on the actual size of the currently set icon.

Exception

IAccessError The call to determine the size of the icon failed. The icon may be corrupted.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

These style members provide valid styles for IIconControl::setDefaultStyle and for the constructor of the IIconControl class.


[view class]
convertToGUIStyle
public:
virtual unsigned long convertToGUIStyle( const IBitFlag& style, bool extendedOnly = false ) const

Converts a style object into a value appropriate for the presentation system. The default action is to return the base GUI styles for the platform. Extended styles, those defined by the application and the Open Class Library, will be returned if you set extendedOnly to true.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
defaultStyle
public:
static Style defaultStyle()

Returns the default style. This is classDefaultStyle unless you have changed it using setDefaultStyle.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultStyle
public:
static void setDefaultStyle(const Style& style)

Sets the default style for all subsequent icon controls.

This member function is not thread safe. In a multithreaded application, it should only be called when a conflict is not possible. A conflict can arise if you set the default style on one thread at the same time that it is being queried on another. In this situation, the query would take place while the style is in an unknown state.

When you create a window class and do not specifically specify window styles in the constructor, the Open Class Library queries the default style. Therefore, the only safe place to call this member function is when no other application threads that create windows are active.

Another way to avoid a conflict in a multithreaded application is to specifically specify window styles on window construction, rather than calling this member function.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
classDefaultStyle
public:
static const Style classDefaultStyle

Original default style for this class, which is IWindow::visible | IIconControl::sizeImageToWindow.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
sizeImageToWindow
public:
static const Style sizeImageToWindow

Use this style to control the automatic stretching or shrinking of the graphical image to fit the window. If you set this style, the image is resized to cover the face of the window. If you do not set this style, the image is rendered in the center of the window without resizing. If the image is larger that the window, it is clipped at the boundaries of the window label area.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
sizeWindowToImage
public:
static const Style sizeWindowToImage

Use this style to cause the window to be automatically resized to fit the image when you set a new image. The automatic resizing only occurs when a new image is set, such as during construction of the window or with the setIcon or setBitmap functions. Note that if there is text set in the window, the window is sized to accommodate the larger of the text and the image.

This style does not affect the behavior of the window if you use the sizeTo function after setting the image. You can use the sizeImageToWindow style to control automatic stretching or shrinking of the image. You can also set an IAlignmentAttribute for the window to control automatic resizing of the window by canvas classes such as IMultiCellCanvas.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IIconControl - Inherited Member Functions and Data

Inherited Public Functions

IBitmapControl
IControl
INotifier
IStaticText
ITextControl
IWindow

Inherited Public Data

IWindow
INotifier
IStaticText
ITextControl

Inherited Protected Functions

IStaticText
IWindow
INotifier
IControl
ITextControl

Inherited Protected Data