Menu Class Reference

#include <Pt/Forms/Menu.h>

Represents a popup menu containing commands and nested menus. More...

Inherits Popup, and MenuBase.

Public Types

typedef WindowType Type
 Defines the window frame type.
 
typedef WindowState State
 Defines the window presentation state type.
 
enum  FocusPolicy {
  NoFocus,
  AcceptFocus,
  KeepFocus
}
 Defines whether a control can receive or retain focus. More...
 

Public Member Functions

 Menu ()
 Creates a detached popup menu.
 
virtual ~Menu ()
 Destroys the menu.
 
double iconWidth () const
 Returns the width reserved for item icons.
 
const Pt::Gfx::Brushbackground () const
 Returns the background brush. More...
 
void setBackground (const Pt::Gfx::Brush &b)
 Sets a local background brush.
 
const Pt::Gfx::Pencontour () const
 Returns the contour pen. More...
 
void setContour (const Pt::Gfx::Pen &p)
 Sets a local contour pen.
 
void addItem (MenuItem &item)
 Adds command item to this menu. More...
 
void addItem (MenuSubItem &item)
 Adds submenu entry item to this menu. More...
 
void removeItem (MenuItem &item)
 Removes command item from this menu.
 
void removeItem (MenuSubItem &item)
 Removes submenu entry item from this menu.
 
Widgetanchor ()
 Returns the anchor widget, or 0 when none is set.
 
void setAnchor (Widget *anchor=0)
 Relates this popup to anchor for popup input handling. More...
 
void setParent (WindowManager &parent)
 Attaches the window to parent. More...
 
void unparent ()
 Detaches the window from its current manager. More...
 
WindowManagerwindowManager ()
 Returns the current non-owning window manager, or null.
 
const WindowManagerwindowManager () const
 Returns the current non-owning window manager, or null.
 
WindowFrame * frame ()
 Returns the internal frame that presents the window, or null. More...
 
const WindowFrame * frame () const
 Returns the internal frame that presents the window, or null.
 
void getBitmap (Gfx::Bitmap &bitmap) const
 Copies the complete window content into bitmap. More...
 
void getBitmap (Gfx::Bitmap &bitmap, const Gfx::RectF &rect) const
 Copies a window content rectangle into bitmap. More...
 
void autoCenter ()
 Centers the window in its manager's available area. More...
 
void autoSize (const SizePolicy &policy)
 Enables automatic sizing with policy. More...
 
void autoSize ()
 Enables automatic sizing with preferred width and height.
 
Type type () const
 Returns the type selected when the window was created.
 
const Gfx::Imageicon () const
 Returns the window icon.
 
void setIcon (const Gfx::Image &icon)
 Sets the window icon to a copy of icon. More...
 
const std::string & title () const
 Returns the window title.
 
void setTitle (const std::string &title)
 Sets the window title to title. More...
 
bool isAbove () const
 Returns whether the window requests manager-relative stacking.
 
void setAbove (bool above)
 Changes the manager-relative stacking preference to above. More...
 
bool isActive () const
 Returns the current locally stored activation state.
 
WindowState state () const
 Returns the requested window state.
 
void setState (const WindowState &state)
 Sets the requested window state to state. More...
 
void showModal ()
 Runs the window as a modal dialog until it closes. More...
 
bool isClosed () const
 Returns whether a close event has completed the close transition.
 
void close ()
 Requests that the current frame close the window. More...
 
Signalclosed ()
 Returns the signal sent after the close transition completes.
 
bool acceptsInput () const
 Returns whether the window accepts pointer, touch, scroll, and keyboard input. More...
 
Controlcontent ()
 Returns the current content control, or 0 when none is attached.
 
const Controlcontent () const
 Returns the current content control, or 0 when none is attached.
 
void setContent (Control *control)
 Replaces the content root with control. More...
 
Gfx::SizeF measure (const SizePolicy &policy)
 Measures the preferred content size for policy. More...
 
void relayout ()
 Queues a layout pass while the form is connected. More...
 
ControlfocusControl ()
 Returns the focused control, or 0 when no control has focus.
 
void focusNext ()
 Moves focus to the next eligible control. More...
 
