summaryrefslogtreecommitdiff
path: root/efl/elementary/efl.elementary_background.pxi
blob: f2831578ea4a60eb25506d24fac624744b2f9909 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Copyright (c) 2008-2009 Simon Busch
#
# This file is part of python-elementary.
#
# python-elementary is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# python-elementary is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with python-elementary.  If not, see <http://www.gnu.org/licenses/>.
#

cdef class Background(LayoutClass):

    def __init__(self, evasObject parent):
        self._set_obj(elm_bg_add(parent.obj))

    def file_set(self, filename, group = ""):
        return bool(elm_bg_file_set(self.obj, _cfruni(filename), _cfruni(group)))

    def file_get(self):
        cdef const_char_ptr filename, group

        elm_bg_file_get(self.obj, &filename, &group)
        if filename == NULL:
            filename = ""
        if group == NULL:
            group = ""
        return (_ctouni(filename), _ctouni(group))

    property file:
        def __get__(self):
            cdef const_char_ptr filename, group
            elm_bg_file_get(self.obj, &filename, &group)
            if filename == NULL:
                filename = ""
            if group == NULL:
                group = ""
            return (_ctouni(filename), _ctouni(group))

        def __set__(self, value):
            if isinstance(value, tuple) or isinstance(value, list):
                filename, group = value
            else:
                filename = value
                group = ""
            elm_bg_file_set(self.obj, _cfruni(filename), _cfruni(group))

    def option_set(self, option):
        elm_bg_option_set(self.obj, option)

    def option_get(self):
        return elm_bg_option_get(self.obj)

    property option:
        def __get__(self):
            return elm_bg_option_get(self.obj)

        def __set__(self, value):
            elm_bg_option_set(self.obj, value)

    def color_set(self, r, g, b):
        elm_bg_color_set(self.obj, r, g, b)

    def color_get(self):
        cdef int r, g, b

        elm_bg_color_get(self.obj, &r, &g, &b)
        return (r, g, b)

    property color:
        def __get__(self):
            cdef int r, g, b
            elm_bg_color_get(self.obj, &r, &g, &b)
            return (r, g, b)

        def __set__(self, value):
            cdef int r, g, b
            r, g, b = value
            elm_bg_color_set(self.obj, r, g, b)

    def load_size_set(self, w, h):
        elm_bg_load_size_set(self.obj, w, h)

    property load_size:
        def __set__(self, value):
            cdef Evas_Coord w, h
            w, h = value
            elm_bg_load_size_set(self.obj, w, h)


_object_mapping_register("elm_bg", Background)