diff options
Diffstat (limited to 'lib/wx/examples/demo/ex_aui.erl')
-rw-r--r-- | lib/wx/examples/demo/ex_aui.erl | 104 |
1 files changed, 64 insertions, 40 deletions
diff --git a/lib/wx/examples/demo/ex_aui.erl b/lib/wx/examples/demo/ex_aui.erl index 70372caad8..d8fc0021f1 100644 --- a/lib/wx/examples/demo/ex_aui.erl +++ b/lib/wx/examples/demo/ex_aui.erl @@ -1,18 +1,19 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-2016. All Rights Reserved. %% -%% 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 online 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. +%% Licensed under the Apache License, Version 2.0 (the "License"); +%% you may not use this file except in compliance with the License. +%% You may obtain a copy of the License at +%% +%% http://www.apache.org/licenses/LICENSE-2.0 +%% +%% Unless required by applicable law or agreed to in writing, software +%% distributed under the License is distributed on an "AS IS" BASIS, +%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +%% See the License for the specific language governing permissions and +%% limitations under the License. %% %% %CopyrightEnd% @@ -46,40 +47,54 @@ init(Config) -> -define(pi, wxAuiPaneInfo). do_init(Config) -> - Parent = proplists:get_value(parent, Config), + Parent = proplists:get_value(parent, Config), Panel = wxPanel:new(Parent, []), %% Setup sizers MainSizer = wxBoxSizer:new(?wxVERTICAL), Manager = wxAuiManager:new([{managed_wnd, Panel}]), - - Pane = ?pi:new(), - ?pi:closeButton(Pane), - ?pi:right(Pane), - ?pi:dockable(Pane, [{b, true}]), - ?pi:floatingSize(Pane, 300,200), - ?pi:minSize(Pane, {50,50}), - ?pi:paneBorder(Pane), - ?pi:floatable(Pane, [{b, true}]), - - create_pane(Panel, Manager, Pane), - create_pane(Panel, Manager, - ?pi:caption(?pi:top(?pi:new(Pane)), "One")), - create_pane(Panel, Manager, - ?pi:caption(?pi:left(?pi:new(Pane)), "two")), - create_pane(Panel, Manager, - ?pi:caption(?pi:bottom(?pi:new(Pane)), "Three")), - Pane2 = wxAuiPaneInfo:new(Pane), - ?pi:centrePane(Pane2), - create_notebook(Panel, Manager, ?pi:new(Pane2)), - - wxPanel:setSizer(Panel, MainSizer), - - wxAuiManager:connect(Manager, aui_pane_button, [{skip,true}]), - wxAuiManager:connect(Manager, aui_pane_maximize, [{skip,true}]), - wxAuiManager:update(Manager), - process_flag(trap_exit, true), - {Panel, #state{parent=Panel, config=Config, aui=Manager}}. + try + Art = wxAuiManager:getArtProvider(Manager), + wxAuiDockArt:setColour(Art, ?wxAUI_DOCKART_BACKGROUND_COLOUR, {200, 100, 100}), + wxAuiDockArt:setColour(Art, ?wxAUI_DOCKART_ACTIVE_CAPTION_COLOUR, {200, 100, 100}), + wxAuiDockArt:setColour(Art, ?wxAUI_DOCKART_INACTIVE_CAPTION_COLOUR, {100, 200, 100}), + + + Pane = ?pi:new(), + ?pi:closeButton(Pane), + ?pi:right(Pane), + ?pi:dockable(Pane, [{b, true}]), + ?pi:floatingSize(Pane, 300,200), + ?pi:minSize(Pane, {50,50}), + ?pi:paneBorder(Pane), + ?pi:floatable(Pane, [{b, true}]), + + create_pane(Panel, Manager, Pane), + create_pane(Panel, Manager, + ?pi:caption(?pi:top(?pi:new(Pane)), "One")), + create_pane(Panel, Manager, + ?pi:caption(?pi:left(?pi:new(Pane)), "two")), + create_pane(Panel, Manager, + ?pi:caption(?pi:bottom(?pi:new(Pane)), "Three")), + Pane2 = wxAuiPaneInfo:new(Pane), + ?pi:centrePane(Pane2), + create_notebook(Panel, Manager, ?pi:new(Pane2)), + + wxPanel:setSizer(Panel, MainSizer), + + wxAuiManager:connect(Manager, aui_pane_button, [{skip,true}]), + wxAuiManager:connect(Manager, aui_pane_maximize, [{skip,true}]), + wxAuiManager:update(Manager), + process_flag(trap_exit, true), + {Panel, #state{parent=Panel, config=Config, aui=Manager}} + catch Class:Reason -> + ST = erlang:get_stacktrace(), + io:format("AUI Crashed ~p ~p~n",[Reason, ST]), + wxAuiManager:unInit(Manager), + wxAuiManager:destroy(Manager), + wxPanel:destroy(Panel), + erlang:raise(Class, Reason, ST) + end. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Callbacks handled as normal gen_server callbacks @@ -162,6 +177,15 @@ create_notebook(Parent, Manager, Pane) -> Notebook = wxAuiNotebook:new(Parent, [{style, Style}]), + Art = wxAuiSimpleTabArt:new(), + case ?wxMAJOR_VERSION > 2 of + true -> + wxAuiSimpleTabArt:setColour(Art, {200, 0, 0}), + wxAuiSimpleTabArt:setActiveColour(Art, {0, 0, 200}); + false -> ignore + end, + ok = wxAuiNotebook:setArtProvider(Notebook, Art), + Tab1 = wxPanel:new(Notebook, []), wxPanel:setBackgroundColour(Tab1, ?wxBLACK), wxButton:new(Tab1, ?wxID_ANY, [{label,"New tab"}]), |