void focusPrev ()
 Moves focus to the previous eligible control. More...
 
Gfx::PointF toControl (const Control &control, const Gfx::PointF &pos) const
 Converts pos from this view to control coordinates. More...
 
Gfx::PointF fromControl (const Control &control, const Gfx::PointF &pos) const
 Converts pos from control to this view coordinates. More...
 
PaintSurfacesurface ()
 Returns this view's local paint-surface adapter. More...
 
const PaintSurfacesurface () const
 Returns this view's local paint-surface adapter.
 
void setSurface (PaintSurface *surface, const Gfx::PointF &pos=Gfx::PointF())
 Assigns the surface on which this view displays its controls. More...
 
Pt::uint64_t id () const
 Returns the application-unique ID of this live widget.
 
const std::string & name () const
 Returns the optional name.
 
void setName (const std::string &n)
 Sets the optional name immediately.
 
void setNextResponder (Responder *r)
 Sets the next responder for unhandled input. More...
 
bool isConnected () const
 Returns true when the widget is connected to a screen.
 
Screenscreen ()
 Returns the connected screen, or 0 when disconnected.
 
const Screenscreen () const
 Returns the connected screen, or 0 when disconnected.
 
Widgetparent ()
 Returns the non-owning parent, or 0 when unparented.
 
const Widgetparent () const
 Returns the non-owning parent, or 0 when unparented.
 
bool isDescendantOf (const Widget &top) const
 Returns true when this widget is a strict descendant of top.
 
bool isAncestorOf (const Widget &child) const
 Returns true when this widget is a strict ancestor of child.
 
WidgethitTest (const Gfx::PointF &pos)
 Returns the descendant hit at local position pos. More...
 
Gfx::PointF toParent (const Gfx::PointF &pos) const
 Converts local position pos to parent coordinates.
 
Gfx::PointF fromParent (const Gfx::PointF &pos) const
 Converts parent position pos to local coordinates.
 
Gfx::PointF toGlobal (const Gfx::PointF &pos) const
 Converts local position pos to global coordinates. More...
 
Gfx::PointF fromGlobal (const Gfx::PointF &pos) const
 Converts global position pos to local coordinates. More...
 
void addPeer (Widget &peer)
 Adds a bidirectional, non-owning peer association with peer. More...
 
void removePeer (Widget &peer)
 Removes the bidirectional peer association with peer. More...
 
void invalidate ()
 Queues a coalesced invalidation. More...
 
virtual void repaint (const Gfx::RectF &rect)
 Requests repainting local dirty rectangle rect. More...
 
virtual void repaint ()
 Requests repainting the complete local bounds.
 
double scaleFactor () const
 Returns the current logical-to-device scale factor.
 
const Gfx::Scalingscaling () const
 Returns the current logical-to-device scaling.
 
bool isVisible () const
 Returns whether the last show event made the widget visible.
 
virtual void show (bool b=true)
 Requests that the widget be shown or hidden. More...
 
bool isEnabled () const
 Returns whether the last enable event made the widget enabled.
 
virtual void enable (bool isEnable=true)
 Requests that the widget be enabled or disabled. More...
 
void activate (bool active=true)
 Requests that the widget become active or inactive. More...
 
const Gfx::PointFposition () const
 Returns the position in parent logical coordinates.
 
virtual void move (const Gfx::PointF &pos)
 Requests a new parent-local position pos. More...
 
const Gfx::SizeFsize () const
 Returns the size in local logical coordinates.
 
const Gfx::RectFbounds () const
 Returns local bounds, whose origin is always local zero.
 
const Gfx::SizeFminimumSize () const
 Returns the locally stored minimum size. More...
 
void setMinimumSize (const Gfx::SizeF &s)
 Sets the local minimum size and notifies the size-limit hook. More...
 
void setMinimumSize (double w, double h)
 Sets the local minimum width and height.
 
void setMinimumWidth (double w)
 Sets the local minimum width.
 
void setMinimumHeight (double h)
 Sets the local minimum height.
 
const Gfx::SizeFmaximumSize () const
 Returns the locally stored maximum size. More...
 
void setMaximumSize (const Gfx::SizeF &s)
 Sets the local maximum size and notifies the size-limit hook. More...
 
