PCL
pcl::Edit Class Reference

Client-side interface to a PixInsight Edit control. More...

#include <Edit.h>

+ Inheritance diagram for pcl::Edit:

Public Types

using caret_event_handler = void(Control::*)(Edit &sender, int oldPos, int newPos)
 
using edit_event_handler = void(Control::*)(Edit &sender)
 
using selection_event_handler = void(Control::*)(Edit &sender, int newStart, int newEnd)
 
using text_event_handler = void(Control::*)(Edit &sender, const String &)
 
- Public Types inherited from pcl::Frame
using style = FrameStyle::value_type
 
- Public Types inherited from pcl::Control
using child_event_handler = void(Control::*)(Control &sender, Control &child)
 
using close_event_handler = void(Control::*)(Control &sender, bool &allowClose)
 
using event_handler = void(Control::*)(Control &sender)
 
using file_drag_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, const StringList &files, unsigned modifiers, bool &wantsFiles)
 
using file_drop_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, const StringList &files, unsigned modifiers)
 
using keyboard_event_handler = void(Control::*)(Control &sender, int key, unsigned modifiers, bool &wantsKey)
 
using mouse_button_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, int button, unsigned buttons, unsigned modifiers)
 
using mouse_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, unsigned buttons, unsigned modifiers)
 
using mouse_wheel_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, int delta, unsigned buttons, unsigned modifiers)
 
using move_event_handler = void(Control::*)(Control &sender, const pcl::Point &newPos, const pcl::Point &oldPos)
 
using paint_event_handler = void(Control::*)(Control &sender, const pcl::Rect &updateRect)
 
using resize_event_handler = void(Control::*)(Control &sender, int newWidth, int newHeight, int oldWidth, int oldHeight)
 
using view_drag_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, const View &view, unsigned modifiers, bool &wantsView)
 
using view_drop_event_handler = void(Control::*)(Control &sender, const pcl::Point &pos, const View &view, unsigned modifiers)
 

Public Member Functions

 Edit (const String &text=String(), Control &parent=Control::Null())
 
 ~Edit () override
 
int CaretPosition () const
 
void Clear ()
 
void ClearModified (bool clear=true)
 
void DisablePasswordMode (bool disable=true)
 
void DisableValidatingRegExp ()
 
void EnablePasswordMode (bool=true)
 
void End ()
 
void GetSelection (int &selStart, int &selEnd) const
 
bool HasSelection () const
 
void Home ()
 
bool IsLeftAligned () const
 
bool IsModified () const
 
bool IsPasswordMode () const
 
bool IsReadOnly () const
 
bool IsRightAligned () const
 
bool IsValid () const
 
int MaxLength () const
 
void OnCaretPositionUpdated (caret_event_handler, Control &)
 
void OnEditCompleted (edit_event_handler, Control &)
 
void OnReturnPressed (edit_event_handler, Control &)
 
void OnSelectionUpdated (selection_event_handler, Control &)
 
void OnTextUpdated (text_event_handler, Control &)
 
void SelectAll (bool=true)
 
String SelectedText () const
 
void SetCaretPosition (int)
 
void SetLeftAlignment (bool left=true)
 
void SetMaxLength (int)
 
void SetModified (bool=true)
 
void SetReadOnly (bool=true)
 
void SetReadWrite (bool rw=true)
 
void SetRightAlignment (bool right=true)
 
void SetSelection (int selStart, int selEnd)
 
void SetText (const String &)
 
void SetUnlimitedLength ()
 
void SetValidatingRegExp (const String &rx, bool caseSensitive=true)
 
String Text () const
 
void Unselect (bool unsel=true)
 
String ValidatingRegExp () const
 
String ValidatingRegExp (bool &caseSensitive) const
 
- Public Member Functions inherited from pcl::Frame
 Frame (Control &parent=Control::Null())
 
 ~Frame () override
 
int BorderWidth () const
 
int LineWidth () const
 
int ScaledBorderWidth () const
 
int ScaledLineWidth () const
 
void SetLineWidth (int)
 
void SetScaledLineWidth (int width)
 
void SetStyle (style)
 
style Style () const
 
