57 using Ptr = std::unique_ptr<Window>;
75 bool autoIDMode(
void)
const noexcept {
return(autoid_); }
97 Widget *
root(
void)
const noexcept {
return(root_?root_.get():
nullptr);}
109 std::stack<Widget::Ptr> conts_;
130 const std::string & title,
131 bool withborder =
true,
bool withzxbands =
true,
133 bool preserveback =
true);
183 bool hasBorder(
void)
const noexcept {
return(withborder_); }
224 void hide(
bool preservcontent =
true);
257 static bool constexpr visibleState(State s)
noexcept
259 {
return((s == State::VISIBLE_PRES) || (s == State::VISIBLE_UNPRES)); }
261 static const std::string & nameOfState(State s);
265 const Bitmap zxbandchar_;
268 DoubleRect winabsrect_;
271 const std::string title_;
272 const bool withborder_;
273 const bool withzxbands_;
274 const bool preserveback_;
277 DoubleGraphic blankmap_;
278 DoubleGraphic preservedbackgroundorcontent_;
283 void preserve(DoubleGraphic & dest);
284 void restorePreserved(
const DoubleGraphic & orig);
285 void drawBlank(
void);
286 void drawContent(
void);
287 bool mousePos(
unsigned xm,
unsigned ym,
PixCursor & pc)
const;
289 Widget::EventData & evd,
291 bool & mouseindrawable)
const;
Events that the window can receive from its desktop environment.
static const WinColors kLight
Colors for light background, with bright.
Colors used in a GUI window.
Window(const Window &)=delete
A window with the given parameters.
DepthFirstInserter(bool autoid=false)
Default constructor.
Window(ZXEco &zxe, const CharRect &placem, const std::string &title, bool withborder=true, bool withzxbands=true, const WinColors &wincols=WinColors::kLight, bool preserveback=true)
A window with the given parameters.
std::string to_string(void) const
Return a text explaining the window.
Window & operator=(Window &&)=delete
A window with the given parameters.
Widget * root(void) const noexcept
Return a pointer to the root widget, if any, or nullptr otherwise.
MngResult manage(unsigned permill=10)
Show the window and interact with the user in the given ecosystem.
bool hasBorder(void) const noexcept
Return TRUE if the window has a border.
virtual ~Window(void)
Destructor.
Window & operator=(const Window &)=delete
A window with the given parameters.
void changeAutoID(bool autoid)
Change the current auto-ID mode to AUTOID (see the constructor).
const DoubleRect & placement(void) const noexcept
Return a reference to the absolute placement of the window.
Widget * rootWidget(void)
Return the root widget or nullptr if none.
bool autoIDMode(void) const noexcept
Return the current auto-ID mode (see the constructor).
void checkAutoIDMode(void) const
If the inserter is not in auto-ID mode, throw (see the constructor)
const WinColors & winColors(void) const noexcept
Return the ecosystem where the window is working.
void clearBody(void)
Clear the body area. Do nothing if the current state is not visible.
Window(Window &&)=delete
A window with the given parameters.
void show(void)
Show the window space preserving previous background if desired.
const CharRect & bodyRelRect(void) const noexcept
Return a reference to the body rectangle of the window w.r.t. its orig.
void closeContainer(void)
Close additions of widgets to the current container.
ZXEco & zxEco(void) noexcept
Return the ecosystem where the window is working.
Widget & add(const Widget::Ptr &wp)
Add a new widget as child of the current parent.
void setInWindow(Window &w)
Set the root widget of W to the root widget of this inserter.
void hide(bool preservcontent=true)
Hide the window, preserving the window contents if desired.
To insert widgets in a window in a depth-first fashion.
MngResult
Possible results of calling the manage() method.
static constexpr CharDist kLengthBars
Number of chars printed in the title ZX when there are bars.
std::unique_ptr< Window > Ptr
Safe pointer to a window.
@ OUT_CLICK
A click/unclick out of win.
@ FINISHING_CALLBACK
A callback tells to finish.
@ DESKCLOSE_EVENT
A close of desktop received.
Cursor< PixelCoordT, PixelCoordT > PixCursor
Shortcut for this kind of cursor.
Rect< CharDistT, CharDistT > CharRect
Shortcut for this kind of rectangle.
uint16_t CharDist
A distance meadured in screen chars.
Class that provides access to the entire ecosystem: graphics, keyboard, etc.
A rectangle with both char and pixel resolutions, possibly synchronized.
The main namespace of the library, that spans across all the zx modules.