void setMaximumSize (double w, double h)
 Sets the local maximum width and height.
 
void setMaximumWidth (double w)
 Sets the local maximum width.
 
void setMaximumHeight (double h)
 Sets the local maximum height.
 
virtual void resize (const Gfx::SizeF &s)
 Requests a new local size s. More...
 
void setCapture (bool capture)
 Requests pointer input capture or release. More...
 
const Cursor * cursor () const
 Returns this widget's cursor or the default cursor. More...
 
void setCursor (const Cursor *c)
 Sets a local cursor override. More...
 
void processEvent (const Pt::Event &ev)
 Processes ev through this widget's event dispatcher. More...
 
Pt::Signal< const Pt::Event & > & eventReceived ()
 Returns the event dispatcher signal. More...
 
bool mouseEvent (const MouseEvent &ev)
 Delivers ev along the mouse responder chain. More...
 
void touchEvent (const TouchEvent &ev)
 Delivers ev along the touch responder chain. More...
 
void scrollEvent (const ScrollEvent &ev)
 Delivers ev along the scroll responder chain.
 
void enterEvent (const EnterEvent &ev)
 Delivers ev along the enter responder chain.
 
void leaveEvent (const LeaveEvent &ev)
 Delivers ev along the leave responder chain.
 
void keyEvent (const KeyEvent &ev)
 Delivers ev along the key responder chain.
 

Protected Member Functions

virtual void onInvalidate ()
 Updates the cached background and repaints the complete window.
 
virtual void onPaint (PaintContext &ctx, const Pt::Gfx::RectF &rect)
 Fills rect with the current window background.
 
virtual void onCloseEvent (const Pt::Forms::CloseEvent &ev)
 Hides, detaches, closes, and sends closed().
 
virtual void onShowEvent (const Pt::Forms::ShowEvent &ev)
 Processes event and invalidates the window.
 
virtual bool onMouseEvent (const Pt::Forms::MouseEvent &ev)
 Handles a mouse event and returns whether it was consumed.
 
virtual bool onEnterEvent (const Pt::Forms::EnterEvent &ev)
 Restores the default cursor, handles the event, and returns consumption.
 
virtual bool onLeaveEvent (const Pt::Forms::LeaveEvent &ev)
 Handles a pointer-leave event and returns whether it was consumed.
 
void onProcessMouseEvent (const Pt::Forms::MouseEvent &ev)
 Routes event when the window accepts input.
 
virtual void onAttachPeer (Widget &peer)
 Attaches non-owning peer peer. More...
 
virtual void onDetachPeer (Widget &peer)
 Detaches non-owning peer peer. More...
 
virtual void onProcessTouchEvent (const TouchEvent &ev)
 Routes event when the window accepts input.
 
virtual Gfx::SizeF onProcessMeasure ()
 Updates automatic sizing and performs the standard measurement.
 
virtual void onProcessLayout (const Gfx::RectF &rect)
 Applies automatic sizing and performs the standard layout.
 
virtual Gfx::SizeF onMeasure (const SizePolicy &policy)
 Measures the content with policy.
 
virtual void onLayout (const Gfx::RectF &rect)
 Lays out the content in rect.
 
virtual void onConnect (Screen &screen)
 Connects the window and applies its stored frame configuration. More...
 
virtual void onDisconnect ()
 Disconnects the window form from its screen.
 
virtual WidgetonHitTest (const Gfx::PointF &point)
 Finds the deepest visible widget at point. More...
 
virtual Gfx::PointF onToParent (const Gfx::PointF &pos) const
 Converts window coordinates pos to parent coordinates.
 
virtual Gfx::PointF onFromParent (const Gfx::PointF &pos) const
 Converts parent coordinates pos to window coordinates.
 
virtual void onProcessEvent (const Pt::Event &ev)
 Dispatches event through the standard form event path.
 
virtual void onRequestRepaint (const Gfx::RectF &rect)
 Requests repainting rect from the current frame.
 
virtual void onRequestEnable (bool enabled)
 Stores and forwards the enabled request enabled.
 
virtual void onRequestActivate (bool active)
 Stores and forwards the activation request active.
 
