View Source WxObject behaviour (wx_ex v0.4.3)
An Elixir wrapper for Erlang’s :wx_object behaviour, along the lines of
GenServer etc.
Does not yet support 100% of :wx_object’s API.
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)}
endFor an example of using this module, see wx_tutorial.
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.
Get the pid of the object handle.
Stops a WxObject server with the given reason. Invokes terminate(reason,
state) in the server. The call waits until the process is terminated. If the
call times out, or if the process does not exist, an exception is raised.
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()
Get the pid of the object handle.
@spec stop(:wx.wx_object(), term(), timeout()) :: :ok
Stops a WxObject server with the given reason. Invokes terminate(reason,
state) in the server. The call waits until the process is terminated. If the
call times out, or if the process does not exist, an exception is raised.