diff --git a/frontend/ui/widget/confirmbox.lua b/frontend/ui/widget/confirmbox.lua index d0091893f..c7bee880e 100644 --- a/frontend/ui/widget/confirmbox.lua +++ b/frontend/ui/widget/confirmbox.lua @@ -40,7 +40,7 @@ function ConfirmBox:init() } self.layout = { { ok_button, cancel_button } } - self.selected.x = 2 -- Cancel is default + self.selected.x = 2 -- Cancel is default self[1] = CenterContainer:new{ dimen = Screen:getSize(), diff --git a/frontend/ui/widget/group.lua b/frontend/ui/widget/group.lua index 8850fd6b8..27d06ca19 100644 --- a/frontend/ui/widget/group.lua +++ b/frontend/ui/widget/group.lua @@ -33,7 +33,9 @@ function HorizontalGroup:paintTo(bb, x, y) for i, widget in ipairs(self) do if self.align == "center" then - widget:paintTo(bb, x + self._offsets[i].x, y + (size.h - self._offsets[i].y) / 2) + widget:paintTo(bb, + x + self._offsets[i].x, + y + (size.h - self._offsets[i].y) / 2) elseif self.align == "top" then widget:paintTo(bb, x + self._offsets[i].x, y) elseif self.align == "bottom" then @@ -88,7 +90,7 @@ end function VerticalGroup:paintTo(bb, x, y) local size = self:getSize() - + for i, widget in ipairs(self) do if self.align == "center" then widget:paintTo(bb, x + (size.w - self._offsets[i].x) / 2, y + self._offsets[i].y) @@ -150,7 +152,7 @@ end function OverlapGroup:paintTo(bb, x, y) local size = self:getSize() - + for i, wget in ipairs(self) do local wget_size = wget:getSize() if wget.align == "right" then diff --git a/frontend/ui/widget/line.lua b/frontend/ui/widget/line.lua new file mode 100644 index 000000000..eba16976f --- /dev/null +++ b/frontend/ui/widget/line.lua @@ -0,0 +1,31 @@ +require "ui/widget/base" + +LineWidget = Widget:new{ + style = "solid", + background = 15, + dimen = nil, + --@TODO replay dirty hack here 13.03 2013 (houqp) + empty_segments = nil, +} + +function LineWidget:paintTo(bb, x, y) + if self.style == "dashed" then + for i = 0, self.dimen.w - 20, 20 do + bb:paintRect(x + i, y, + 16, self.dimen.h, self.background) + end + else + if self.empty_segments then + bb:paintRect(x, y, + self.empty_segments[1].s, + self.dimen.h, + self.background) + bb:paintRect(x + self.empty_segments[1].e, y, + self.dimen.w - x - self.empty_segments[1].e, + self.dimen.h, + self.background) + else + bb:paintRect(x, y, self.dimen.w, self.dimen.h, self.background) + end + end +end diff --git a/frontend/ui/widget/menu.lua b/frontend/ui/widget/menu.lua index b1c4d42a8..c37691607 100644 --- a/frontend/ui/widget/menu.lua +++ b/frontend/ui/widget/menu.lua @@ -8,7 +8,7 @@ require "ui/font" --[[ Widget that displays a shortcut icon for menu item -]] +--]] ItemShortCutIcon = WidgetContainer:new{ dimen = Geom:new{ w = 22, h = 22 }, key = nil, diff --git a/wtest.lua b/wtest.lua index c16cf05ae..a6c024f59 100644 --- a/wtest.lua +++ b/wtest.lua @@ -176,24 +176,70 @@ reader = ReaderUI:new{ readerwindow[1][1] = reader -main_menu = TouchMenu:new{ +touch_menu = TouchMenu:new{ title = "Document menu", item_table = { { - text = "item1", - callback = function() - end, + icon = "resources/icons/appbar.pokeball.png", + { + text = "item1", + callback = function() + end, + }, + { + text = "item2", + callback = function() + end, + }, + { + text = "item3", + callback = function() + end, + }, + { + text = "item4", + callback = function() + end, + }, + { + text = "item5", + callback = function() + end, + }, + { + text = "item6", + callback = function() + end, + }, + { + text = "item7", + callback = function() + end, + }, + { + text = "item8", + callback = function() + end, + }, + { + text = "item9", + callback = function() + end, + }, }, { - text = "item2", - callback = function() - end, - }, - { - text = "item3", - callback = function() - end, - }, + icon = "resources/icons/appbar.page.corner.bookmark.png", + { + text = "item10", + callback = function() + end, + }, + { + text = "item11", + callback = function() + end, + }, + } }, } @@ -204,11 +250,11 @@ main_menu = TouchMenu:new{ ----------------------------------------------------------------------- UIManager:show(Background:new()) UIManager:show(TestGrid) -UIManager:show(Clock:new()) +--UIManager:show(Clock:new()) --UIManager:show(M) --UIManager:show(Quiz) --UIManager:show(readerwindow) -UIManager:show(TouchMenu:new()) +UIManager:show(touch_menu) UIManager:run()