Mercurial > libervia-desktop-kivy
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/libs/garden/garden.contextmenu/context_menu.kv Sat Dec 24 14:16:58 2016 +0100 @@ -0,0 +1,133 @@ +<ContextMenu>: + cols: 1 + size_hint: None, None + spacing: 0, 0 + spacer: _spacer + on_visible: self._on_visible(args[1]) + on_parent: self._on_visible(self.visible) + +# canvas.before: +# Color: +# rgb: 1.0, 0, 0 +# Rectangle: +# pos: self.pos +# size: self.size + Widget: + id: _spacer + size_hint: 1, None + height: 3 + canvas.before: + Color: + rgb: 0.2, 0.71, 0.9 + Rectangle: + pos: self.pos + size: self.size + + +<ContextMenuItem>: + size_hint: None, None + submenu_arrow: _submenu_arrow + on_children: self._check_submenu() + on_parent: self._check_submenu() + canvas.before: + Color: + rgb: (0.15, 0.15, 0.15) + Rectangle: + pos: 0,0 + size: self.size + + Widget: + id: _submenu_arrow + size_hint: None, None + width: 6 + height: 11 +# pos: 10, 10 + pos: self.parent.width - self.width - 5, (self.parent.height - self.height) / 2 +# on_pos: print(self.pos) + canvas.before: + Translate: + xy: self.pos + Color: + rgb: (0.35, 0.35, 0.35) if self.disabled else (1, 1, 1) + Triangle: + points: [0,0, self.width,self.height/2, 0,self.height] + Translate: + xy: (-self.pos[0], -self.pos[1]) + + +<ContextMenuText>: + label: _label + width: self.parent.width if self.parent else 0 + height: 26 + + Label: + pos: 0,0 + id: _label + text: self.parent.text + color: self.parent.color + font_size: self.parent.font_size + padding: 10, 0 +# font_size: + halign: 'left' + valign: 'middle' + size: self.texture_size + size_hint: None, 1 + + +<AbstractMenuItemHoverable>: + on_hovered: self._on_hovered(args[1]) + canvas.before: + Color: + rgb: (0.25, 0.25, 0.25) if self.hovered and not self.disabled else (0.15, 0.15, 0.15) + Rectangle: + pos: 0,0 + size: self.size + + +<ContextMenuDivider>: + font_size: '10dp' + height: 20 if len(self.label.text) > 0 else 1 + canvas.before: + Color: + rgb: (0.25, 0.25, 0.25) + Rectangle: + pos: 0,self.height - 1 + size: self.width, 1 + + +<ContextMenuButton@Button>: + size_hint: None, None + font_size: 12 + height: 20 + background_normal: "" + background_down: "" + background_color: 0.2, 0.71, 0.9, 1.0 + border: (0, 0, 0, 0) + on_press: self.background_color = 0.10, 0.6, 0.8, 1.0 + on_release: self.background_color = 0.2, 0.71, 0.9, 1.0 + + +<ContextMenuToggleButton@ToggleButton>: + size_hint: None, None + font_size: '12px' + size: 30, 20 + background_normal: "" + background_down: "" + background_color: (0.2, 0.71, 0.9, 1.0) if self.state == 'down' else (0.25, 0.25, 0.25, 1.0) + border: (0, 0, 0, 0) + on_press: self.background_color = 0.10, 0.6, 0.8, 1.0 + on_release: self.background_color = 0.2, 0.71, 0.9, 1.0 + + +<ContextMenuSmallLabel@Label>: + size: self.texture_size[0], 18 + size_hint: None, None + font_size: '12dp' + + +<ContextMenuTextInput@TextInput>: + size_hint: None, None + height: 22 + font_size: '12dp' + padding: 7, 3 + multiline: False \ No newline at end of file