aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/examples/demo
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2015-08-28 12:51:45 +0200
committerDan Gudmundsson <[email protected]>2015-08-28 12:51:45 +0200
commit16d57dfa1ace44e0cc6b6bd04e0819ca8566da41 (patch)
tree7bfb68974f757bbf8f96135f1d2fa90e470318ac /lib/wx/examples/demo
parentbfdc9f97f1738d072d09b98a8980b0b59639db0b (diff)
downloadotp-16d57dfa1ace44e0cc6b6bd04e0819ca8566da41.tar.gz
otp-16d57dfa1ace44e0cc6b6bd04e0819ca8566da41.tar.bz2
otp-16d57dfa1ace44e0cc6b6bd04e0819ca8566da41.zip
wx: Add missing aui functionality
Diffstat (limited to 'lib/wx/examples/demo')
-rw-r--r--lib/wx/examples/demo/ex_aui.erl81
1 files changed, 52 insertions, 29 deletions
diff --git a/lib/wx/examples/demo/ex_aui.erl b/lib/wx/examples/demo/ex_aui.erl
index e0841da670..7fbf841d16 100644
--- a/lib/wx/examples/demo/ex_aui.erl
+++ b/lib/wx/examples/demo/ex_aui.erl
@@ -47,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
@@ -163,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"}]),