- Public Member Functions inherited from pcl::Control
 Control (const Control &)=delete
 
 Control (Control &&)=delete
 
 Control (Control &parent=Null(), uint32=0)
 
 ~Control () override
 
void ActivateRealTimePreview ()
 
void ActivateTrackView ()
 
void ActivateWindow ()
 
void AdjustToContents ()
 
RGBA AlternateCanvasColor () const
 
RGBA BackgroundColor () const
 
pcl::Rect BoundsRect () const
 
void BringToFront ()
 
RGBA ButtonColor () const
 
RGBA ButtonTextColor () const
 
bool CanUpdate () const
 
RGBA CanvasColor ()
 
ControlChildByPos (const pcl::Point &p) const
 
ControlChildByPos (int x, int y) const
 
pcl::Rect ChildrenRect () const
 
ControlChildToFocus () const
 
void ClearInfoText ()
 
int ClientHeight () const
 
pcl::Rect ClientRect () const
 
int ClientWidth () const
 
void ControlToLocal (const Control &, int &x, int &y) const
 
pcl::Point ControlToLocal (const Control &w, const pcl::Point &p) const
 
pcl::Cursor Cursor () const
 
void DeactivateRealTimePreview ()
 
void DeactivateTrackView ()
 
void Disable (bool disabled=true)
 
void DisableExpansion (bool horzDisable=true, bool vertDisable=true)
 
void DisableMouseTracking (bool disable=true)
 
void DisableUpdates (bool disable=true)
 
double DisplayPixelRatio () const
 
virtual void Enable (bool enabled=true)
 
void EnableExpansion (bool horzEnable=true, bool vertEnable=true)
 
void EnableMouseTracking (bool=true)
 
void EnableUpdates (bool enable=true)
 
void EnsureLayoutUpdated ()
 
void EnsureUnique () override
 
void Focus (bool focus=true)
 
ControlFocusedChild () const
 
FocusStyles FocusStyle () const
 
pcl::Font Font () const
 
RGBA ForegroundColor () const
 
int FrameHeight () const
 
pcl::Rect FrameRect () const
 
int FrameWidth () const
 
pcl::Cursor GetCursor () const
 
pcl::Font GetFont () const
 
void GetMaxSize (int &w, int &h) const
 
void GetMinSize (int &w, int &h) const
 
void GetScaledMaxSize (int &w, int &h) const
 
void GetScaledMinSize (int &w, int &h) const
 
pcl::Sizer GetSizer () const
 
pcl::Point GlobalToLocal (const pcl::Point &p) const
 
void GlobalToLocal (int &x, int &y) const
 
int Height () const
 
void Hide ()
 
RGBA HighlightColor () const
 
RGBA HighlightedTextColor () const
 
String InfoText () const
 
bool IsActiveWindow () const
 
bool IsAncestorOf (const Control &) const
 
virtual bool IsEnabled () const
 
bool IsFixedHeight () const
 
bool IsFixedWidth () const
 
bool IsFocused () const
 
bool IsHidden () const
 
bool IsHorizontalExpansionEnabled () const
 
bool IsMaximized () const
 
bool IsMinimized () const
 
bool IsModal () const
 
bool IsMouseTrackingEnabled () const
 
bool IsRealTimePreviewActive () const
 
bool IsTrackViewActive () const
 
bool IsUnderMouse () const
 
bool IsVerticalExpansionEnabled () const
 
bool IsVisible () const
 
bool IsWindow () const
 
void LocalToControl (const Control &, int &x, int &y) const
 
pcl::Point LocalToControl (const Control &w, const pcl::Point &p) const
 
pcl::Point LocalToGlobal (const pcl::Point &p) const
 
void LocalToGlobal (int &x, int &y) const
 
pcl::Point LocalToParent (const pcl::Point &p) const
 
void LocalToParent (int &x, int &y) const
 
int LogicalPixelsToPhysical (int size) const
 
int LogicalPixelsToResource (int size) const
 
int MaxHeight () const
 
int MaxWidth () const
 
int MinHeight () const
 
int MinWidth () const
 
void Move (const pcl::Point &p)
 
void Move (int x, int y)
 
ControlNextSiblingToFocus () const
 
void OnChildCreate (child_event_handler, Control &)
 
