PtTab

A tab button for initiating an action

Class hierarchy:

PtWidgetPtBasicPtLabelPtTab

For more information, see the diagram of the widget hierarchy.

PhAB icon:

PtTab button in PhAB

Public header:

<photon/PtTab.h>

Description:

The PtTab class draws a tab such as is found on a file folder. Clicking the tab invokes an application callback.


Several PtTab widgets


A group of PtTab widgets positioned at the top of a PtPane.

Instead of using a PtTab, you should use a PtPanelGroup. This is the preferred method, since PtPanelGroup manages all aspects of a tabbed panel for you.

If you insist on using PtTab widgets, you typically:

New resources:

Resource C type Pt type Default
Pt_ARG_TAB_FLAGS unsigned int Flag 0
Pt_ARG_TAB_UNSELECTED_COLOR PgColor_t Scalar PgGray(0xc0)

Pt_ARG_TAB_FLAGS

C type Pt type Default
unsigned int Flag 0

Flags that affect how the widget appears. The defined bits are:

Pt_TAB_UPSIDE_DOWN
Vertically invert the tab; display the rounded corners on the bottom of the widget instead of the top.
Pt_TAB_RIGHTSIDE_LEFT
Horizontally invert the tab.
Pt_TAB_DRAG_HANDLE
Show a textured drag handle within the tab, visually indicating that the associated panel can be pulled away. You need to write some code to support the dragging (PtPanelGroup supports it already).
Pt_TAB_MULTI
Indicate that this tab produces a popup panel of some sort when pressed (the term “multi” is used since, in this case, the tab generally represents multiple choices). You need to write some code to this (PtPanelGroup supports it already).

Pt_ARG_TAB_UNSELECTED_COLOR

C type Pt type Default
PgColor_t Scalar PgGray(0xc0)

The color of the tab when it isn't selected (i.e. not set). See PgColor_t in the Photon Library Reference.

When the tab is set, it gets its color from Pt_ARG_FILL_COLOR (see PtBasic).

Inherited resources:

If the widget modifies an inherited resource, the “Default override” column indicates the new value. This modification affects any subclasses of the widget.