virtual void onRequestShow (bool shown)
 Stores the visibility request shown and presents the window. More...
 
virtual void onRequestMove (const Gfx::PointF &pos)
 Records and forwards a normal-state move request to pos. More...
 
virtual void onRequestResize (const Gfx::SizeF &size)
 Records and forwards a normal-state resize request to size.
 
virtual void onSetSizeLimits (const Gfx::SizeF &minSize, const Gfx::SizeF &maxSize)
 Applies and forwards the size limits to the current frame.
 
virtual void onInvalidateEvent (const InvalidateEvent &ev)
 Processes an invalidation event through the standard form path.
 
virtual void onProcessPaintEvent (const PaintEvent &event)
 Paints a visible, non-empty dirty region from event.
 
virtual void onProcessRescaleEvent (const RescaleEvent &ev)
 Processes a scale event through the standard form path.
 
virtual void onRescaleEvent (const RescaleEvent &ev)
 Handles a scale event after standard form processing.
 
virtual void onRescale (double scaling)
 Updates scaling and realigns normal-state window geometry.
 
virtual void onProcessMoveEvent (const MoveEvent &ev)
 Processes a move event through the standard form path.
 
virtual void onMoveEvent (const MoveEvent &ev)
 Updates move state without repainting the window surface.
 
virtual void onProcessResizeEvent (const ResizeEvent &ev)
 Processes a resize event through the standard form path.
 
virtual void onResizeEvent (const ResizeEvent &ev)
 Updates resize state and the requested window size.
 
virtual void onProcessShowEvent (const ShowEvent &ev)
 Processes a visibility event through the standard form path.
 
virtual void onShow (bool visible)
 Updates the visible state to visible.
 
virtual void onProcessEnableEvent (const EnableEvent &ev)
 Processes an enabled event without enabling against a disable request.
 
virtual void onEnableEvent (const EnableEvent &ev)
 Handles an enabled event through the standard form path.
 
virtual void onEnable (bool enabled)
 Updates the enabled state to enabled and invalidates the window.
 
virtual void onProcessActivateEvent (const ActivateEvent &event)
 Dispatches event to onActivateEvent().
 
virtual void onActivateEvent (const ActivateEvent &event)
 Updates the active state from event.
 
virtual void onProcessWindowStateEvent (const WindowStateEvent &event)
 Dispatches event to onWindowStateEvent().
 
virtual void onWindowStateEvent (const WindowStateEvent &event)
 Updates the window state from event.
 
virtual void onProcessCloseEvent (const CloseEvent &event)
 Dispatches event to onCloseEvent().
 
virtual void onProcessScrollEvent (const ScrollEvent &event)
 Routes event when the window accepts input.
 
virtual void onProcessEnterEvent (const EnterEvent &event)
 Routes the pointer-entry event.
 
virtual void onProcessLeaveEvent (const LeaveEvent &event)
 Routes the pointer-leave event.
 
virtual void onProcessKeyEvent (const KeyEvent &event)
 Routes event when the window accepts input.
 
virtual bool onTouchEvent (const TouchEvent &ev)
 Handles a touch event and returns whether it was consumed.
 
virtual bool onScrollEvent (const ScrollEvent &ev)
 Handles a scroll event and returns whether it was consumed.
 
virtual bool onKeyEvent (const KeyEvent &ev)
 Handles a key event and returns whether it was consumed.
 
virtual void onRequestRelayout ()
 Queues the layout event for a requested layout pass.
 
virtual void onProcessLayoutEvent (const LayoutEvent &ev)
 Processes a queued layout event. More...
 
virtual void onAddElement (Control &control)
 Registers control for focus traversal, shortcuts, and mnemonics.
 
virtual void onRemoveElement (Control &control)
 Removes control from focus traversal, shortcuts, and mnemonics.
 
virtual void onSetFocusPolicy (Control &control, FocusPolicy policy)
 Updates focus after control changes to policy.
 
virtual void onSetFocusIndex (Control &control, unsigned index)
 Updates the focus order after control changes its focus index.
 
virtual void onSetFocus (Control &control)
 Gives focus to control and sends the corresponding focus events. More...
 
virtual void onSetShortcut (Control &control, const std::vector< Key > &keys)
 Replaces the shortcut registrations for control with keys.
 
virtual void onSetMnemonic (Control &control, const std::vector< Char > &chs)
 Replaces the mnemonic registrations for control with chs.
 
virtual void onSetSurface (PaintSurface *surface, const Gfx::PointF &pos)
 Assigns the paint surface and translates it to the content root.
 
virtual void onAttach (Control &control)
 Handles attachment of control to this form.
 
virtual void onDetach (Control &control)
 Handles detachment of control from this form.
 
virtual void onInit (Control &control)
 Connects control to this form's screen and responder chain.
 
virtual void onRelease (Control &control)
 Disconnects control from this form's screen and responder chain.
 
virtual Gfx::PointF onToControl (const Control &control, const Gfx::PointF &pos) const
 Converts form-local pos to coordinates local to control.
 
virtual Gfx::PointF onFromControl (const Control &control, const Gfx::PointF &pos) const
 Converts coordinates local to control into form-local pos.
 
virtual void onRepaintRequest (Control &control, const Gfx::RectF &rect)
 Translates a repaint request from control to form coordinates.
 
virtual void onRelayoutRequest (Control &control)
 Queues a form layout after a request from control.
 
virtual void onEnableRequest (Control &control, bool isEnable)
 Delivers an effective enable state to control. More...
 
virtual void onActivateRequest (Control &control, bool active)
 Makes control the active input target when active is true. More...
 
virtual void onShowRequest (Control &control, bool isShown)
 Delivers a visibility request to control.
 
virtual void onMoveRequest (Control &control, const Gfx::PointF &pos)
 Aligns and commits a move request for control.
 
virtual void onResizeRequest (Control &control, const Gfx::SizeF &size)
 Aligns and commits a resize request for control.
 
virtual void onRaiseRequest (Control &control)
 Receives a request to raise control. More...
 
virtual void onRequestCapture (bool capture)
 Forwards a pointer capture request to the Forms application.
 
virtual void onPaintEvent (const PaintEvent &ev)
 Paints the form's own view content. More...
 
const std::map< Key, Control * > & shortcuts () const
 Returns the shortcut-to-control registrations for this form.
 
const std::map< Pt::Char, Control * > & mnemonics () const
 Returns the mnemonic-to-control registrations for this form.
 
virtual void onSetParent (Widget *parent)
 Records the non-owning parent relationship. More...
 
virtual Gfx::PointF onToGlobal (const Gfx::PointF &pos) const
 Converts local position pos to global coordinates. More...
 
virtual Gfx::PointF onFromGlobal (const Gfx::PointF &pos) const
 Converts global position pos to local coordinates. More...
 
virtual void onProcessInvalidateEvent (const InvalidateEvent &ev)
 Coalesces and dispatches an invalidation event.
 
virtual ResponderonNextResponder ()
 Returns the non-owning next responder, or 0.
 
virtual bool onMousePress (const MouseEvent &ev)
 Handles a mouse press. The default returns false.
 
virtual bool onMouseRelease (const MouseEvent &ev)
 Handles a mouse release. The default returns false.
 
virtual bool onMouseMove (const MouseEvent &ev)
 Handles a mouse move. The default returns false.
 
void cancel ()
 Cancels the active menu interaction.
 
Pt::Forms::WidgetfindMenu (const Pt::Gfx::PointF &screenPos)
 Returns the menu widget at screenPos, or 0 when none is found.
 
void closeMenu (MenuSubItem &item)
 Closes the submenu associated with item.
 
void openMenu (MenuSubItem &item)
 Opens the submenu associated with item.
 
const MenuItemBaseparentItem () const
 Returns the item associated with this nested menu, or 0 for a root menu.
 
MenuItemBaseparentItem ()
 Returns the item associated with this nested menu, or 0 for a root menu.
 
void setParentItem (MenuItemBase *item)
 Associates this nested menu with item. More...
 
void addMenu (MenuSubItem &item)
 Registers item as a submenu entry.
 
void removeMenu (MenuSubItem &item)
 Unregisters item as a submenu entry.
 

Detailed Description

