aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/src/wx.erl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/wx/src/wx.erl')
-rw-r--r--lib/wx/src/wx.erl28
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/wx/src/wx.erl b/lib/wx/src/wx.erl
index e9f612edf7..34bf06cf46 100644
--- a/lib/wx/src/wx.erl
+++ b/lib/wx/src/wx.erl
@@ -1,7 +1,7 @@
%%
%% %CopyrightBegin%
%%
-%% Copyright Ericsson AB 2008-2012. All Rights Reserved.
+%% Copyright Ericsson AB 2008-2016. All Rights Reserved.
%%
%% Licensed under the Apache License, Version 2.0 (the "License");
%% you may not use this file except in compliance with the License.
@@ -66,7 +66,7 @@
get_env/0,set_env/1, debug/1,
batch/1,foreach/2,map/2,foldl/3,foldr/3,
getObjectType/1, typeCast/2,
- null/0, is_null/1]).
+ null/0, is_null/1, equal/2]).
-export([create_memory/1, get_memory_bin/1,
retain_memory/1, release_memory/1]).
@@ -106,8 +106,8 @@ new() ->
%% Or {silent_start, Bool}, which causes error messages at startup to
%% be suppressed. The latter can be used as a silent test of whether
%% wx is properly installed or not.
--spec new([Option]) -> wx_object() when Option :: {debug, list() | atom()} |
- {silent_start, boolean()}.
+-spec new([Option]) -> wx_object()
+ when Option :: {'debug', list() | atom()} | {'silent_start', boolean()}.
new(Options) when is_list(Options) ->
Debug = proplists:get_value(debug, Options, 0),
SilentStart = proplists:get_value(silent_start, Options, false),
@@ -118,7 +118,7 @@ new(Options) when is_list(Options) ->
null().
%% @doc Stops a wx server.
--spec destroy() -> ok.
+-spec destroy() -> 'ok'.
destroy() ->
wxe_server:stop(),
erase(?WXE_IDENTIFIER),
@@ -136,7 +136,7 @@ get_env() ->
%% @doc Sets the process wx environment, allows this process to use
%% another process wx environment.
--spec set_env(wx_env()) -> ok.
+-spec set_env(wx_env()) -> 'ok'.
set_env(#wx_env{sv=Pid, port=Port} = Env) ->
put(?WXE_IDENTIFIER, Env),
put(opengl_port, Port),
@@ -153,6 +153,10 @@ null() ->
-spec is_null(wx_object()) -> boolean().
is_null(#wx_ref{ref=NULL}) -> NULL =:= 0.
+%% @doc Returns true if both arguments references the same object, false otherwise
+-spec equal(wx_object(), wx_object()) -> boolean().
+equal(#wx_ref{ref=Ref1}, #wx_ref{ref=Ref2}) -> Ref1 =:= Ref2.
+
%% @doc Returns the object type
-spec getObjectType(wx_object()) -> atom().
getObjectType(#wx_ref{type=Type}) ->
@@ -187,7 +191,7 @@ batch(Fun) ->
end.
%% @doc Behaves like {@link //stdlib/lists:foreach/2} but batches wx commands. See {@link batch/1}.
--spec foreach(function(), list()) -> ok.
+-spec foreach(function(), list()) -> 'ok'.
foreach(Fun, List) ->
ok = wxe_util:cast(?BATCH_BEGIN, <<>>),
try lists:foreach(Fun, List)
@@ -263,7 +267,7 @@ get_memory_bin(#wx_mem{bin=Bin, size=Size}) ->
%% @doc Saves the memory from deletion until release_memory/1 is called.
%% If release_memory/1 is not called the memory will not be garbage collected.
--spec retain_memory(wx_memory()) -> ok.
+-spec retain_memory(wx_memory()) -> 'ok'.
retain_memory(#wx_mem{bin=Bin}) ->
wxe_util:send_bin(Bin),
ok = wxe_util:cast(?WXE_BIN_INCR, <<>>);
@@ -275,7 +279,7 @@ retain_memory(Bin) when is_binary(Bin) ->
wxe_util:send_bin(Bin),
ok = wxe_util:cast(?WXE_BIN_INCR, <<>>).
--spec release_memory(wx_memory()) -> ok.
+-spec release_memory(wx_memory()) -> 'ok'.
release_memory(#wx_mem{bin=Bin}) ->
wxe_util:send_bin(Bin),
ok = wxe_util:cast(?WXE_BIN_DECR, <<>>);
@@ -286,8 +290,8 @@ release_memory(Bin) when is_binary(Bin) ->
%% @doc Sets debug level. If debug level is 'verbose' or 'trace'
%% each call is printed on console. If Level is 'driver' each allocated
%% object and deletion is printed on the console.
--spec debug(Level | [Level]) -> ok
- when Level :: none | verbose | trace | driver | integer().
+-spec debug(Level | [Level]) -> 'ok'
+ when Level :: 'none' | 'verbose' | 'trace' | 'driver' | integer().
debug(Debug) ->
Level = calc_level(Debug),
@@ -328,7 +332,7 @@ set_debug(Level) when is_integer(Level) ->
end.
%% @doc Starts a wxErlang demo if examples directory exists and is compiled
--spec demo() -> ok | {error, atom()}.
+-spec demo() -> 'ok' | {'error', atom()}.
demo() ->
Priv = code:priv_dir(wx),
Demo = filename:join([filename:dirname(Priv),examples,demo]),