summaryrefslogtreecommitdiff
path: root/plugingui/nativewindow.h
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2017-02-08 22:22:00 +0100
committerBent Bisballe Nyeng <deva@aasimon.org>2017-02-08 22:22:00 +0100
commit728abec962f993309acf3ebb1317b5f3773f18c7 (patch)
treeab4e22fd914681fa42babfcba184a932956c9667 /plugingui/nativewindow.h
parentf762a1fbf4ccf565953855695ddd0bf60b34bf8e (diff)
UI resize refactoring part 1.
Diffstat (limited to 'plugingui/nativewindow.h')
-rw-r--r--plugingui/nativewindow.h41
1 files changed, 24 insertions, 17 deletions
diff --git a/plugingui/nativewindow.h b/plugingui/nativewindow.h
index ff24fed..ffa5c15 100644
--- a/plugingui/nativewindow.h
+++ b/plugingui/nativewindow.h
@@ -31,53 +31,60 @@
#include "guievent.h"
-namespace GUI {
+namespace GUI
+{
-//! \brief Interface class for native window implementations.
+//! Interface class for native window implementations.
class NativeWindow {
public:
NativeWindow() {}
virtual ~NativeWindow() {}
- //! \brief Set a fixed size to the window.
+ //! Set a fixed size to the window.
//! It resizes the window and disallows user resizing.
- virtual void setFixedSize(int width, int height) = 0;
+ virtual void setFixedSize(std::size_t width, std::size_t height) = 0;
- // TODO: setScalable(bool) ??
+ //! Set a new size of the window.
+ virtual void resize(std::size_t width, std::size_t height) = 0;
- //! \brief Set a new size of the window.
- virtual void resize(int width, int height) = 0;
+ //! Query size of the native window.
+ virtual std::pair<std::size_t, std::size_t> getSize() = 0;
- //! \brief Move the window to a new position.
+ //! Move the window to a new position.
+ //! Note: negative value are allowed.
virtual void move(int x, int y) = 0;
- //! \brief Show the window if it is hidden.
+ //! Query the screen position of the native window.
+ //! Note: returned values can be negative.
+ virtual std::pair<int, int> getPosition() = 0;
+
+ //! Show the window if it is hidden.
virtual void show() = 0;
- //! \brief Hides the window.
+ //! Hides the window.
virtual void hide() = 0;
- //! \brief Sets the window caption in the title bar (if it has one).
+ //! Sets the window caption in the title bar (if it has one).
virtual void setCaption(const std::string &caption) = 0;
- //! \brief Recreate a window render buffer based on the internal buffer.
+ //! Recreate a window render buffer based on the internal buffer.
//! This need to be called whenever the internal buffer size has changed.
virtual void handleBuffer() = 0;
- //! \brief Draw the internal rendering buffer to the window buffer.
+ //! Draw the internal rendering buffer to the window buffer.
virtual void redraw() = 0;
- //! \brief Toggle capture mouse mode.
+ //! Toggle capture mouse mode.
virtual void grabMouse(bool grab) = 0;
- //! \brief Query if the event queue contains any events.
+ //! Query if the event queue contains any events.
virtual bool hasEvent() = 0;
- //! \brief Read a single event from the event queue.
+ //! Read a single event from the event queue.
//! \return A pointer to the event or nullptr is none exists.
virtual std::shared_ptr<Event> getNextEvent() = 0;
- //! \brief Read next event without popping it from the event queue.
+ //! Read next event without popping it from the event queue.
//! \return A pointer to the event or nullptr is none exists.
virtual std::shared_ptr<Event> peekNextEvent() = 0;
};