Use a Menu for commands chosen from a vertical popup list, including a context menu or the menu opened by a MenuBarItem. Add MenuItem objects for commands and MenuSubItem objects for nested menus. The menu does not own its items; remove an item before destroying it.

A menu derives its default background and contour from the application style during invalidation. setBackground() and setContour() supply local overrides for this menu. A nested menu is opened and positioned by its associated submenu item.

Pt::Forms::Menu fileMenu;
openItem.setText("Open");
fileMenu.addItem(openItem);

Member Enumeration Documentation

◆ FocusPolicy

enum FocusPolicy
inherited
Enumerator
NoFocus 

The control cannot receive focus.

AcceptFocus 

The control participates in normal focus navigation.

KeepFocus 

The control retains focus during focus navigation.

Member Function Documentation

◆ background()

const Pt::Gfx::Brush& background ( ) const

Returns the local override when one was set; otherwise returns the application style background brush.

◆ contour()

const Pt::Gfx::Pen& contour ( ) const

Returns the local override when one was set; otherwise returns the application style contour pen.

◆ addItem() [1/2]

void addItem ( MenuItem item)

The menu does not own item. Keep it alive until it is removed.

◆ addItem() [2/2]

void addItem ( MenuSubItem item)

The menu does not own item. Keep it alive until it is removed.

◆ setAnchor()

void setAnchor ( Widget anchor = 0)
inherited

Pass 0 to clear the anchor. The popup does not own anchor. Pointer and touch input that hits the anchor or one of its descendants is routed to the anchor instead of the popup. The anchor does not position or size the popup.

◆ onAttachPeer()

virtual void onAttachPeer ( Widget peer)
protectedvirtualinherited

The base implementation stores the peer. Overrides that retain the association must call this implementation.

Reimplemented from Widget.

◆ onDetachPeer()

virtual void onDetachPeer ( Widget peer)
protectedvirtualinherited

The base implementation removes one stored association. Overrides that retain the association must call this implementation.

Reimplemented from Widget.

◆ setParent()

void setParent ( WindowManager parent)
inherited

Detaches the window from its current manager first. Reattaching a closed window clears its closed state. Calling this function with the current manager has no effect.

◆ unparent()

void unparent ( )
inherited

Does nothing while the window is detached.

◆ frame()

WindowFrame* frame ( )
inherited

The frame is released when the window detaches. Do not retain it.

◆ getBitmap() [1/2]

void getBitmap ( Gfx::Bitmap bitmap) const
inherited

The window must be attached to provide bitmap content.

◆ getBitmap() [2/2]

void getBitmap ( Gfx::Bitmap bitmap,
const Gfx::RectF rect 
) const
inherited

rect is in window logical coordinates. The copied area is the intersection with the window content. If the intersection is empty, bitmap is reset to empty.

◆ autoCenter()

void autoCenter ( )
inherited

Defers the request until the window connects when called before connection.

◆ autoSize()

void autoSize ( const SizePolicy policy)
inherited

A connected window is measured immediately and requests the resulting size. Subsequent measurement and layout can update the size as its content changes.

◆ setIcon()

void setIcon ( const Gfx::Image icon)
inherited

Updates the frame immediately when the window is attached.

◆ setTitle()

void setTitle ( const std::string &  title)
inherited

Updates the frame immediately when the window is attached.

◆ setAbove()

void setAbove ( bool  above)
inherited

This is not an operating-system-wide always-on-top setting.

◆ setState()

void setState ( const WindowState state)
inherited

A connected window forwards the request to its frame.

◆ showModal()

void showModal ( )
inherited

The method enables and shows this window, disables the screen's other top-level windows, and processes application events until a close event completes. It then enables those windows and restores activation to the window that was active when modal operation started.

◆ close()

void close ( )
inherited

Closing is asynchronous. A processed close event hides and detaches the window, marks it closed, and sends closed().

◆ acceptsInput()

bool acceptsInput ( ) const
inherited

A window accepts input only while it is visible and enabled.

◆ onConnect()

virtual void onConnect ( Screen screen)
protectedvirtualinherited

Overrides must call the base implementation to apply geometry, title, icon, state, visibility, enabled state, and activation.

Reimplemented from Form.

◆ onHitTest()

