Skip to content

Commit 5adf0e3

Browse files
committed
BringToFront and SendToBack for Widget
1 parent f45b88f commit 5adf0e3

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

src/Widget.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,10 @@ void PhWidgets::Widget::OnUnrealized( PtCallbackInfo_t * info)
491491
resource.callback[Callback::unrealized].raise(info);
492492
}
493493

494+
void Widget::BringToFront()
495+
{
496+
PtWidgetToFront(widget());
497+
}
494498

495499
void Widget::SetBounds(short x, short y, unsigned short width, unsigned short height)
496500
{
@@ -537,6 +541,11 @@ Widget Widget::GetNextWidget(Widget widget, bool forward) const
537541
return Widget(result);
538542
}
539543

544+
void Widget::SendToBack()
545+
{
546+
PtWidgetToBack(widget());
547+
}
548+
540549
void Widget::Select()
541550
{
542551
Focus(); // TODO: check the actual difference

src/Widget.h

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1081,6 +1081,17 @@ namespace PhWidgets
10811081
//! Converts Widget to constant Photon widget pointer
10821082
operator const PtWidget_t*() const;
10831083

1084+
//! Brings the widget to the front of the z-order.
1085+
/*!
1086+
The widget is moved to the front of the z-order.
1087+
If the widget is a child of another widget, the child widget is moved to the front of the z-order.
1088+
BringToFront() does not make a widget a top-level widget, and it does not raise the Widget::Paint event.
1089+
1090+
@see
1091+
- SendToBack()
1092+
*/
1093+
void BringToFront();
1094+
10841095
//! Sets input focus to the widget.
10851096
/*!
10861097
@return `true` if the input focus request was successful; otherwise, `false`.
@@ -1113,7 +1124,7 @@ namespace PhWidgets
11131124
- ProgressBar
11141125
- Splitter
11151126
- Label
1116-
- LinkLabel (when there is no link present in the control)
1127+
- LinkLabel (when there is no link present in the widget)
11171128
*/
11181129
bool Focus();
11191130

@@ -1136,6 +1147,20 @@ namespace PhWidgets
11361147
*/
11371148
Widget GetNextWidget(Widget widget, bool forward = true) const;
11381149

1150+
//! Sends the widget to the back of the z-order.
1151+
/*!
1152+
The widget is moved to the back of the z-order.
1153+
If the widget is a child of another widget, the child widget is moved to the back of the z-order.
1154+
If the widget is a top-level widget, this method will not work correctly unless the widget is active.
1155+
A top-level widget is a widget, such as a Form, that is not a child of another widget.
1156+
An active widget is a visible widget that has input focus.
1157+
To use the SendToBack() method with an inactive, top-level widget, first call the BringToFront() method on the widget.
1158+
1159+
@see
1160+
- BringToFront()
1161+
*/
1162+
void SendToBack();
1163+
11391164
//@{
11401165
//! Sets the bounds of the widget to the specified location and size.
11411166
/*!

0 commit comments

Comments
 (0)