IToolBar

The IToolBar class creates and manages a toolbar for a frame window.

A toolbar is a window that can contain toolbar buttons as well as other windows. The toolbar can be located along the top, bottom, or sides of a frame window or can "float" and be positioned anywhere on your desktop. You can then move a floating toolbar independently or you can "pin" the toolbar to the frame window. You can also have multiple toolbars with a variety of different toolbar buttons using text, bitmaps, or both. You can add both fly-over help and drag-and-drop support to a toolbar.

The classes that comprise the toolbar include the following :

Other features of toolbars include the following :


IToolBar - Member Functions and Data by Group

Constructors & Destructor

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


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

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
IToolBar


Overload 1
public:
IToolBar( unsigned long identifier, IToolBar* precedingToolBar, bool groupWithPreceding = false, const Style& style = defaultStyle ( ) )

Creates a toolbar after the precedingToolBar. If groupWithPreceding is true the toolbar is created to the right of horizontal toolbar and below vertical toolbars.

If an IToolBarContainer is needed for the location indicated, the Open Class Library creates one automatically when you use this constructor.

Style should only contain toolbar styles. ISetCanvas, ICanvas, and IWindow styles are not allowed by this constructor.

IToolBar will initialize the toolbar by calling IToolBar::initialize.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
IToolBar( unsigned long identifier, IFrameWindow* owner, Location location = aboveClient, bool groupWithPreceding = false, const Style& style = defaultStyle ( ) )

Creates a toolbar as the last or only toolbar in the toolbar area defined by the frame location.

If groupWithPreceding is true, the toolbar is placed adjacent to the last toolbar in the specified frame location. If groupWithPreceding is false, and another toolbar is in the frame location, the toolbar is placed on a new row (if the toolbar is horizontal) or a new column (if the toolbar is vertical).

If an IToolBarContainer is needed for the location indicated, the Open Class Library creates one automatically when you use this constructor.

Style should only contain toolbar styles. ISetCanvas, ICanvas, and IWindow styles are not allowed by this constructor.

IToolBar will initialize the toolbar by calling IToolBar::initialize.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 3
protected:
IToolBar()

Use this constructor if you derive from IToolBar and wish to override the createToolBarContainer or the createFloatingFrame member functions. If you use this constructor, you must initialize the toolbar by calling IToolBar::initialize. You can call IToolBar::initialize from the body of your derived class's constructor.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Canvas Layout

Use these members to provide support for canvas layout.


[view class]
setLayoutDistorted
public:
virtual IToolBar& setLayoutDistorted( unsigned long layoutAttributeOn, unsigned long layoutAttributeOff )

This function provides notification to a toolbar that its layout of child windows needs to be updated.

IToolBar overrides this function to maintain internal information as well as optimize layout requests, then it calls ISetCanvas::setLayoutDistorted to notify the ISetCanvas that its layout needs to be updated.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Cursor Members

Use these members to query the IToolBar at the current FrameCursor position or the IWindow at the current WindowCursor position.


[view class]
toolBarAt
public:
static IToolBar* toolBarAt(const FrameCursor& cursor)

Returns a pointer to the IToolBar at the cursor position.

Exception

IInvalidParameter The cursor specified is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
windowAt
public:
IWindow* windowAt(const WindowCursor& cursor) const

Returns a pointer to the IWindow at the cursor position.

Exception

IInvalidParameter The cursor specified is invalid.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Drag and Drop Support

Use these members to set and query whether the tool bar supports drag and drop.


[view class]
allowsDragDrop
public:
bool allowsDragDrop() const

Returns true if the toolbar supports drag and drop.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

When drag and drop is enabled, the following restrictions apply: The dragging of an entire toolbar to a new location, or to the floating state, is not supported. Dragging of toolbar buttons is limited to dragging and dropping buttons within the same toolbar. This drag and drop support allows a user to rearrange buttons within a toolbar.


[view class]
disableDragDrop
public:
virtual IToolBar& disableDragDrop()

Prevents dragging of the toolbar, as well as the objects that reside on the toolbar, such as a toolbar button. Prevents drops from occurring on the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
enableDragDrop
public:
virtual IToolBar& enableDragDrop(bool enable = true)