void OnChildDestroy (child_event_handler, Control &)
 
void OnClose (close_event_handler, Control &)
 
void OnDestroy (event_handler, Control &)
 
void OnEnter (event_handler, Control &)
 
void OnFileDrag (file_drag_event_handler, Control &)
 
void OnFileDrop (file_drop_event_handler, Control &)
 
void OnGetFocus (event_handler, Control &)
 
void OnHide (event_handler, Control &)
 
void OnKeyPress (keyboard_event_handler, Control &)
 
void OnKeyRelease (keyboard_event_handler, Control &)
 
void OnLeave (event_handler, Control &)
 
void OnLoseFocus (event_handler, Control &)
 
void OnMouseDoubleClick (mouse_event_handler, Control &)
 
void OnMouseMove (mouse_event_handler, Control &)
 
void OnMousePress (mouse_button_event_handler, Control &)
 
void OnMouseRelease (mouse_button_event_handler, Control &)
 
void OnMouseWheel (mouse_wheel_event_handler, Control &)
 
void OnMove (move_event_handler, Control &)
 
void OnPaint (paint_event_handler, Control &)
 
void OnResize (resize_event_handler, Control &)
 
void OnShow (event_handler, Control &)
 
void OnViewDrag (view_drag_event_handler, Control &)
 
void OnViewDrop (view_drop_event_handler, Control &)
 
Controloperator= (const Control &)=delete
 
Controloperator= (Control &&)=delete
 
ControlParent () const
 
pcl::Point ParentToLocal (const pcl::Point &p) const
 
void ParentToLocal (int &x, int &y) const
 
int PhysicalPixelsToLogical (int size) const
 
pcl::Point Position () const
 
void Repaint ()
 
void Repaint (const pcl::Rect &r)
 
void Repaint (int x0, int y0, int x1, int y1)
 
void Resize (int w, int h)
 
double ResourcePixelRatio () const
 
int ResourcePixelsToLogical (int size) const
 
void Restyle ()
 
Point ScaledCursorHotSpot (const Point &hotSpot) const
 
Point ScaledCursorHotSpot (int xHot, int yHot) const
 
int ScaledMaxHeight () const
 
int ScaledMaxWidth () const
 
int ScaledMinHeight () const
 
int ScaledMinWidth () const
 
template<class R >
String ScaledResource (R resource) const
 
template<class S >
String ScaledStyleSheet (S cssCode, int fontDPI=0) const
 
void Scroll (const pcl::Point &d)
 
void Scroll (const pcl::Point &d, const pcl::Rect &r)
 
void Scroll (int dx, int dy)
 
void Scroll (int dx, int dy, int x0, int y0, int x1, int y1)
 
void SendToBack ()
 
void SetAlternateCanvasColor (RGBA)
 
void SetBackgroundColor (RGBA)
 
void SetButtonColor (RGBA)
 
void SetButtonTextColor (RGBA)
 
void SetCanvasColor (RGBA)
 
void SetChildToFocus (Control &)
 
void SetClientRect (const pcl::Rect &r)
 
void SetClientRect (int x0, int y0, int x1, int y1)
 
void SetCursor (const pcl::Cursor &)
 
void SetCursorToParent ()
 
void SetFixedHeight ()
 
void SetFixedHeight (int h)
 
void SetFixedSize ()
 
void SetFixedSize (int w, int h)
 
void SetFixedWidth ()
 
void SetFixedWidth (int w)
 
void SetFocusStyle (FocusStyles)
 
void SetFont (const pcl::Font &)
 
void SetForegroundColor (RGBA)
 
void SetHighlightColor (RGBA)
 
void SetHighlightedTextColor (RGBA)
 
void SetInfoText (const String &)
 
void SetMaxHeight ()
 
void SetMaxHeight (int h)
 
void SetMaxSize ()
 
void SetMaxSize (int w, int h)
 
void SetMaxWidth ()
 
void SetMaxWidth (int w)
 
void SetMinHeight ()
 
void SetMinHeight (int h)
 
void SetMinSize ()
 
void SetMinSize (int w, int h)
 
void SetMinWidth ()
 
void SetMinWidth (int w)
 
void SetNextSiblingToFocus (Control &)
 
