1 // Copyright (C) 2010-2015 Petr Pavlu <setup@dagobah.cz>
3 // This file is part of CenterIM.
5 // CenterIM is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
10 // CenterIM is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with CenterIM. If not, see <http://www.gnu.org/licenses/>.
21 /// @ingroup cppconsui
26 #include "Container.h"
31 class Window
: public Container
{
40 int x
, int y
, int w
, int h
, Type t
= TYPE_NORMAL
, bool decorated_
= true);
41 Window(int x
, int y
, int w
, int h
, const char *title
, Type t
= TYPE_NORMAL
,
42 bool decorated_
= true);
43 virtual ~Window() override
;
46 virtual int draw(Curses::ViewPort area
, Error
&error
) override
;
47 virtual void setVisibility(bool visible
) override
;
48 virtual bool isVisibleRecursive() const override
{ return isVisible(); }
49 virtual Point
getAbsolutePosition() const override
;
52 virtual bool isWidgetVisible(const Widget
&widget
) const override
;
53 virtual bool setFocusChild(Widget
&child
) override
;
54 virtual Point
getAbsolutePosition(const Widget
&child
) const override
;
60 // virtual void SetType(Type t) { type_ = t; }
61 virtual Type
getType() { return type_
; }
63 // virtual void setDecorated(bool new_decorated);
64 virtual bool isDecorated() const { return decorated_
; }
66 virtual void setClosable(bool new_closable
);
67 virtual bool isClosable() const { return closable_
; }
69 virtual void setTitle(const char *text
) { panel_
->setTitle(text
); }
70 virtual const char *getTitle() const { return panel_
->getTitle(); }
72 /// This function is called when the screen is resized.
73 virtual void onScreenResized() {}
75 sigc::signal
<void, Window
&> signal_close
;
76 sigc::signal
<void, Window
&> signal_show
;
77 sigc::signal
<void, Window
&> signal_hide
;
83 /// Flag indicating if it is allowed to close the window by the close-window
84 /// action, this usually means if it is possible to close the window by
85 /// pressing the Esc key.
91 virtual void signalMoveResize(
92 const Rect
&oldsize
, const Rect
&newsize
) override
;
93 virtual void signalWishSizeChange(
94 const Size
&oldsize
, const Size
&newsize
) override
;
95 virtual void updateArea() override
;
96 virtual void redraw() override
;
98 virtual void initWindow(int x
, int y
, const char *title
);
101 CONSUI_DISABLE_COPY(Window
);
104 // Windows cannot have any parent.
105 using Container::setParent
;
109 void declareBindables();
112 } // namespace CppConsUI
116 // vim: set tabstop=2 shiftwidth=2 textwidth=80 expandtab: