PegRadioButtons support the style flags AF_ENABLED and BF_SELECTED. They
send the PSF_DOT_ON and PSF_DOT_OFF signals.
CPDropDownButton
Class Name Derived From Styles Signals
CPDropDownButton PegBitmapButton BF_REPEAT
BF_DOWNACTION
BF_SELECTED
AF_ENABLED
PSF_SIZED
PSF_FOCUS_RECEIVED
PSF_FOCUS_LOST
PSF_KEY_RECEIVED
PSF_CLICKED
CPDropDownButtons are used by many applications on the ClassPad. They allow a user
to select an item from a list of bitmap buttons. For example, the tool selection dropdown
in the Geometry toolbar is a CPDropDownButton.
Much like the menus that we looked at before, CPDropDownButtons have a descriptor to
define what items it will include. Here is an example of a descriptor:
struct CPMultiButtonDescription buttons[] =
{
{&gbsmileBitmap, SMILE_ID},
{&gbcontentBitmap, CONTENT_ID},
{&gbsadBitmap, SAD_ID},
{NULL, NULL},
};
Each entry in a CPMultiButtonDescriptor defines a button that will be in the drop down
list. Each button must define the PegBitmap that it will display and its Object ID. The
last entry in the list is a pair of NULLs.
Here is an example of creating a CPDropDownButton in the AddUI function of a module
window with the buttons[] descriptor:
void YOURWINDOW::AddUI()
{
PegRect r = GetToolbarButtonRect();
CPDropDownButton *button = new CPDropDownButton(r, buttons);
m_ui->AddToolbarButton(button);
}
The result is a dropdown button with three bitmap buttons. Selecting one button makes it
visible and closes the dropdown.
68