void SetParent (Control &)
 
void SetRealTimePreviewActive (bool=true)
 
void SetScaledFixedHeight (int h)
 
void SetScaledFixedSize (int w, int h)
 
void SetScaledFixedWidth (int w)
 
void SetScaledMaxHeight (int h)
 
void SetScaledMaxSize (int w, int h)
 
void SetScaledMaxWidth (int w)
 
void SetScaledMinHeight (int h)
 
void SetScaledMinSize (int w, int h)
 
void SetScaledMinWidth (int w)
 
void SetSizer (pcl::Sizer &)
 
void SetStyleSheet (const String &css)
 
void SetTextColor (RGBA)
 
void SetToolTip (const String &)
 
void SetTrackViewActive (bool=true)
 
void SetVariableHeight ()
 
void SetVariableSize ()
 
void SetVariableWidth ()
 
void SetVisible (bool visible)
 
void SetWindowOpacity (double)
 
void SetWindowTitle (const String &)
 
void Show ()
 
pcl::Sizer Sizer () const
 
void StackUnder (Control &)
 
String StyleSheet () const
 
RGBA TextColor () const
 
String ToolTip () const
 
void Unfocus ()
 
void Update ()
 
void Update (const pcl::Rect &r)
 
void Update (int x0, int y0, int x1, int y1)
 
pcl::Rect VisibleRect () const
 
int Width () const
 
ControlWindow () const
 
double WindowOpacity () const
 
String WindowTitle () const
 
int X () const
 
int Y () const
 
- Public Member Functions inherited from pcl::UIObject
virtual ~UIObject () noexcept(false)
 
bool IsAlias () const
 
bool IsGarbage () const
 
bool IsNull () const
 
bool IsSameObject (const UIObject &o) const
 
bool IsUnique () const
 
String ObjectId () const
 
IsoString ObjectType () const
 
bool operator< (const UIObject &o) const
 
bool operator== (const UIObject &o) const
 
size_type RefCount () const
 
void SetObjectId (const String &id)
 

Additional Inherited Members

- Static Public Member Functions inherited from pcl::Control
static void HideToolTip ()
 
static ControlNull ()
 
static void ShowToolTip (const Point &pos, const String &text, const Control &control=Control::Null(), const Rect &rect=Rect(0))
 
static void ShowToolTip (int x, int y, const String &text, const Control &control=Control::Null(), const Rect &rect=Rect(0))
 
static String ToolTipText ()
 
- Static Public Member Functions inherited from pcl::UIObject
static UIObjectNull ()
 
- Protected Member Functions inherited from pcl::UIObject
 UIObject ()=default
 
 UIObject (const UIObject &x)
 
 UIObject (UIObject &&x)
 
UIObjectoperator= (const UIObject &x)
 
UIObjectoperator= (UIObject &&x)
 

Detailed Description

Edit controls are single-line plain text edit controls.

Definition at line 75 of file Edit.h.

Member Typedef Documentation

◆ caret_event_handler

using pcl::Edit::caret_event_handler = void (Control::*)( Edit& sender, int oldPos, int newPos )

#

Definition at line 414 of file Edit.h.

◆ edit_event_handler

using pcl::Edit::edit_event_handler = void (Control::*)( Edit& sender )

#

Definition at line 406 of file Edit.h.

◆ selection_event_handler

using pcl::Edit::selection_event_handler = void (Control::*)( Edit& sender, int newStart, int newEnd )

#

Definition at line 418 of file Edit.h.

◆ text_event_handler

using pcl::Edit::text_event_handler = void (Control::*)( Edit& sender, const String& )

#

Definition at line 410 of file Edit.h.

Constructor & Destructor Documentation

◆ Edit()

pcl::Edit::Edit ( const String text = String(),
Control parent = Control::Null() 
)

Constructs an Edit object with the specified text, as a child control of parent.

◆ ~Edit()

pcl::Edit::~Edit ( )
inlineoverride

Destroys an Edit control.

Definition at line 88 of file Edit.h.

Member Function Documentation

◆ CaretPosition()

int pcl::Edit::CaretPosition ( ) const

Returns the current caret position in this Edit control.

◆ Clear()

void pcl::Edit::Clear ( )
inline

