View Source WxObject behaviour (wx_ex v0.4.0)
An Elixir wrapper for Erlang’s :wx_object behaviour, inspired by
GenServer etc.
Does not yet support 100% of :wx_object’s API. Specifically,
handle_sync_event/2 is not yet implemented.
Unlike GenServer, WxObject returns a wxWindow reference rather than a
pid. If you want to include your top level object in your supervision tree,
you will need to return the pid from start_link. For example:
def start_link(_arg) do
ref = WxObject.start_link(__MODULE__, nil, name: __MODULE__)
{:ok, WxObject.get_pid(ref)}
end
Summary
Functions
Make a synchronous call to the server and wait for its reply.
Cast a request to the server without waiting for a response.
Callbacks
@callback handle_call(request :: term(), from :: GenServer.server(), state :: term()) :: {:reply, reply, new_state} | {:reply, reply, new_state, timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:noreply, new_state} | {:noreply, new_state, timeout() | :hibernate | {:continue, continue_arg :: term()}} | {:stop, reason, reply, new_state} | {:stop, reason, new_state} when reply: term(), new_state: term(), reason: term()
Functions
@spec call(:wx.wx_object(), term(), timeout()) :: term()
Make a synchronous call to the server and wait for its reply.
@spec cast(:wx.wx_object(), term()) :: term()
Cast a request to the server without waiting for a response.
@spec get_pid(:wx.wx_object() | atom() | pid()) :: pid()
See :wx_object.get_pid/1.