Control Class Reference

#include <Pt/Forms/Control.h>

A view that can be attached as application content. More...

Inherits View.

Inherited by Button, ComboBox, Label, Layout, LineEdit, ListBox, ListBoxItem, MenuBar, MenuItemBase, Panel, ProgressBar, ScrollBar, ScrollView, Slider, SpinBox, TabView, and Workspace.

Public Member Functions

Pt::uint64_t id () const
 Returns the ID.
 
const std::string & name () const
 Returns the name.
 
void setName (const std::string &n)
 Sets the name.
 
void setNextResponder (Responder *r)
 Sets the next responder.
 
bool isConnected () const
 Returns true if connected to a screen.
 
Screenscreen ()
 Returns the connected screen.
 
const Screenscreen () const
 Returns the connected screen.
 
Widgetparent ()
 Returns the parent.
 
const Widgetparent () const
 Returns the parent.
 
bool isDescendantOf (const Widget &top) const
 Returns true if an descendant of @top.
 
bool isAncestorOf (const Widget &child) const
 Returns true if an ancestor of @child.
 
WidgethitTest (const Gfx::PointF &pos)
 Returns the descendant hit at a position.
 
Gfx::PointF toParent (const Gfx::PointF &pos) const
 Converts to parent coordinate.
 
Gfx::PointF fromParent (const Gfx::PointF &pos) const
 Converts from parent coordinate.
 
Gfx::PointF toGlobal (const Gfx::PointF &pos) const
 Converts to global coordinate.
 
Gfx::PointF fromGlobal (const Gfx::PointF &pos) const
 Converts to local coordinate.
 
void addPeer (Widget &peer)
 Adds a peer.
 
void removePeer (Widget &peer)
 Removes a peer.
 
void invalidate ()
 Invalidates the state.
 
virtual void repaint (const Gfx::RectF &rect)
 Initiates a repaint cycle.
 
virtual void repaint ()
 Initiates a repaint cycle.
 
double scaleFactor () const
 Returns the current scale factor.
 
bool isVisible () const
 Indicates whether the widget is visible.
 
virtual void show (bool b=true)
 Shows the widget.
 
bool isEnabled () const
 Indicates whether the widget is enabled.
 
virtual void enable (bool isEnable=true)
 Enables the widget.
 
const Gfx::PointFposition () const
 Returns the current position.
 
virtual void move (const Gfx::PointF &pos)
 Moves the widget to a position.
 
const Gfx::SizeFsize () const
 Returns the current size.
 
const Gfx::RectFbounds () const
 Returns the current inner bounds.
 
virtual void resize (const Gfx::SizeF &s)
 Resizes the widget to a new size.
 
void setCapture (bool capture)
 Pointer input capture.
 
void processEvent (const Pt::Event &ev)
 Process event.
 
Pt::Signal< const Pt::Event & > & eventReceived ()
 Signals that an event needs to be processed.
 

Detailed Description

A Control is the reusable building block of a Forms user interface. It can be the content of a Form or the child of another view, and it can attach child controls of its own. Attachment is non-owning: a parent stores control pointers but does not destroy its children. A control participates in its form's measurement, layout, focus traversal, shortcuts, mnemonics, painting, and input routing.

Derive a control to implement custom content. Override the protected measurement, layout, painting, and event hooks that define its behavior; use add() and remove() to manage its child controls.