ASPiK SDK
iwindow.h
1 // This file is part of VSTGUI. It is subject to the license terms
2 // in the LICENSE file found in the top-level directory of this
3 // distribution and at http://github.com/steinbergmedia/vstgui/LICENSE
4 
5 #pragma once
6 
7 #include "fwd.h"
8 #include "../../lib/crect.h"
9 #include "../../lib/cstring.h"
10 #include "interface.h"
11 
12 //------------------------------------------------------------------------
13 namespace VSTGUI {
14 namespace Standalone {
15 
16 //------------------------------------------------------------------------
34 enum class WindowType
35 {
36  Document,
37  Popup,
38 };
39 
40 //------------------------------------------------------------------------
60 {
61 private:
62  uint32_t flags {0};
63 
64  enum Style
65  {
66  Border = 1 << 0,
67  Close = 1 << 1,
68  Size = 1 << 2,
69  Transparent = 1 << 3,
70  MovableByWindowBackground = 1 << 4,
71  Centered = 1 << 5,
72  };
73 
74 public:
75  WindowStyle () = default;
76 
77  WindowStyle& border ()
78  {
79  flags |= Style::Border;
80  return *this;
81  }
82  WindowStyle& close ()
83  {
84  flags |= Style::Close;
85  return *this;
86  }
87  WindowStyle& size ()
88  {
89  flags |= Style::Size;
90  return *this;
91  }
92  WindowStyle& transparent ()
93  {
94  flags |= Style::Transparent;
95  return *this;
96  }
97  WindowStyle& movableByWindowBackground ()
98  {
99  flags |= Style::MovableByWindowBackground;
100  return *this;
101  }
102  WindowStyle& centered ()
103  {
104  flags |= Style::Centered;
105  return *this;
106  }
107 
108  bool hasBorder () const { return (flags & Style::Border) != 0; }
109  bool canClose () const { return (flags & Style::Close) != 0; }
110  bool canSize () const { return (flags & Style::Size) != 0; }
111  bool isTransparent () const { return (flags & Style::Transparent) != 0; }
112  bool isMovableByWindowBackground () const
113  {
114  return (flags & Style::MovableByWindowBackground) != 0;
115  }
116  bool isCentered () const { return (flags & Style::Centered) != 0; }
117 };
118 
119 //------------------------------------------------------------------------
125 {
126  WindowType type {WindowType::Document};
127  WindowStyle style;
128  CPoint size;
129  UTF8String title;
130  UTF8String autoSaveFrameName;
131 };
132 
133 //------------------------------------------------------------------------
142 class IWindow : public Interface
143 {
144 public:
146  virtual const WindowControllerPtr& getController () const = 0;
147 
149  virtual CPoint getSize () const = 0;
151  virtual CPoint getPosition () const = 0;
153  virtual double getScaleFactor () const = 0;
155  virtual CRect getFocusViewRect () const = 0;
157  virtual const UTF8String& getTitle () const = 0;
159  virtual WindowType getType () const = 0;
161  virtual WindowStyle getStyle () const = 0;
163  virtual const UTF8String& getAutoSaveFrameName () const = 0;
164 
166  virtual void setSize (const CPoint& newSize) = 0;
168  virtual void setPosition (const CPoint& newPosition) = 0;
170  virtual void setTitle (const UTF8String& newTitle) = 0;
172  virtual void setContentView (const SharedPointer<CFrame>& frame) = 0;
173 
175  virtual void show () = 0;
177  virtual void hide () = 0;
179  virtual void close () = 0;
180 
182  virtual void activate () = 0;
183 
190  virtual void registerWindowListener (IWindowListener* listener) = 0;
192  virtual void unregisterWindowListener (IWindowListener* listener) = 0;
193 };
194 
195 //------------------------------------------------------------------------
196 } // Standalone
197 } // VSTGUI
WindowType
Definition: iwindow.h:34
virtual double getScaleFactor() const =0
Rect structure.
Definition: crect.h:17
virtual WindowType getType() const =0
virtual WindowStyle getStyle() const =0
virtual void setTitle(const UTF8String &newTitle)=0
virtual const UTF8String & getAutoSaveFrameName() const =0
Definition: interface.h:13
virtual CRect getFocusViewRect() const =0
virtual CPoint getSize() const =0
virtual void activate()=0
virtual const WindowControllerPtr & getController() const =0
Definition: customcontrols.cpp:8
Definition: iwindow.h:142
virtual void setPosition(const CPoint &newPosition)=0
virtual void setContentView(const SharedPointer< CFrame > &frame)=0
Definition: iwindowlistener.h:20
virtual void setSize(const CPoint &newSize)=0
holds an UTF8 encoded string and a platform representation of it
Definition: cstring.h:56
virtual void unregisterWindowListener(IWindowListener *listener)=0
Point structure.
Definition: cpoint.h:17
Definition: iwindow.h:59
virtual CPoint getPosition() const =0
virtual const UTF8String & getTitle() const =0
virtual void registerWindowListener(IWindowListener *listener)=0