comparison src/libs/garden/garden.contextmenu/context_menu.kv @ 83:741a7d6d8c28

garden: added contextmenu
author Goffi <goffi@goffi.org>
date Sat, 24 Dec 2016 14:16:58 +0100
parents
children 2caee196d19a
comparison
equal deleted inserted replaced
82:4c6d56c069d9 83:741a7d6d8c28
1 <ContextMenu>:
2 cols: 1
3 size_hint: None, None
4 spacing: 0, 0
5 spacer: _spacer
6 on_visible: self._on_visible(args[1])
7 on_parent: self._on_visible(self.visible)
8
9 # canvas.before:
10 # Color:
11 # rgb: 1.0, 0, 0
12 # Rectangle:
13 # pos: self.pos
14 # size: self.size
15 Widget:
16 id: _spacer
17 size_hint: 1, None
18 height: 3
19 canvas.before:
20 Color:
21 rgb: 0.2, 0.71, 0.9
22 Rectangle:
23 pos: self.pos
24 size: self.size
25
26
27 <ContextMenuItem>:
28 size_hint: None, None
29 submenu_arrow: _submenu_arrow
30 on_children: self._check_submenu()
31 on_parent: self._check_submenu()
32 canvas.before:
33 Color:
34 rgb: (0.15, 0.15, 0.15)
35 Rectangle:
36 pos: 0,0
37 size: self.size
38
39 Widget:
40 id: _submenu_arrow
41 size_hint: None, None
42 width: 6
43 height: 11
44 # pos: 10, 10
45 pos: self.parent.width - self.width - 5, (self.parent.height - self.height) / 2
46 # on_pos: print(self.pos)
47 canvas.before:
48 Translate:
49 xy: self.pos
50 Color:
51 rgb: (0.35, 0.35, 0.35) if self.disabled else (1, 1, 1)
52 Triangle:
53 points: [0,0, self.width,self.height/2, 0,self.height]
54 Translate:
55 xy: (-self.pos[0], -self.pos[1])
56
57
58 <ContextMenuText>:
59 label: _label
60 width: self.parent.width if self.parent else 0
61 height: 26
62
63 Label:
64 pos: 0,0
65 id: _label
66 text: self.parent.text
67 color: self.parent.color
68 font_size: self.parent.font_size
69 padding: 10, 0
70 # font_size:
71 halign: 'left'
72 valign: 'middle'
73 size: self.texture_size
74 size_hint: None, 1
75
76
77 <AbstractMenuItemHoverable>:
78 on_hovered: self._on_hovered(args[1])
79 canvas.before:
80 Color:
81 rgb: (0.25, 0.25, 0.25) if self.hovered and not self.disabled else (0.15, 0.15, 0.15)
82 Rectangle:
83 pos: 0,0
84 size: self.size
85
86
87 <ContextMenuDivider>:
88 font_size: '10dp'
89 height: 20 if len(self.label.text) > 0 else 1
90 canvas.before:
91 Color:
92 rgb: (0.25, 0.25, 0.25)
93 Rectangle:
94 pos: 0,self.height - 1
95 size: self.width, 1
96
97
98 <ContextMenuButton@Button>:
99 size_hint: None, None
100 font_size: 12
101 height: 20
102 background_normal: ""
103 background_down: ""
104 background_color: 0.2, 0.71, 0.9, 1.0
105 border: (0, 0, 0, 0)
106 on_press: self.background_color = 0.10, 0.6, 0.8, 1.0
107 on_release: self.background_color = 0.2, 0.71, 0.9, 1.0
108
109
110 <ContextMenuToggleButton@ToggleButton>:
111 size_hint: None, None
112 font_size: '12px'
113 size: 30, 20
114 background_normal: ""
115 background_down: ""
116 background_color: (0.2, 0.71, 0.9, 1.0) if self.state == 'down' else (0.25, 0.25, 0.25, 1.0)
117 border: (0, 0, 0, 0)
118 on_press: self.background_color = 0.10, 0.6, 0.8, 1.0
119 on_release: self.background_color = 0.2, 0.71, 0.9, 1.0
120
121
122 <ContextMenuSmallLabel@Label>:
123 size: self.texture_size[0], 18
124 size_hint: None, None
125 font_size: '12dp'
126
127
128 <ContextMenuTextInput@TextInput>:
129 size_hint: None, None
130 height: 22
131 font_size: '12dp'
132 padding: 7, 3
133 multiline: False