~ricmm/platform-api/guards-for-null-sensors

« back to all changes in this revision

Viewing changes to android/include/private/application/ui/window_internal.h

* Add headers for new refactored platform API
* Implement new API for Android/hybris backend
* Implement lifecycle iteration 0 delegates infrastructure
* Do away with all old public headers and use only the new API.

Approved by Michael Frey, Ricardo Salveti, Thomas Voß, PS Jenkins bot.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright © 2013 Canonical Ltd.
 
3
 *
 
4
 * This program is free software: you can redistribute it and/or modify
 
5
 * it under the terms of the GNU Lesser General Public License version 3 as
 
6
 * published by the Free Software Foundation.
 
7
 *
 
8
 * This program is distributed in the hope that it will be useful,
 
9
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
10
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
11
 * GNU Lesser General Public License for more details.
 
12
 *
 
13
 * You should have received a copy of the GNU Lesser General Public License
 
14
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
15
 *
 
16
 * Authored by: Ricardo Mendoza <ricardo.mendoza@canonical.com>
 
17
 */
 
18
 
 
19
#ifndef UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_
 
20
#define UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_
 
21
 
 
22
#include <ubuntu/application/ui/window_properties.h>
 
23
 
 
24
namespace ubuntu
 
25
{
 
26
namespace application
 
27
{
 
28
namespace ui
 
29
{
 
30
class WindowProperties : public ubuntu::platform::ReferenceCountedBase
 
31
{
 
32
public:
 
33
    WindowProperties() {}
 
34
 
 
35
    ~WindowProperties()
 
36
    {
 
37
        free(this->title);
 
38
    }
 
39
 
 
40
    typedef ubuntu::platform::shared_ptr<WindowProperties> Ptr;
 
41
   
 
42
    void set_titlen(const char* title, size_t size)
 
43
    {
 
44
        this->title = (char *) malloc(sizeof (char) * (size+1));
 
45
        memcpy(this->title, title, size+1);
 
46
    }
 
47
 
 
48
    char *get_title()
 
49
    {
 
50
        return this->title;
 
51
    }
 
52
    
 
53
    void set_role(UAUiWindowRole role)
 
54
    {
 
55
        this->role = role;
 
56
    }
 
57
   
 
58
    UAUiWindowRole get_role()
 
59
    {
 
60
        return this->role;
 
61
    }
 
62
 
 
63
    void set_input_event_cb_and_ctx(UAUiWindowInputEventCb cb, void* ctx)
 
64
    {
 
65
        this->cb = cb;
 
66
        this->ctx = ctx;
 
67
    }
 
68
 
 
69
    UAUiWindowInputEventCb get_input_cb()
 
70
    {
 
71
        return this->cb;
 
72
    }
 
73
 
 
74
    void* get_ctx()
 
75
    {
 
76
        return this->ctx;
 
77
    }
 
78
 
 
79
private:
 
80
    char *title;
 
81
    UAUiWindowRole role;
 
82
    UAUiWindowInputEventCb cb;
 
83
    void* ctx;
 
84
   
 
85
protected:
 
86
    WindowProperties(const WindowProperties&) = delete;
 
87
    WindowProperties& operator=(const WindowProperties&) = delete;
 
88
};
 
89
 
 
90
class SessionProperties : public ubuntu::platform::ReferenceCountedBase
 
91
{
 
92
public:
 
93
    SessionProperties() {}
 
94
 
 
95
    typedef ubuntu::platform::shared_ptr<SessionProperties> Ptr;
 
96
 
 
97
    void set_type(SessionType type)
 
98
    {
 
99
        this->type = type;
 
100
    }
 
101
 
 
102
    SessionType get_type()
 
103
    {
 
104
        return this->type;
 
105
    }
 
106
 
 
107
private:
 
108
    SessionType type;
 
109
 
 
110
protected:
 
111
    virtual ~SessionProperties() {}
 
112
 
 
113
    SessionProperties(const SessionProperties&) = delete;
 
114
    SessionProperties& operator=(const SessionProperties&) = delete;
 
115
};
 
116
}
 
117
}
 
118
}
 
119
#endif /* UBUNTU_APPLICATION_UI_WINDOW_INTERNAL_H_ */