Gnome库的Lua完整封装 LuaGnome

码农软件 · 软件分类 · GUI开发框架 · 2019-08-08 18:59:15

软件介绍

LuaGnome(原名Lua-GTK)是Gnome库的Lua语言完整封装,包括glib 2.x, gdk, gtk 2.x等。

目前大约有7600个函数700个结构体、联合体和约5800个常量(枚举, 宏定义)可以使用。这个库非常小,编译后只有350KB左右(加上一些很小的、额外的Lua文件).

支持Linux、Windows(MinGW)。

示例代码:http://lua-gtk.luaforge.net/en/examples.html

function MainWin.new()
    local self = {}
    setmetatable(self, MainWin)

    self.w = gtk.window_new(gtk.WINDOW_TOPLEVEL)
    self.w:connect('destroy', gtk.main_quit)
    self.w:set_default_size(200, 250)
    self.w:set_title("Icon View Demo")

    local sw = gtk.scrolled_window_new(nil, nil)
    sw:set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
    self.w:add(sw)

    self.icon_view = gtk.icon_view_new()
    sw:add(self.icon_view)

    -- create store

    self.store = gtk.list_store_new(3, glib.TYPE_INT, glib.TYPE_STRING,
            gdk.pixbuf_get_type())
    self.icon_view:set_model(self.store)
    self.icon_view:set_text_column(1)
    self.icon_view:set_pixbuf_column(2)

    -- insert some items.  see .../gtk/gtkstock.h

    local iter = gtk.new "GtkTreeIter"
    local pix
    local names = { 'quit', 'open', 'redo', 'refresh', 'stop', 'save',
        'save-as', 'select-color', 'yes', 'no', 'zoom-fit' }

    for i, name in ipairs(names) do
        self.store:append(iter)
        pix = self.icon_view:render_icon('gtk-' .. name,
            gtk.ICON_SIZE_DIALOG, "")
        self.store:set(iter, 0, i, 1, name, 2, pix, -1)
    end

    self.w:show_all()
    return self
end

效果:

本文地址:https://www.codercto.com/soft/d/11936.html

GWT in Action

GWT in Action

Robert Hanson、Adam Tacy / Manning Publications / 2007-06-05 / USD 49.99

This book will show Java developers how to use the Google Web Toolkit (GWT) to rapidly create rich web-based applications using their existing skills. It will cover the full development cycle, from ......一起来看看 《GWT in Action》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

SHA 加密
SHA 加密

SHA 加密工具