Resource Inherited from Default override
Pt_ARG_ACCEL_KEY PtLabel
Pt_ARG_AREA PtWidget
Pt_ARG_BALLOON_COLOR PtLabel
Pt_ARG_BALLOON_FILL_COLOR PtLabel
Pt_ARG_BALLOON_POSITION PtLabel
Pt_ARG_BALLOON_TEXT PtLabel
Pt_ARG_BANDWIDTH_THRESHOLD PtBasic Not used by this class.
Pt_ARG_BASIC_FLAGS PtBasic
Pt_ARG_BEVEL_WIDTH PtWidget 2
Pt_ARG_BITMAP_CURSOR PtWidget
Pt_ARG_BEVEL_COLOR PtBasic
Pt_ARG_BEVEL_CONTRAST PtBasic
Pt_ARG_COLOR PtBasic
Pt_ARG_CONTRAST PtBasic
Pt_ARG_CURSOR_COLOR PtWidget
Pt_ARG_CURSOR_TYPE PtWidget
Pt_ARG_DARK_BEVEL_COLOR PtBasic
Pt_ARG_DARK_FILL_COLOR PtBasic
Pt_ARG_DATA PtWidget
Pt_ARG_DIM PtWidget
Pt_ARG_EFLAGS PtWidget
Pt_ARG_EXTENT PtWidget
Pt_ARG_FILL_COLOR PtBasic PgGray(170)
Pt_ARG_FILL_PATTERN PtBasic
Pt_ARG_FLAGS PtWidget |=Pt_CLIP_HIGHLIGHT|
Pt_TOGGLE
Pt_ARG_GRID_LAYOUT_DATA PtWidget
Pt_ARG_HEIGHT PtWidget
Pt_ARG_HELP_TOPIC PtWidget
Pt_ARG_HIGHLIGHT_ROUNDNESS PtBasic 3
Pt_ARG_HORIZONTAL_ALIGNMENT PtLabel
Pt_ARG_INLINE_COLOR PtBasic
Pt_ARG_LABEL_BALLOON PtLabel
Pt_ARG_LABEL_IMAGE PtLabel
Pt_ARG_LABEL_FLAGS PtLabel &= ~Pt_LABEL_SELECT_SHIFT
Pt_ARG_LABEL_TYPE PtLabel
Pt_ARG_LAYOUT_DATA PtWidget
Pt_ARG_LIGHT_BEVEL_COLOR PtBasic
Pt_ARG_LIGHT_FILL_COLOR PtBasic
Pt_ARG_LINE_SPACING PtLabel
Pt_ARG_MARGIN_BOTTOM PtLabel
Pt_ARG_MARGIN_HEIGHT PtBasic
Pt_ARG_MARGIN_LEFT PtLabel
Pt_ARG_MARGIN_RIGHT PtLabel
Pt_ARG_MARGIN_TOP PtLabel
Pt_ARG_MARGIN_WIDTH PtBasic
Pt_ARG_MAXIMUM_DIM PtWidget
Pt_ARG_MINIMUM_DIM PtWidget
Pt_ARG_OUTLINE_COLOR PtBasic
Pt_ARG_POINTER PtWidget
Pt_ARG_POS PtWidget
Pt_ARG_RESIZE_FLAGS PtWidget
Pt_ARG_ROW_LAYOUT_DATA PtWidget
Pt_ARG_SECONDARY_H_ALIGN PtLabel
Pt_ARG_SECONDARY_V_ALIGN PtLabel
Pt_ARG_STYLE PtBasic
Pt_ARG_TEXT_FONT PtLabel
Pt_ARG_TEXT_STRING PtLabel
Pt_ARG_TRANS_PATTERN PtBasic
Pt_ARG_UNDERLINE_TYPE PtLabel
Pt_ARG_UNDERLINE1 PtLabel
Pt_ARG_UNDERLINE2 PtLabel
Pt_ARG_USER_DATA PtWidget
Pt_ARG_VERTICAL_ALIGNMENT PtLabel
Pt_ARG_WIDTH PtWidget
Pt_CB_ACTIVATE PtBasic
Pt_CB_ARM PtBasic
Pt_CB_BLOCKED PtWidget
Pt_CB_DESTROYED PtWidget
Pt_CB_DISARM PtBasic
Pt_CB_DND PtWidget
Pt_CB_FILTER PtWidget
Pt_CB_GOT_FOCUS PtBasic
Pt_CB_HOTKEY PtWidget
Pt_CB_IS_DESTROYED PtWidget
Pt_CB_LOST_FOCUS PtBasic
Pt_CB_MENU PtBasic
Pt_CB_OUTBOUND PtWidget
Pt_CB_RAW PtWidget
Pt_CB_REALIZED PtWidget
Pt_CB_REPEAT PtBasic
Pt_CB_UNREALIZED PtWidget

Convenience functions:

The PtTab widget defines the following macros that make it easier to use the tab once it's been created:

PtTabIsUpsideDown()
Return a nonzero value if the tab is upside down, 0 otherwise
PtTabIsRightsideUp()
Return a nonzero value if the tab is rightside up, 0 otherwise
PtTabIsRightsideLeft()
Return a nonzero value if the tab is flipped left-to-right, 0 otherwise
PtTabIsRightsideRight()
Return a nonzero value if the tab isn't flipped left-to-right, 0 otherwise
PtTabIsDraggable()
Return a nonzero value if the panel can be dragged away, 0 otherwise
PtTabIsMulti()
Return a nonzero value if the tab produces a popup panel of some sort when pressed, 0 otherwise
PtTabDragHandleRect()
Retrieve the rectangle that encompasses the drag area of the tab