Removes all the text in this edit control.

Definition at line 105 of file Edit.h.

◆ ClearModified()

void pcl::Edit::ClearModified ( bool  clear = true)
inline

Clears or sets the modified status for this Edit control.

This is a convenience member function, equivalent to: SetModified( !clear )

Definition at line 147 of file Edit.h.

◆ DisablePasswordMode()

void pcl::Edit::DisablePasswordMode ( bool  disable = true)
inline

Disables the password display mode for this Edit control.

This is a convenience member function, equivalent to: EnablePasswordMode( !disable )

See also
IsPasswordMode(), EnablePasswordMode()

Definition at line 178 of file Edit.h.

◆ DisableValidatingRegExp()

void pcl::Edit::DisableValidatingRegExp ( )
inline

Disables validation through a regular expression for this Edit control.

Calling this function is equivalent to:

SetValidatingRegExp( String() );
void SetValidatingRegExp(const String &rx, bool caseSensitive=true)

Definition at line 245 of file Edit.h.

◆ EnablePasswordMode()

void pcl::Edit::EnablePasswordMode ( bool  = true)

Enables the password display mode for this Edit control.

See also
IsPasswordMode(), DisablePasswordMode()

◆ End()

void pcl::Edit::End ( )
inline

Moves the caret to the end of the text line in this Edit control.

Definition at line 361 of file Edit.h.

◆ GetSelection()

void pcl::Edit::GetSelection ( int &  selStart,
int &  selEnd 
) const

Gets the limits of the current selection in this Edit control.

Parameters
[out]selStartThe index of the first selected character.
[out]selEndThe index of the last selected character plus one.

When selStart is equal to selEnd, there is no selection in this edit control.

◆ HasSelection()

bool pcl::Edit::HasSelection ( ) const
inline

Returns true iff there are one or more selected characters in this Edit control.

Definition at line 327 of file Edit.h.

◆ Home()

void pcl::Edit::Home ( )
inline

Moves the caret to the beginning of the text line in this Edit control.

Definition at line 353 of file Edit.h.

◆ IsLeftAligned()

bool pcl::Edit::IsLeftAligned ( ) const
inline

Returns true iff the text in this Edit control is left-aligned.

Definition at line 374 of file Edit.h.

◆ IsModified()

bool pcl::Edit::IsModified ( ) const

Returns true iff the text in this Edit control has been modified.

◆ IsPasswordMode()

bool pcl::Edit::IsPasswordMode ( ) const

Returns true iff this Edit control is in password display mode.

In password mode, the text in an edit control is always displayed as a sequence of asterisks. This does not affect the actual text; the password mode only changes the way characters are displayed.

See also
EnablePasswordMode(), DisablePasswordMode()

◆ IsReadOnly()

bool pcl::Edit::IsReadOnly ( ) const

Returns true iff this Edit control is in read-only mode.

◆ IsRightAligned()

bool pcl::Edit::IsRightAligned ( ) const

Returns true iff the text in this Edit control is right-aligned.

◆ IsValid()

bool pcl::Edit::IsValid ( ) const

Returns true if the text in this Edit control matches the current validating regular expression, or if no validating regular expression is currently defined for this control. Returns false if a validating regular expression is defined and the current text does not match it.

See SetValidatingRegExp() for complete information on validating regular expressions.

◆ MaxLength()

int pcl::Edit::MaxLength ( ) const

Returns the maximum allowed length for the text in this Edit control.

◆ OnCaretPositionUpdated()

void pcl::Edit::OnCaretPositionUpdated ( caret_event_handler  ,
Control  
)

#

◆ OnEditCompleted()

void pcl::Edit::OnEditCompleted ( edit_event_handler  ,
Control  
)

#

◆ OnReturnPressed()

void pcl::Edit::OnReturnPressed ( edit_event_handler  ,
Control  
)

#

◆ OnSelectionUpdated()

void pcl::Edit::OnSelectionUpdated ( selection_event_handler  ,
Control  
)

#

◆ OnTextUpdated()

void pcl::Edit::OnTextUpdated ( text_event_handler  ,
Control  
)

#

◆ SelectAll()

void pcl::Edit::SelectAll ( bool  = true)

