mirror of
https://github.com/Insality/druid.git
synced 2025-09-27 10:02:18 +02:00
Add list of druid instances, add global events: on_window_callback, on_layout_change and on_language_change
This commit is contained in:
@@ -51,10 +51,17 @@ local function init_swipe_control(self)
|
||||
end
|
||||
|
||||
|
||||
local function on_window_callback(self, event, data)
|
||||
druid.on_window_callback(event, data)
|
||||
end
|
||||
|
||||
|
||||
function init(self)
|
||||
druid.set_default_style(default_style)
|
||||
self.druid = druid.new(self)
|
||||
|
||||
window.set_listener(on_window_callback)
|
||||
|
||||
init_top_panel(self)
|
||||
init_swipe_control(self)
|
||||
self.page = 1
|
||||
|
@@ -1,5 +1,4 @@
|
||||
local druid = require("druid.druid")
|
||||
local const = require("druid.const")
|
||||
local lang = require("example.lang")
|
||||
|
||||
|
||||
@@ -12,9 +11,7 @@ local function setup_druid()
|
||||
return lang.get_locale(lang_id)
|
||||
end)
|
||||
|
||||
-- TODO: Call druid.finish_setup?
|
||||
-- Need to update all gui, in case, when gui init was befure this init
|
||||
msg.post("/gui#main", const.ON_CHANGE_LANGUAGE)
|
||||
druid.on_language_change()
|
||||
end
|
||||
|
||||
|
||||
|
@@ -1,4 +1,4 @@
|
||||
local const = require("druid.const")
|
||||
local druid = require("druid.druid")
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -47,7 +47,7 @@ end
|
||||
|
||||
function M.toggle_locale()
|
||||
data = data == en and ru or en
|
||||
msg.post("/gui#main", const.ON_CHANGE_LANGUAGE)
|
||||
druid.on_language_change()
|
||||
end
|
||||
|
||||
return M
|
||||
|
Reference in New Issue
Block a user