root_view.h
1 /*
2 ** ClanLib SDK
3 ** Copyright (c) 1997-2015 The ClanLib 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 ClanLib 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 "view.h"
32 #include "../Events/activation_change_event.h"
33
34 namespace clan
35 {
37 class RootView : public View
38 {
39 public:
40
41 protected:
43 void layout(Canvas &canvas);
44
46 void render(Canvas &canvas);
47
49 void dispatch_activation_change(ActivationChangeType type);
50
52 virtual bool root_hidden() const = 0;
53
55 virtual void set_root_hidden(bool value) = 0;
56
60 virtual Canvas get_root_canvas() const = 0;
61
63 virtual void set_root_needs_render() = 0;
64
66 virtual void layout_local() = 0;
67
69 virtual Pointf root_to_screen_pos(const Pointf &pos) = 0;
70
72 virtual Pointf root_from_screen_pos(const Pointf &pos) = 0;
73
74 private:
75 friend class View;
76 friend class ViewImpl;
77 friend class PositionedLayout;
78 };
79 }
clan::RootView::PositionedLayout
friend class PositionedLayout
Definition: root_view.h:77
clan
Definition: clanapp.h:35
clan::View
View for an area of the user interface.
Definition: view.h:61
clan::Canvas
2D Graphics Canvas
Definition: canvas.h:72
clan::RootView::root_to_screen_pos
virtual Pointf root_to_screen_pos(const Pointf &pos)=0
Map from local content to screen coordinates.
clan::RootView::set_root_needs_render
virtual void set_root_needs_render()=0
Signals this view needs to be rendered again.
clan::RootView::dispatch_activation_change
void dispatch_activation_change(ActivationChangeType type)
Dispatch activation change event to all views.
clan::RootView::root_from_screen_pos
virtual Pointf root_from_screen_pos(const Pointf &pos)=0
Map from screen to local content coordinates.
clan::RootView::ViewImpl
friend class ViewImpl
Definition: root_view.h:76
clan::RootView::layout
void layout(Canvas &canvas)
Layout root view.
clan::RootView::render
void render(Canvas &canvas)
Renders view into the specified canvas.
clan::RootView::layout_local
virtual void layout_local()=0
Layout local root.
clan::RootView::root_hidden
virtual bool root_hidden() const =0
Test if view is set to hidden.
clan::RootView::get_root_canvas
virtual Canvas get_root_canvas() const =0
clan::RootView
Base class for views participating as a root view in the user interface.
Definition: root_view.h:37
clan::Pointf
2D (x,y) point structure - Float
Definition: point.h:72
clan::RootView::set_root_hidden
virtual void set_root_hidden(bool value)=0
Hides a view from layout and rendering.
clan::ActivationChangeType
ActivationChangeType
Window activation change.
Definition: activation_change_event.h:36