Enables dragging of the toolbar, as well as the objects that reside on the toolbar, such as a toolbar button. Enables drops on the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

When drag and drop is enabled, the following restrictions apply: The dragging of an entire toolbar to a new location, or to the floating state, is not supported. Dragging of toolbar buttons is limited to dragging and dropping buttons within the same toolbar. This drag and drop support allows a user to rearrange buttons within a toolbar.


Expanding and Collapsing the Tool Bar

Use these members to expand or collapse the height of the tool bar when it is floating. If the tool bar is collapsed, only the title bar of the floating frame is displayed.


[view class]
collapse
public:
virtual IToolBar& collapse()

This function is to be used for floating toolbars. Use this function to collapse an expanded toolbar. When a toolbar is collapsed, only the floating frame title bar is visible. When a toolbar is expanded, the floating frame title bar as well as the toolbar are visible. Floating toolbars are initially expanded.

IToolBar::collapse and IToolBar::expand are not to be used for hiding and showing toolbars. Use IToolBar::hide and IToolBar::show to hide and show a toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
expand
public:
virtual IToolBar& expand(bool expand = true)

This function is to be used for floating toolbars. Use this function to expand a collapsed toolbar. When a toolbar is expanded, the floating frame title bar as well as the toolbar are visible. When a toolbar is collapsed, only the floating frame title bar is visible. Floating toolbars are initially expanded.

IToolBar::expand and IToolBar::collapse are not to be used for showing and hiding toolbars. Use IToolBar::show and IToolBar::hide to show and hide a toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isExpanded
public:
bool isExpanded() const

Returns true if the entire toolbar is displayed when it is floating.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Filter Misfits

Use these members to query or change the filterMisfits style for IToolBar objects.

The filterMisfits style automatically filters out any windows in the toolbar that exceed the misfit width when the toolbar is oriented vertically. This is to save screen space when a toolbar is oriented vertically. If a wide control is displayed, there would be wasted space to the right of toolbar buttons and other smaller windows.

If a toolbar is oriented vertically and then later reoriented horizontally, controls that were filtered out due to the filterMisfits style are automatically filtered back into the toolbar.


[view class]
disableMisfitFiltering
public:
IToolBar& disableMisfitFiltering()

Removes the filterMisfits style from the toolbar. If the toolbar is visible, this function calls setLayoutDistorted to force the toolbar to run layout.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
enableMisfitFiltering
public:
IToolBar& enableMisfitFiltering(bool enable = true)

Sets the filterMisfits style for the toolbar. If the toolbar is visible, this function calls setLayoutDistorted to force the toolbar to run layout.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
isMisfitFilteringEnabled
public:
bool isMisfitFilteringEnabled() const

Returns true if the filterMisfits style is set for the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Floating Tool Bar

Use these members to set or query information about a floating tool bar.


[view class]
floatingFrame
public:
virtual IToolBarFrameWindow* floatingFrame()

Returns the IToolBarFrameWindow object that contains this toolbar. A 0 is returned if this toolbar is not currently in a floating frame window.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
floatingPosition
public:
IPoint floatingPosition() const

Returns the current position of the frame window that encloses the floating toolbar (relative to the owning frame window used to construct the toolbar).

If the toolbar is not floating, the position the toolbar would occupy if it were floating is returned instead. The default location is 0,0.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
floatingTitle
public:
IString floatingTitle() const

Returns the title text of the floating frame window.

If the toolbar is not floating, the title that would be used if the toolbar were floating is returned instead.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setFloatingPosition
public:
virtual IToolBar& setFloatingPosition( const IPoint& frameRelativePosition )

Sets the position of the frame window that encloses the floating toolbar. The position is relative to the owning frame window used to construct the toolbar.

If the toolbar is not currently floating, the position is saved and used if the toolbar location is changed to floating.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setFloatingTitle

Sets the title text of the floating frame window.

If the toolbar is not floating, the title is saved and used when the toolbar location is changed to floating.


Overload 1
public:
virtual IToolBar& setFloatingTitle(const IResourceId& text)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Overload 2
public:
virtual IToolBar& setFloatingTitle(const char* text)

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Initialization

These members initialize a tool bar.


[view class]
createFloatingFrame
protected:
virtual IToolBarFrameWindow* createFloatingFrame( IFrameWindow* owner )

Creates a new IToolBarFrameWindow to be used for the floating toolbar.

If a derived class needs to override this function, it needs to use the protected toolbar constructor, then call IToolBar::initialize.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
createToolBarContainer
protected:
virtual IToolBarContainer* createToolBarContainer( IFrameWindow* frame )

Creates a new IToolBarContainer to be used for the toolbar.

If a derived class needs to override this function, it needs to use the protected toolbar constructor, then call IToolBar::initialize. The derived class can call initialize() from the body of its constructor. The toolbar container (ISetCanvas), must be created with the style ISetCanvas::explicitAddsNeeded. If this style is not specified, IToolBar::setLocation will throw an exception.

Exception

IInvalidRequest If you create the toolbar container, you must use the ISetCanvas::explicitAddsNeeded style.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
filter
protected:
virtual IToolBar& filter()

Checks if misfits need to be filtered in or filtered out based on the orientation of the toolbar and the current toolbar style.

This function is called during toolbar layout.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
initialize
protected:
IToolBar& initialize( unsigned long windowIdentifier, IFrameWindow* ownerFrame, Location frameLocation, bool groupWithPreceding, unsigned long style, unsigned long extendedStyle )

Initializes the toolbar window. This function is called automatically from the public toolbar constructors. If you use the protected toolbar constructor, you should call this function to initialize the toolbar.

If a derived class needs to override the createToolBarContainer or the createFloatingFrame member functions, it needs to use the protected toolbar constructor then call initialize.

ownerFrame must contain a pointer to the owning frame window.

style is not currently used. Values specified by this parameter will be ignored.

extendedStyle is to contain only toolbar styles. Only toolbar styles are honored by the toolbar. ISetCanvas, ICanvas, and IWindow styles are not allowed.

Exception

IInvalidParameter You specified mutually exclusive styles. Only one toolbar view can be specified.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Layout

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


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

Returns the recommended minimum size for this toolbar. If isExpanded is false, the toolbar has a height of 0. Otherwise, this returns the size required to display the contents of the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
layout
protected:
virtual IToolBar& layout()

The toolbar layout function first makes a call to IToolBar::filter to filter misfits and then calls ISetCanvas::layout to position and size toolbar child windows.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Styles

Use these members to set and query tool bar styles.

You cannot combine objects of the nested style class IToolBar::Style with objects of any other style class.


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

Use this function to convert style bits into the style value that can be processed by the GUI. The default action is to return the base GUI style for the platform. Extended styles, those defined by the Open Class Library, can be returned by setting the extendedOnly parameter to true.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


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

Returns the default style. The default style is IToolBar::classDefaultStyle unless you have changed the style 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 toolbars.

style
Use the styles provided by IToolBar::Style to specify the default style.

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.

This setting affects subsequent toolbars. It does not affect toolbars that have already been created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonBitmapAndTextVisible
public:
static const Style buttonBitmapAndTextVisible

Displays both the button text and bitmap for IToolBarButton objects that are added into the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonBitmapVisible
public:
static const Style buttonBitmapVisible

Displays only the bitmap for IToolBarButton objects that are added into the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
buttonTextVisible
public:
static const Style buttonTextVisible

Displays only the button text for IToolBarButton objects that are added into the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
classDefaultStyle
public:
static const Style classDefaultStyle

Specifies the original default style for this class, which is IToolBar::filterMisfits, IToolBar::buttonBitmapVisible, and IWindow::visible.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
dragDrop
public:
static const Style dragDrop

Specify this style to enable dragging and dropping for a toolbar.

Enables the dragging of a toolbar and toolbar buttons that reside within a toolbar, as well as the ability to drop onto a toolbar or toolbar buttons.

Note that dragging and dropping is not enabled for a toolbar by default.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

The dragging of an entire toolbar to a new location, or to the floating state, is not supported. Dragging of toolbar buttons is limited to dragging and dropping buttons within the same toolbar. This drag and drop support allows a user to rearrange buttons within a toolbar.


[view class]
filterMisfits
public:
static const Style filterMisfits

Automatically filters out any windows in the toolbar that exceed the misfit width when the toolbar is oriented vertically.

The purpose of this style is to save screen space when a toolbar is oriented vertically. If a wide control is displayed, there would be wasted space to the right of toolbar buttons and other smaller controls.

If a toolbar is oriented vertically and then later reoriented horizontally, controls that were filtered out due to the filterMisfits style are automatically filtered back into the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Tool Bar Button Appearance

Use these members to affect the appearance of any IToolBarButton objects in the tool bar.


[view class]
buttonView
public:
IToolBarButton::View buttonView() const

Returns the current view of IToolBarButton objects in the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setButtonView
public:
virtual IToolBar& setButtonView( IToolBarButton::View buttonView )

Changes the IToolBarButton members of the toolbar to the value of IToolBarButton::view. Valid values are IToolBarButton::bitmapView, IToolBarButton::textView, and IToolBarButton::bitmapAndText.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Tool Bar Container

Use these members to access IToolBarContainer objects.


[view class]
toolBarContainer
public:
virtual IToolBarContainer* toolBarContainer() const

Returns a pointer to the IToolBarContainer object that contains this toolbar. A 0 is returned if this toolbar is not currently in a toolbar container.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Tool Bar Contents

Use these members to add and remove items in the tool bar.


[view class]
addAsFirst
public:
virtual IToolBar& addAsFirst( IWindow* window, bool startNewGroup = false )

Adds the window as the first item in the toolbar.

The first window in a toolbar is always in a group. If startNewGroup is true, the window is placed by itself into a group. The second window in the toolbar begins a second group. If startNewGroup is false, the window becomes part of the first group in the toolbar.

Exception

IInvalidRequest On Motif, the window cannot be added to the toolbar unless its parent is the toolbar. Verify that when creating the window, you specified the toolbar as the window's parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

A window cannot be added to the toolbar unless its parent is the toolbar. If this condition is not met an exception is generated.


[view class]
addAsLast
public:
virtual IToolBar& addAsLast( IWindow* window, bool startNewGroup = false )

Adds the window as the last item in the toolbar.

If startNewGroup is true, the window is placed by itself into a new group. Otherwise, the window becomes part of the last group in the toolbar.

Exception

IInvalidRequest On Motif, the window cannot be added to the toolbar unless its parent is the toolbar. Verify that when creating the window, you specified the toolbar as the window's parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

A window cannot be added to the toolbar unless its parent is the toolbar. If this condition is not met an exception is generated.


[view class]
addAsNext
public:
virtual IToolBar& addAsNext( IWindow* window, IWindow* referenceWindow, bool startNewGroup = false )

Adds the window as the next item in the toolbar immediately after the reference window.

If startNewGroup is true, the window starts a new group. Otherwise, the window becomes part of the same group as the reference window.

Exception

IInvalidRequest On Motif, the window cannot be added to the toolbar unless its parent is the toolbar. Verify that when creating the window, you specified the toolbar as the window's parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

A window cannot be added to the toolbar unless its parent is the toolbar. If this condition is not met an exception is generated.


[view class]
addAsPrevious
public:
virtual IToolBar& addAsPrevious( IWindow* window, IWindow* referenceWindow, bool startNewGroup = false )

Adds the window as the previous item in the toolbar immediately before the reference window.

If startNewGroup is true, the window starts a new group. Otherwise, the window becomes part of the same group as the reference window.

Exception

IInvalidRequest On Motif, the window cannot be added to the toolbar unless its parent is the toolbar. Verify that when creating the window, you specified the toolbar as the window's parent.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

AIX Considerations

A window cannot be added to the toolbar unless its parent is the toolbar. If this condition is not met an exception is generated.


[view class]
moveAfter
public:
virtual IToolBar& moveAfter( IWindow* window, IWindow* referenceWindow, bool startNewGroup = false )

Moves the window so that it immediately follows the reference window.

If startNewGroup is true, the window starts a new group. Otherwise, the window becomes part of the same group as the reference window.
Note: This function is equivalent to calling the remove and addAsNext methods.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
moveBefore
public:
virtual IToolBar& moveBefore( IWindow* window, IWindow* referenceWindow, bool startNewGroup = false )

Moves the window so that it immediately precedes the reference window.

If startNewGroup is true, the window starts a new group. Otherwise, the window becomes part of the same group as the reference window.
Note: This function is equivalent to calling the remove and addAsPrevious methods.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
moveToFirst
public:
virtual IToolBar& moveToFirst( IWindow* window, bool startNewGroup = false )

Moves the window so that it is the first window in the toolbar.

The first window in a toolbar is always in a group. If startNewGroup is true, the window is placed by itself into a group. The second window in the toolbar begins a second group. If startNewGroup is false, the window becomes part of the first group in the toolbar.
Note: This function is equivalent to calling the remove and addAsFirst methods.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
moveToLast
public:
virtual IToolBar& moveToLast( IWindow* window, bool startNewGroup = false )

Moves the window so that it is the last window in the toolbar.

If startNewGroup is true, the window starts a new group. Otherwise, the window becomes part of the last group in the toolbar.
Note: This function is equivalent to calling the remove and addAsLast methods.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
remove
public:
virtual IToolBar& remove(IWindow* window)

Removes the window from the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Tool Bar Defaults

Use these static members to affect the appearance of all IToolBar objects in the application.


[view class]
defaultGroupPad
public:
static unsigned long defaultGroupPad()

Returns the current number of pixels of padding added between groups in toolbars.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
defaultMargin
public:
static ISize defaultMargin()

Returns the number of pixels of margin added around windows in toolbars. The value returned is the value set by IToolBar::setDefaultMargin.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
defaultMisfitWidth
public:
static unsigned long defaultMisfitWidth()

Returns the current width used to filter oversized windows from toolbars.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
defaultPad
public:
static long defaultPad()

Returns the current default number of pixels used to separate windows in toolbars.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultGroupPad
public:
static void setDefaultGroupPad( unsigned long pixelsOfGroupPad = 8 )

Sets the number of pixels of padding between groups of windows in the toolbar. This pad value is added to any window that returns true from IWindow::isGroup. The padding is only added between groups of windows. The padding is not added before the first window or after the last window in the toolbar.

This setting affects subsequent toolbars. It does not affect toolbars that have already been created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultMargin
public:
static void setDefaultMargin( const ISize& sizeOfMargin = ISize ( 7 , 4 ) )

Sets the number of pixels of margin around windows in the toolbar. The sizeOfMargin value is applied directly to a vertical toolbar and rotated for a horizontal toolbar. In a horizontal toolbar, sizeOfMargin.width is added above and below the windows in the toolbar, and sizeOfMargin.height is added to the left and right of the windows in the toolbar. This enhances the appearance of the toolbar. If you change the location of the toolbar to a location that has a different orientation, the margin values will be rotated. The initial sizeOfMargin value (width and height respectively) is ISize(7,4).

If you later set the margin of a toolbar through ISetCanvas::setMargin, the margin settings are applied directly to the toolbar, regardless of its orientation. However, if you change the location of the toolbar to a location that has a different orientation, the margin values will be rotated.

This setting affects subsequent toolbars. It does not affect toolbars that have already been created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultMisfitWidth
public:
static void setDefaultMisfitWidth( unsigned long maximumWidth = 65 )

Sets the width value to be used for filtering windows when a toolbar contains the style IToolBar::filterMisfits.

The initial setDefaultMisfitWidth is 65 pixels.

This setting affects subsequent toolbars. It does not affect toolbars that have already been created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setDefaultPad
public:
static void setDefaultPad(long pixelsOfPad = - 1)

Sets the number of pixels of padding between windows added to the toolbar. The initial default is to overlap the members of a group by one pel.

This setting affects subsequent toolbars. It does not affect toolbars that have already been created.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Tool Bar Location

Use these members to set and query the tool bar location.


[view class]
isMoveValid
public:
bool isMoveValid(Location newLocation) const

Returns true if the toolbar's position can be changed to the location specified. Use this function to check if a move is valid before calling IToolBar::setLocation.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes

Portability Considerations

On Windows and OS/2, all movements are permitted.

On Motif, movement of the toolbar is restricted as follows: A floating toolbar cannot change to a non-floating state, a non-floating toolbar cannot change to floating state, and a non-floating toolbar cannot change to a location that already contains a toolbar. Additionally, moving a non-floating toolbar from the current location to a new location (assuming the new location does not already contain a toolbar) will move all toolbars from that location to the new location.


[view class]
location
public:
Location location() const

Returns the current location of the toolbar.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
setLocation
public:
virtual IToolBar& setLocation(Location location)

Sets a new location for the toolbar. Certain restrictions apply to movement of toolbars. See IToolBar::isMoveValid for details.

A toolbar's location can be changed while the toolbar is in hidden state. However, the toolbar will not appear in the new location until the toolbar is made visible.

Exception

IInvalidRequest On Motif, the toolbar cannot be changed from its current location to the new location. This is due to operating system restrictions. Before calling this function, call IToolBar::isMoveValid to ensure that the location change is valid.
IInvalidRequest If you create the toolbar container, you must use the ISetCanvas::explicitAddsNeeded style.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


Window Painting

Use these members to display a window and determine the visibility of a window.


[view class]
hide
public:
virtual IToolBar& hide()

Hides the toolbar.

A toolbar positioned in above, below, left or right location is contained in a toolbar container. When this function is called to hide the toolbar, the toolbar is removed from the toolbar container. The toolbar container will then repaint without displaying the toolbar. However, the toolbar is still a child of the toolbar container.

The toolbar's z-order (position relative to sibling windows) is not changed when the toolbar is hidden. If other toolbars exist at the same location as the toolbar being hidden, its position relative to the other toolbars will remain unchanged when the toolbar is subsequently re-shown.

A floating toolbar is contained within a floating frame window. Hiding a floating toolbar hides the floating frame. When a user closes a floating toolbar from the floating frame, internally, hide() is issued on the floating toolbar, which causes the floating frame to be hidden. To re-show the toolbar, you must call show(), even if you have change the toolbar's location while it is hidden.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


[view class]
show
public:
virtual IToolBar& show(bool showWindow = true)

Makes the toolbar visible.

A toolbar positioned in above, below, left or right location is contained in a toolbar container. When this function is called to show the toolbar, the toolbar is added to the toolbar container. The toolbar container will then repaint, displaying the toolbar.

The toolbar's z-order (position relative to sibling windows) was not changed when the toolbar was hidden. If other toolbars exist at the same location as the toolbar, its position relative to the other toolbars will remain unchanged when the toolbar is shown.

A floating toolbar is contained within a floating frame window. Showing a floating toolbar shows the floating frame, which was hidden when the toolbar was hidden. When a user closes a floating toolbar from the floating frame, internally, hide() is issued on the floating toolbar, which causes the floating frame to be hidden. To re-show the toolbar, you must call show(), even if you have change the toolbar's location while it is hidden.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IToolBar - Enumerations


[view class]
Location
enum Location { aboveClient, 
                belowClient, 
                leftOfClient, 
                rightOfClient, 
                floating, 
                hidden }

Use these enumerators to specify the location of the tool bar.

aboveClient
The tool bar is above the client window.
belowClient
The tool bar is below the client window.
leftOfClient
The tool bar is to the left of the client window.
rightOfClient
The tool bar is to the right of the client window.
floating
The tool bar is a child of an enclosing frame window that is a child of the desktop. If a user closes a floating tool bar, the location of the tool bar is set to hidden.
hidden
This location is replaced by the functions IToolBar::hide and IToolBar::show. To hide the toolbar use hide(). To show the toolbar use show(), which will cause the toolbar to reappear in the location it had before it was hidden.

Supported Platforms

Windows OS/2 AIX
Yes Yes Yes


IToolBar - Inherited Member Functions and Data

Inherited Public Functions

ICanvas
IControl
INotifier
ISetCanvas
IWindow

Inherited Public Data

IWindow
INotifier
ICanvas
ISetCanvas

Inherited Protected Functions

IWindow
INotifier
ICanvas
ISetCanvas
IControl

Inherited Protected Data