window_controller.h
1 /*
2 ** UICore
3 ** Copyright (c) 1997-2015 The UICore Team
4 **
5 ** This software is provided 'as-is', without any express or implied
6 ** warranty. In no event will the authors be held liable for any damages
7 ** arising from the use of this software.
8 **
9 ** Permission is granted to anyone to use this software for any purpose,
10 ** including commercial applications, and to alter it and redistribute it
11 ** freely, subject to the following restrictions:
12 **
13 ** 1. The origin of this software must not be misrepresented; you must not
14 ** claim that you wrote the original software. If you use this software
15 ** in a product, an acknowledgment in the product documentation would be
16 ** appreciated but is not required.
17 ** 2. Altered source versions must be plainly marked as such, and must not be
18 ** misrepresented as being the original software.
19 ** 3. This notice may not be removed or altered from any source distribution.
20 **
21 ** Note: Some of the libraries UICore may link to may have additional
22 ** requirements or restrictions.
23 **
24 ** File Author(s):
25 **
26 ** Magnus Norddahl
27 */
28 
29 #pragma once
30 
31 #include "../../Core/Signals/signal.h"
32 #include <memory>
33 
34 namespace uicore
35 {
36  class View;
37  class WindowControllerImpl;
38 
41  {
42  public:
44  virtual ~WindowController();
45 
47  const std::shared_ptr<View> &root_view() const;
48 
50  void set_root_view(std::shared_ptr<View> root_view);
51 
53  const std::string &title() const;
54 
56  void set_title(const std::string &title);
57 
59  void set_frame_size(const Sizef &size, bool resizable = true);
60 
62  void set_content_size(const Sizef &size, bool resizable = true);
63 
65  void set_icon(const std::vector<std::string> &icon_images);
66 
68  void dismiss();
69 
72 
73  private:
74  WindowController(const WindowController &) = delete;
75  WindowController &operator=(const WindowController &) = delete;
76 
77  std::unique_ptr<WindowControllerImpl> impl;
78  friend class WindowManager;
79  };
80 }
Base class for controllers managing windows.
Definition: window_controller.h:40
void dismiss()
Closes the window.
void set_frame_size(const Sizef &size, bool resizable=true)
Sets the size of the window.
void set_root_view(std::shared_ptr< View > root_view)
Changes the root view.
Manages one or more windows.
Definition: window_manager.h:41
2D (width,height) size structure - Float
Definition: size.h:180
void set_content_size(const Sizef &size, bool resizable=true)
Sets the size of the window.
const std::shared_ptr< View > & root_view() const
Returns the root view.
Definition: signal.h:137
SlotContainer slots
Slot container helping with automatic disconnection of connected slots when the controller is destroy...
Definition: window_controller.h:71
const std::string & title() const
Returns the window title.
Definition: Application/application.h:35
void set_title(const std::string &title)
Sets the window title.
void set_icon(const std::vector< std::string > &icon_images)
Sets the icon used for the window.