gse.erl
来自「OTP是开放电信平台的简称」· ERL 代码 · 共 723 行 · 第 1/2 页
ERL
723 行
%% ``The contents of this file are subject to the Erlang Public License,%% Version 1.1, (the "License"); you may not use this file except in%% compliance with the License. You should have received a copy of the%% Erlang Public License along with this software. If not, it can be%% retrieved via the world wide web at http://www.erlang.org/.%% %% Software distributed under the License is distributed on an "AS IS"%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See%% the License for the specific language governing rights and limitations%% under the License.%% %% The Initial Developer of the Original Code is Ericsson Utvecklings AB.%% Portions created by Ericsson are Copyright 1999, Ericsson Utvecklings%% AB. All Rights Reserved.''%% %% $Id$%%%%%----------------------------------------------------------------------%%% Purpose : Wrapper library for GS to provide proper error handling%%%-----------------------------------------------------------------------module(gse).%%-compile(export_all).-export([ start/0, start/1, create/3, create_named/4, config/2, read/2, destroy/1, create_tree/2, window/2, named_window/3, button/2, named_button/3, checkbutton/2, named_checkbutton/3, radiobutton/2, named_radiobutton/3, frame/2, named_frame/3, canvas/2, named_canvas/3, label/2, named_label/3, message/2, named_message/3, listbox/2, named_listbox/3, entry/2, named_entry/3, scrollbar/2, named_scrollbar/3, scale/2, named_scale/3, editor/2, named_editor/3, prompter/2, named_prompter/3, line/2, named_line/3, oval/2, named_oval/3, rectangle/2, named_rectangle/3, polygon/2, named_polygon/3, text/2, named_text/3, image/2, named_image/3, arc/2, named_arc/3, menu/2, named_menu/3, menubutton/2, named_menubutton/3, menubar/2, named_menubar/3, menuitem/2, named_menuitem/3, grid/2, named_grid/3, gridline/2, named_gridline/3, %% Convenience functions enable/1, disable/1, select/1, deselect/1, map/1, unmap/1, resize/3, name_occupied/1 ]).%%%% gse:start()%% Returns: %% An identifier to a top object for the graphic system%%%% Errors:%% Exits with a {?MODULE,start,Reason} if there is a problem%% creating the top level graphic object.%%start() -> case gs:start() of {error,Reason} -> exit({?MODULE, start,Reason}); Return -> Return end.%%%% gse:start(Opts)%% Returns: %% An identifier to a top object for the graphic system%%%% Errors:%% Exits with a {?MODULE,start,Reason} if there is a problem%% creating the top level graphic object.%%start(Opts) -> case gs:start(Opts) of {error,Reason} -> exit({?MODULE, start,Reason}); Return -> Return end.%%%% gse:create(Objtype,Parent,Opts) replaces%% the unnecessary functions:%% gs:create(Obj,Parent)%% gs:create(Obj,Parent,Opt)%% gs:create(Obj,Parent)%% gs:create(Obj,Parent)%%%% Returns:%% An identifier for the created object%%%% Errors: {?MODULE, create, Reason}, where Reason is one of:%% {no_such_parent, Parent}%% {unknown_type, Type}%% {incvalid_option, Type, {Option,Value}}%%%%create(Objtype,Parent,Opts) when is_list(Opts) -> case gs:create(Objtype,Parent,Opts) of {error,Reason} -> exit({?MODULE, create,Reason}); Return -> Return end. %%%% gse:create_named(Name, Objtype,Parent, Opts) replaces%% the confusing%% gs:create(Name,Objtype, Parent, Opts)%%%% Returns:%% An identifier for the created object%%%% Errors: {?MODULE, create, Reason}, where Reason is one of:%% {no_such_parent, Parent}%% {unknown_type, Type}%% {incvalid_option, Type, {Option,Value}}%% {name_occupied,Name}%%create_named(Name,Objtype,Parent,Opts) when is_list(Opts) -> case gs:create(Objtype,Name,Parent,Opts) of {error,Reason} -> exit({?MODULE, create_named,Reason}); Return -> Return end. %%%% gse:config(Object, Options) replaces%% the unnecessary%% gs:config(Object, Opt)%%config(Object,Opts) when is_list(Opts) -> case gs:config(Object,Opts) of {error,Reason} -> exit({?MODULE, config,Reason}); Return -> Return end.%%%% gs:read(Object, OptionKey)%%read(Object,OptionKey) -> case gs:read(Object,OptionKey) of {error,Reason} -> exit({?MODULE, read,Reason}); Return -> Return end.%%%% gs:destroy(Object)%%destroy(Object)-> case gs:destroy(Object) of {error,Reason} -> exit({?MODULE, destroy,Reason}); Return -> Return end.%%%% gs:create_tree%%create_tree(Parent, Tree)-> case gs:create_tree(Parent,Tree) of {error,Reason} -> exit({?MODULE, create_tree,Reason}); Return -> Return end.window(Parent,Options) when is_list(Options) -> case gs:window(Parent,Options) of {error, Reason} -> exit({?MODULE,window,Reason}); Return -> Return end.named_window(Name,Parent,Options) when is_list(Options) -> case gs:window(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_window,Reason}); Return -> Return end. button(Parent,Options) when is_list(Options) -> case gs:button(Parent,Options) of {error, Reason} -> exit({?MODULE,button,Reason}); Return -> Return end.named_button(Name,Parent,Options) when is_list(Options) -> case gs:button(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_button,Reason}); Return -> Return end. checkbutton(Parent,Options) when is_list(Options) -> case gs:checkbutton(Parent,Options) of {error, Reason} -> exit({?MODULE,checkbutton,Reason}); Return -> Return end.named_checkbutton(Name,Parent,Options) when is_list(Options) -> case gs:checkbutton(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_checkbutton,Reason}); Return -> Return end. radiobutton(Parent,Options) when is_list(Options) -> case gs:radiobutton(Parent,Options) of {error, Reason} -> exit({?MODULE,radiobutton,Reason}); Return -> Return end.named_radiobutton(Name,Parent,Options) when is_list(Options) -> case gs:radiobutton(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_radiobutton,Reason}); Return -> Return end. frame(Parent,Options) when is_list(Options) -> case gs:frame(Parent,Options) of {error, Reason} -> exit({?MODULE,frame,Reason}); Return -> Return end.named_frame(Name,Parent,Options) when is_list(Options) -> case gs:frame(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_frame,Reason}); Return -> Return end. canvas(Parent,Options) when is_list(Options) -> case gs:canvas(Parent,Options) of {error, Reason} -> exit({?MODULE,canvas,Reason}); Return -> Return end.named_canvas(Name,Parent,Options) when is_list(Options) -> case gs:canvas(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_canvas,Reason}); Return -> Return end. label(Parent,Options) when is_list(Options) -> case gs:label(Parent,Options) of {error, Reason} -> exit({?MODULE,label,Reason}); Return -> Return end.named_label(Name,Parent,Options) when is_list(Options) -> case gs:label(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_label,Reason}); Return -> Return end. message(Parent,Options) when is_list(Options) -> case gs:message(Parent,Options) of {error, Reason} -> exit({?MODULE,message,Reason}); Return -> Return end.named_message(Name,Parent,Options) when is_list(Options) -> case gs:message(Name, Parent,Options) of {error, Reason} -> exit({?MODULE,named_message,Reason}); Return -> Return end. listbox(Parent,Options) when is_list(Options) -> case gs:listbox(Parent,Options) of {error, Reason} -> exit({?MODULE,listbox,Reason});
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?