Giter VIP home page Giter VIP logo

gtknode's Introduction

gtknode

Yet Another GUI framework for Erlang

DESIGN GOALS

  • GUI separated from application by message passing
  • distributed (application and GUI can run on different machines)
  • centered around a GUI builder
  • small volume of (hand-written) code
  • pre-documented

ARCHITECTURE

A c-node (a daemon that implements the Erlang distribution protocol) that instantiates the GUI from a configuration file. The c-node sends messages to the Erlang node when the user interacts with the GUI; the Erlang application changes the state of the GUI by sending messages to widgets in the c-node. The widgets should look like Erlang processes with registered names. The protocol should look something like this:

CnodePid ! {aWidget,dosomething,Args}       % erlang->cNode
ApplicationPid ! {reply, Val}               % cNode->erlang
ApplicationPid ! {signal,aWidget,eventType} % cNode->erlang

In this example aWidget is the name given to a widget in the configration file. It can also be thought of as the registered name of the process implementing the widget in the c-node.

The c-node is responsible for garbage-collecting all temporary data.

IMPLEMENTATION

REFERENCE

The c-node is started thus;

gtknode node host regname cookie cnode-name otp-version

When started, gtknode will connect to it's application by sending a handshake message to {node@host, regname}.

The messsage looks like this;

{{GtkPid,handshake}, []}

The Erlang application sends messages to the gtknode using GtkPid. messages look like this:

list({'Gtk_function', [Args]})

E.g., if we have a GtkButton widget, named b1, and we want to use these functions:

const gchar* gtk_button_get_label (GtkButton *button);
void         gtk_button_set_label (GtkButton *button, const gchar *label);

we could send this:

GtkPid ! [{'Gtk_button_set_label',[b1,"foo"]},{'Gtk_button_get_label',[b1]}].

and we would receive this:

{{GtkPid,reply}, [{ok,void},{ok,"foo"}]}

Signals are sent from gtknode if the signal handler for a specified signal-widget combination is set to gn_sighandler. The signals look like this:

{{GtkPid, signal}, {atom(WidgetName),atom(SignalName)}}

E.g., if we delete the GtkWindow named window1 we'll get this signal:

{{GtkPid, signal},{window1,'GDK_DELETE'}}

Given that we've requested it, of course.

EXAMPLES

The file src/gtknode.erl implements a controller/middleman for the gtknode, it's quite instructive. It is recommended to use this instead of working directly against the c-node.

The priv/examples directory contains a few examples.

GETTING IT

http://github.com/massemanet/gtknode/

STATUS

Stable since 2008

gtknode's People

Contributors

jlouis avatar lemenkov avatar massemanet avatar master avatar nox avatar oubiwann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gtknode's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.