virtual Widget* onHitTest ( const Gfx::PointF point)
protectedvirtualinherited

Returns this window when point is inside its bounds but does not hit its content.

Reimplemented from Form.

◆ onRequestShow()

virtual void onRequestShow ( bool  shown)
protectedvirtualinherited

An unattached window is added to the primary screen's manager.

Reimplemented from Widget.

◆ onRequestMove()

virtual void onRequestMove ( const Gfx::PointF pos)
protectedvirtualinherited

Cancels pending automatic centering.

Reimplemented from Widget.

◆ setContent()

void setContent ( Control control)
inherited

The form detaches the previous root before attaching control. Passing 0 removes the current root. The form borrows control; it must remain alive until it has been detached.

◆ measure()

Gfx::SizeF measure ( const SizePolicy policy)
inherited

The default implementation delegates to the content control. It returns the policy size when no content is attached.

◆ relayout()

void relayout ( )
inherited

Repeated calls before the queued layout event is processed are combined into one measure and layout pass.

◆ onProcessLayoutEvent()

virtual void onProcessLayoutEvent ( const LayoutEvent &  ev)
protectedvirtualinherited

The default implementation measures the content first and then lays it out.

◆ focusNext()

void focusNext ( )
inherited

Focus traversal follows increasing focus indices, wraps at the end, and skips controls whose focus policy is NoFocus.

◆ focusPrev()

void focusPrev ( )
inherited

Focus traversal follows decreasing focus indices, wraps at the beginning, and skips controls whose focus policy is NoFocus.

◆ onSetFocus()

virtual void onSetFocus ( Control control)
protectedvirtualinherited

A control with KeepFocus prevents focus from moving to another control.

◆ onEnableRequest()

virtual void onEnableRequest ( Control control,
bool  isEnable 
)
protectedvirtualinherited

A disabled form cannot enable its content. The default implementation sends an EnableEvent directly to control.

Reimplemented from View.

◆ onActivateRequest()

virtual void onActivateRequest ( Control control,
bool  active 
)
protectedvirtualinherited

The active control receives scroll and keyboard events before form-level shortcut, mnemonic, and focus handling.

Reimplemented from View.

◆ onRaiseRequest()

virtual void onRaiseRequest ( Control control)
protectedvirtualinherited

A form has one content root, so the default implementation does not change stacking order.

Reimplemented from View.

◆ onPaintEvent()

virtual void onPaintEvent ( const PaintEvent ev)
protectedvirtualinherited

The default implementation uses the standard View paint context and does not add form-specific drawing.

Reimplemented from View.

◆ toControl()

Gfx::PointF toControl ( const Control control,
const Gfx::PointF pos 
) const
inherited

The default conversion subtracts the control position. Override onToControl() when the hosted control uses a different coordinate mapping.

◆ fromControl()

Gfx::PointF fromControl ( const Control control,
const Gfx::PointF pos 
) const
inherited

The default conversion adds the control position. Override onFromControl() when the hosted control uses a different coordinate mapping.

◆ surface()

PaintSurface& surface ( )
inherited

The adapter exposes this view's size, scaling, and position on the surface assigned with setSurface(). It remains available while no parent surface is assigned, but cannot then obtain a canvas.

◆ setSurface()

void setSurface ( PaintSurface surface,
const Gfx::PointF pos = Gfx::PointF() 
)
inherited

The view borrows surface and does not destroy it. Pass null to detach the view from its parent surface. pos identifies this view's origin in the assigned surface and is used to establish child-control surface positions.

◆ setNextResponder()

void setNextResponder ( Responder r)
inherited

The widget does not own r. Do not create a responder cycle.

◆ hitTest()

Widget* hitTest ( const Gfx::PointF pos)
inherited

Returns 0 when no descendant is hit. Derived classes implement their child hit-testing policy in onHitTest().

◆ toGlobal()

Gfx::PointF toGlobal ( const Gfx::PointF pos) const
inherited

The default conversion walks the parent chain.

◆ fromGlobal()

Gfx::PointF fromGlobal ( const Gfx::PointF pos) const
inherited

The default conversion walks the parent chain.

◆ addPeer()

void addPeer ( Widget peer)
inherited