Selects all the text in this edit control.

◆ SelectedText()

String pcl::Edit::SelectedText ( ) const

Returns the currently selected text, or an empty string if there is no selection in this Edit control.

◆ SetCaretPosition()

void pcl::Edit::SetCaretPosition ( int  )

Sets the current caret position in this Edit control.

◆ SetLeftAlignment()

void pcl::Edit::SetLeftAlignment ( bool  left = true)
inline

Disables or enables right-alignment for the text in this edit control.

This is a convenience member function, equivalent to: SetRightAlignment( !left )

Definition at line 390 of file Edit.h.

◆ SetMaxLength()

void pcl::Edit::SetMaxLength ( int  )

Sets the maximum allowed length for the text in this Edit control.

The default length limit is int_max, which in practice represents no length limit.

◆ SetModified()

void pcl::Edit::SetModified ( bool  = true)

Sets or clears the modified status for this Edit control.

◆ SetReadOnly()

void pcl::Edit::SetReadOnly ( bool  = true)

Enables or disables the read-only mode for this Edit control.

◆ SetReadWrite()

void pcl::Edit::SetReadWrite ( bool  rw = true)
inline

Disables or enables the read-only mode for this Edit control.

This is a convenience member function, equivalent to: SetReadOnly( !rw )

Definition at line 126 of file Edit.h.

◆ SetRightAlignment()

void pcl::Edit::SetRightAlignment ( bool  right = true)

Enables or disables right-alignment for the text in this edit control.

◆ SetSelection()

void pcl::Edit::SetSelection ( int  selStart,
int  selEnd 
)

Sets the limits of the current selection in this Edit control.

Parameters
selStartThe index of the first selected character.
selEndThe index of the last selected character plus one.

When selStart is equal to selEnd, there is no selection in this edit control.

◆ SetText()

void pcl::Edit::SetText ( const String )

Sets the current button text.

◆ SetUnlimitedLength()

void pcl::Edit::SetUnlimitedLength ( )
inline

Enables unlimited length for the text in this Edit control.

This is a convenience member function, equivalent to: SetMaxLength( int_max )

Definition at line 280 of file Edit.h.

◆ SetValidatingRegExp()

void pcl::Edit::SetValidatingRegExp ( const String rx,
bool  caseSensitive = true 
)

Sets a validating regular expression for this Edit control.

The specified regular expression rx will be used to accept or reject characters automatically as they are being typed in the control, and also to accept or reject text pasted from the clipboard or dropped on the control by the user.

For example, to ensure that a syntactically valid floating point number is entered, the following regular expression can be used:

Edit velocity_Edit;
...
velocity_Edit.SetValidatingRegExp( "[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?" );
Edit(const String &text=String(), Control &parent=Control::Null())

If the caseSensitive parameter is true, case-sensitive matches will be performed with the regular expression; otherwise the matches will ignore case. Case-sensitive matches are performed by default.

This member function throws an Error exception if the specified regular expression is not an empty string and is not valid or is unsupported.

To disable regular expression validation, specify an empty string as the rx argument, or call DisableValidatingRegExp().

See also
ValidatingRegExp(), IsValid()

◆ Text()

String pcl::Edit::Text ( ) const

Returns the current edit text.

◆ Unselect()

void pcl::Edit::Unselect ( bool  unsel = true)
inline

Clears the existing selection, if any, in this edit control.

Note
This member function does not delete the selected text; it only removes the selection.

Definition at line 296 of file Edit.h.

◆ ValidatingRegExp() [1/2]

String pcl::Edit::ValidatingRegExp ( ) const

Returns the current regular expression used for validation of text input in this Edit control, or an empty string if no validating regular expression has been defined.

See SetValidatingRegExp() for detailed information.

◆ ValidatingRegExp() [2/2]

String pcl::Edit::ValidatingRegExp ( bool &  caseSensitive) const

Returns the current regular expression used for validation of text input in this Edit control, or an empty string if no validating regular expression has been defined.

On exit, the specified caseSensitive variable will be true if the current regular expression is being used to perform case-sensitive matches; false if case-insensitive matches are performed.

See SetValidatingRegExp() for detailed information.


The documentation for this class was generated from the following file: