previous chapter contents page top page next chapter


HasButtonInTitleBar

March 15, 1996

mixes in with TitledWindow;

Class Description

Some titled windows have a button in the title bar that allows users to perform an action on the window contents. For example, the trash window has an empty button if there are any object in the trash, and annotation windows have an erase button if the annotation contains any scribbles. You can add a button to your window's title bar by mixing in class HasButtonInTitleBar.

Programming information

Instantiate: never
Subclass: sometimes
Call its methods: rarely

You might create a subclass that mixes in this class if you want to have a titled window that has a button in its title bar.

Methods defined by class HasButtonInTitleBar

Class HasButtonInTitleBar defines the following methods:

Method Description
ButtonBox Returns box used for button in title bar.
ButtonIsShowing Returns whether button in title bar is visible.
SetButtonIsShowing Shows or hides button in title bar.
Draw Overridden to draw button in title bar.
Tap Overridden to handle taps on button in title bar.

Fields defined by class HasButtonInTitleBar

Class HasButtonInTitleBar defines the following fields:

Field Type Description
Defined by class HasButtonInTitleBar
buttonBorder Border Border of button in title bar
buttonWidth Micron Width of button in title bar
closeBoxMargin Micron Distance from right edge of button to close box
buttonName Text Name of button in title bar
buttonTarget Object Object operated on by button in title bar
buttonOperation OperationNumber Operation number called by button in title bar
buttonIsShowing Boolean Indicates whether button is showing

Method Descriptions

ButtonBox

operation ButtonBox()
Call: rarely
Override: rarely

Magic Cap calls ButtonBox to get the content box of the button in the title bar.

ButtonIsShowing

attribute ButtonIsShowing: Boolean
// operation ButtonIsShowing: Boolean
// operation SetButtonIsShowing(newValue)
Call: sometimes
Override: rarely

The attribute ButtonIsShowing indicates whether the button is currently visible in the title bar. Call SetButtonIsShowing if you want to show or hide the button.

Draw

overrides Draw
Call: rarely
Override: sometimes

Class HasButtonInTitleBar overrides Draw to draw or remove the button in the title bar.

Tap

overrides Tap
Call: rarely
Override: sometimes

Class HasButtonInTitleBar overrides Tap to track user touches on the button in the title bar, if it is visible. If the user touches the button, Magic Cap calls the operation in the responder's buttonOperation field on the object in the responder's buttonTarget field.