Peers are not a parent, child, or screen connection and do not transfer ownership. Add a relationship only once. Both endpoints receive onAttachPeer().

◆ removePeer()

void removePeer ( Widget peer)
inherited

Both endpoints receive onDetachPeer().

◆ invalidate()

void invalidate ( )
inherited

The Forms event loop eventually calls onInvalidateEvent() after all pending invalidation requests for this widget have coalesced.

◆ repaint()

virtual void repaint ( const Gfx::RectF rect)
virtualinherited

The containing view, frame, or backend converts and forwards the rectangle. This does not paint synchronously.

◆ show()

virtual void show ( bool  b = true)
virtualinherited

isVisible() changes only when the request is confirmed by a ShowEvent.

◆ enable()

virtual void enable ( bool  isEnable = true)
virtualinherited

isEnabled() changes only when the request is confirmed by an EnableEvent.

◆ activate()

void activate ( bool  active = true)
inherited

Activation is defined by the receiving parent, frame, or backend.

◆ move()

virtual void move ( const Gfx::PointF pos)
virtualinherited

position() changes only when a MoveEvent confirms the request.

◆ minimumSize()

const Gfx::SizeF& minimumSize ( ) const
inherited

New widgets use (0, 0).

◆ setMinimumSize()

void setMinimumSize ( const Gfx::SizeF s)
inherited

This does not resize the widget or validate it against the maximum size. The receiver of onSetSizeLimits() applies the limits.

◆ maximumSize()

const Gfx::SizeF& maximumSize ( ) const
inherited

New widgets use (64000, 64000).

◆ setMaximumSize()

void setMaximumSize ( const Gfx::SizeF s)
inherited

This does not resize the widget or validate it against the minimum size. The receiver of onSetSizeLimits() applies the limits.

◆ resize()

virtual void resize ( const Gfx::SizeF s)
virtualinherited

size() and bounds() change only when a ResizeEvent confirms the request.

◆ setCapture()

void setCapture ( bool  capture)
inherited

Capture is owned by the application and routes pointer input to this widget until released. It is released during destruction.

◆ cursor()

const Cursor* cursor ( ) const
inherited

The returned cursor is always non-null and is owned by the widget or the Forms runtime.

◆ setCursor()

void setCursor ( const Cursor *  c)
inherited

Pass 0 to remove the override and restore the default cursor. The cursor is copied, so the caller retains ownership of c. When this widget is under the pointer, the platform cursor is updated immediately.

◆ processEvent()

void processEvent ( const Pt::Event ev)
inherited

Use the state-request APIs for ordinary operation. This method is for backends, tests, and code that deliberately injects events.

◆ eventReceived()

Pt::Signal<const Pt::Event&>& eventReceived ( )
inherited

Internal event-processing slots are connected to this signal. Additional slots can observe or process deliberately dispatched widget events.

◆ onSetParent()

virtual void onSetParent ( Widget parent)
protectedvirtualinherited

Container classes call this while attaching or detaching the widget. Overrides that retain the base relationship must call this implementation.

◆ onToGlobal()

virtual Gfx::PointF onToGlobal ( const Gfx::PointF pos) const
protectedvirtualinherited

The base implementation walks the parent chain through onToParent().

Implements Responder.

Reimplemented in Screen.

◆ onFromGlobal()

virtual Gfx::PointF onFromGlobal ( const Gfx::PointF pos) const
protectedvirtualinherited

The base implementation walks the parent chain through onFromParent().

Implements Responder.

Reimplemented in Screen.

◆ mouseEvent()

bool mouseEvent ( const MouseEvent ev)
inherited

Converts the position to each responder's local coordinates. Returns true when a responder handles the event.

◆ touchEvent()

void touchEvent ( const TouchEvent ev)
inherited

Converts the position to each responder's local coordinates.

◆ setParentItem()

void setParentItem ( MenuItemBase item)
inherited

The menu does not own item.

void setText(const Pt::String &t)
Sets the item text.
void addItem(MenuItem &item)
Adds command item to this menu.
Represents a popup menu containing commands and nested menus.
Definition: Menu.h:71
Represents a command that can be chosen from a menu.
Definition: MenuItem.h:50