lights FAQ Forum   github.com/luapower/winapi

Native OS APIs
winapi
objc
syscall
xlib
shm

winapi

win32 windows & controls


Scope

Windows, common controls and dialogs, message loop, system APIs, OpenGL and cairo.

Features

  • UTF8 Lua strings everywhere (also works with wide char buffers)
  • OpenGL, cairo and bitmap widgets
  • anchor-based layout model for all controls
  • object system with virtual properties (win.title = 'hello' sets the title)
  • binding helpers for easy binding of new and future APIs
  • all calls are error-checked
  • automatic memory management (ownership; buffers)
  • flags can be passed as 'FLAG1 FLAG2'
  • counting from 1 everywhere.

Status

Current status and issues.

Hello World

local winapi = require'winapi'
require'winapi.windowclass'

local win = winapi.Window{
   w = 500,                --all these are "initial fields"
   h = 300,
   title = 'Lua rulez',
   autoquit = true,        --this is to quit app when the window is closed
   visible = false,        --this field is from BaseWindow
}

function win:on_close()    --this is an event handler
   print'Bye'
end

print(win.title)           --this is how to read the value of a property
win.title = 'Lua rulez!'   --this is how to set the value of a property
win:show()                 --this is a method call

os.exit(winapi.MessageLoop()) --start the message loop

Demos

Check out winapi_demo to see all the controls in action:

screnshot

screnshot

Also, many modules can be run as standalone scripts, which will showcase their functionality, so there's lots of little demos there too.

Documentation

Architecture

Classes

  • Object - objects
    • VObject - objects with virtual properties
      • BaseWindow - base class for top-level windows and controls
      • [Menu][winapi.menuclass] - menus and menu bars
      • [NotifyIcon][winapi.notifyiconclass] - system tray icons

Functions

The "proc" layer is documented in the code, including API quirks and empirical knowledge, so do check out the source code.

Modules

bindinglast updated
winapi.bitmask bitmask encoding and decoding 2 years ago
winapi.debug strict mode and debug tools (optional module) 2 years ago
winapi.namespace namespace module and utils 2 years ago
winapi.struct struct ctype wrapper 2 years ago
winapi.util binding utilities 2 years ago
winapi.wcs utf8 <-> wide char conversions 2 years ago
winapi.init main winapi module 2 years ago
winapi [doc] loader for winapi.init (or the demo if run standalone) 2 years ago
oo/abstractlast updated
winapi.basewindowclass [doc] base class for top-level windows and controls 2 years ago
winapi.controlclass [doc] base class for standard controls 2 years ago
winapi.handlelist handle to Lua object mapping 2 years ago
winapi.itemlist base class for lists of objects 2 years ago
oo/controlslast updated
winapi.basebuttonclass [doc] base class for button-like controls 2 years ago
winapi.bitmappanel [doc] RGBA bitmap control 2 years ago
winapi.buttonclass [doc] push-button control 2 years ago
winapi.cairopanel [doc] cairo pixman surface control 24 days ago
winapi.cairosgpanel cairo scene graph panel 2 years ago
winapi.checkboxclass [doc] checkbox control 2 years ago
winapi.comboboxclass [doc] ComboBoxEx32 control 2 years ago
winapi.editclass [doc] standard edit control 2 years ago
winapi.groupboxclass [doc] groupbox control 2 years ago
winapi.labelclass [doc] standard label control 2 years ago
winapi.listboxclass [doc] standard listbox control 2 years ago
winapi.listviewclass standard listview control 2 years ago
winapi.menuclass standard menu control 2 years ago
winapi.notifyiconclass system tray icons 20 months ago
winapi.panelclass [doc] custom frameless child windows 2 years ago
winapi.radiobuttonclass [doc] radio button control 2 years ago
winapi.tabcontrolclass standard tab control 2 years ago
winapi.toolbarclass standard toolbar control 2 years ago
winapi.waitemlistclass accelerator item list 2 years ago
winapi.wglpanel [doc] opengl-enabled panel 2 years ago
oo/oo-systemlast updated
winapi.class [doc] single inheritance object model 2 years ago
winapi.object [doc] base object class 2 years ago
winapi.vobject [doc] object class with virtual properties 2 years ago
oo/resourceslast updated
winapi.imagelistclass image lists 2 years ago
oo/systemlast updated
winapi.mmdeviceclass Windows Multimedia Device API 2 years ago
oo/windowslast updated
winapi.windowclass [doc] overlapping (aka top-level) windows 2 years ago
proc/controlslast updated
winapi.accelerator accelerator tables 2 years ago
winapi.button button and button-like controls 2 years ago
winapi.combobox old combobox control 2 years ago
winapi.comboboxex comctl32 combobox control 2 years ago
winapi.comctl common controls API 2 years ago
winapi.edit standard edit control 2 years ago
winapi.filedialogs standard open and save dialogs 2 years ago
winapi.headercontrol standard header control 2 years ago
winapi.listbox standard listbox control 2 years ago
winapi.listview standard listview control 2 years ago
winapi.menu standard menu control 2 years ago
winapi.messagebox standard message box dialog 2 years ago
winapi.richedit standard richedit control 2 years ago
winapi.static label/shape/image control 2 years ago
winapi.tabcontrol standard tab control 2 years ago
winapi.toolbar standard toolbar control 2 years ago
winapi.tooltip standard tooltip control 2 years ago
winapi.treeview standard treeview control 2 years ago
proc/dialogslast updated
winapi.colorchooser color chooser dialog 2 years ago
winapi.comdlg common dialogs API 2 years ago
proc/gdilast updated
winapi.bitmap bitmap API 2 years ago
winapi.ddev Display Devices API 2 years ago
winapi.devcaps device capabilities API 2 years ago
winapi.dibitmap RGBA device independent bitmaps 2 years ago
proc/inputlast updated
winapi.keyboard Keyboard API 2 years ago
winapi.mouse Mouse API 2 years ago
winapi.rawinput Raw Input API 2 years ago
proc/multimedialast updated
winapi.dsound DirectSound API 2 years ago
proc/olelast updated
winapi.idataobject IDataObject interface 2 years ago
winapi.dragdrop drag & drop OLE API 3 years ago
winapi.ienumformatetc IEnumFormatETC interface 2 years ago
proc/opengllast updated
winapi.gl opengl dynamic namespace 2 years ago
winapi.gl11 OpenGL 1.1 API 2 years ago
winapi.gl21 OpenGL 2.1 API 2 years ago
winapi.wgl WGL API from wingdi.h 2 years ago
winapi.wglext opengl WGL API from wglext.h 2 years ago
proc/resourceslast updated
winapi.color standard color brushes 2 years ago
winapi.cursor cursor resources 2 years ago
winapi.font font resources (the old API) 2 years ago
winapi.fontex font resources (the new API) 2 years ago
winapi.icon icon resources 2 years ago
winapi.imagelist image lists 2 years ago
winapi.resource LoadImage API 2 years ago
proc/systemlast updated
winapi.clipboard clipboard API 2 years ago
winapi.file file I/O 2 years ago
winapi.filemapping memory mapped files 2 years ago
winapi.memory Memory Management API 2 years ago
winapi.mmdevice Windows Multimedia Device API 2 years ago
winapi.mmsystem Multimedia API 2 years ago
winapi.module LoadLibrary API 2 years ago
winapi.monitor Monitor API 2 years ago
winapi.ole OLE API 2 years ago
winapi.process Process API 2 years ago
winapi.propsys Property System API 2 years ago
winapi.registry Registry API 2 years ago
winapi.rpc RPC types 2 years ago
winapi.shellapi Shell32 API 2 years ago
winapi.spi System Parameters Info API 2 years ago
winapi.sstorage Structured Storage API 2 years ago
winapi.sysinfo System Info API 2 years ago
winapi.systemmetrics System Metrics API 2 years ago
winapi.time time functions 2 years ago
winapi.uuid UUID API from rpcdce.h 2 years ago
winapi.winbase winbase.h. incomplete :) 2 years ago
winapi.winnt don't know the scope of this yet. 2 years ago
proc/windowslast updated
winapi.windowclasses WNDCLASSEX API 2 years ago
winapi.dpiaware DPI-awareness API 2 years ago
winapi.gdi GDI API 2 years ago
winapi.window Windows (as in HWND) API 2 years ago
winapi.wmapp user-defined (WM_APP+N) messages 2 years ago
testlast updated
winapi.showcase testing utilities 2 years ago
typeslast updated
winapi.logfonttype LOGFONTW type 2 years ago
winapi.types types and macros from multiple headers 2 years ago
winapi.winuser winuser types and macros from multiple headers 2 years ago


Last updated: 2 years ago | Edit on GitHub

Pkg type:Lua+ffi
Version: r3-7-g1406a8f
Last commit:
License: PD
Requires: cairo  glue  luajit  opengl  sg  eq  path2d  pp 
Required by: cairo  cplayer  nw  opengl  sg 

Top