diff options
Diffstat (limited to 'lib/wx/examples/demo')
27 files changed, 48 insertions, 39 deletions
diff --git a/lib/wx/examples/demo/Makefile b/lib/wx/examples/demo/Makefile index cdd2e1385b..7b5de2253b 100644 --- a/lib/wx/examples/demo/Makefile +++ b/lib/wx/examples/demo/Makefile @@ -1,7 +1,7 @@ # # %CopyrightBegin% # -# Copyright Ericsson AB 2009-2012. All Rights Reserved. +# Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/demo.erl b/lib/wx/examples/demo/demo.erl index ed826dd3f0..99c28b3177 100644 --- a/lib/wx/examples/demo/demo.erl +++ b/lib/wx/examples/demo/demo.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_aui.erl b/lib/wx/examples/demo/ex_aui.erl index 7fbf841d16..d8fc0021f1 100644 --- a/lib/wx/examples/demo/ex_aui.erl +++ b/lib/wx/examples/demo/ex_aui.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_button.erl b/lib/wx/examples/demo/ex_button.erl index bfa7f785c2..a2086b0506 100644 --- a/lib/wx/examples/demo/ex_button.erl +++ b/lib/wx/examples/demo/ex_button.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_canvas.erl b/lib/wx/examples/demo/ex_canvas.erl index cdc783055c..b00ce81993 100644 --- a/lib/wx/examples/demo/ex_canvas.erl +++ b/lib/wx/examples/demo/ex_canvas.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. @@ -136,11 +136,14 @@ handle_event(#wx{event = #wxCommand{type = command_button_clicked}}, {noreply, State}; handle_event(#wx{event = #wxSize{size={W,H}}}, State = #state{bitmap=Prev, canvas=Canvas}) -> - Bitmap = wxBitmap:new(W,H), - draw(Canvas, Bitmap, fun(DC) -> wxDC:clear(DC) end), - wxBitmap:destroy(Prev), - {noreply, State#state{bitmap = Bitmap}}; - + if W > 0 andalso H > 0 -> + Bitmap = wxBitmap:new(W,H), + draw(Canvas, Bitmap, fun(DC) -> wxDC:clear(DC) end), + wxBitmap:destroy(Prev), + {noreply, State#state{bitmap = Bitmap}}; + true -> + {noreply, State} + end; handle_event(#wx{event = #wxMouse{type=left_down, x=X, y=Y}}, State) -> {noreply, State#state{pos={X,Y}}}; handle_event(#wx{event = #wxMouse{type=motion, x=X1, y=Y1}}, @@ -219,4 +222,4 @@ redraw(DC, Bitmap) -> wxMemoryDC:destroy(MemoryDC). get_pos(W,H) -> - {random:uniform(W), random:uniform(H)}. + {rand:uniform(W), rand:uniform(H)}. diff --git a/lib/wx/examples/demo/ex_canvas_paint.erl b/lib/wx/examples/demo/ex_canvas_paint.erl index 90638fcf5b..75eb840b04 100644 --- a/lib/wx/examples/demo/ex_canvas_paint.erl +++ b/lib/wx/examples/demo/ex_canvas_paint.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. @@ -157,10 +157,15 @@ handle_event(#wx{event = #wxMouse{type = motion, x = X, y = Y}}, {noreply, State#state{old_pos = {X,Y}}}; %% Resize event handle_event(#wx{event = #wxSize{size = {W,H}}}, State = #state{bitmap=Prev}) -> - wxBitmap:destroy(Prev), - Bitmap = wxBitmap:new(W,H), - draw(State#state.canvas, Bitmap, fun(DC) -> wxDC:clear(DC) end), - {noreply, State#state{bitmap=Bitmap}}; + case W > 0 andalso H > 0 of + true -> + wxBitmap:destroy(Prev), + Bitmap = wxBitmap:new(W,H), + draw(State#state.canvas, Bitmap, fun(DC) -> wxDC:clear(DC) end), + {noreply, State#state{bitmap=Bitmap}}; + false -> + {noreply, State} + end; handle_event(#wx{event = #wxMouse{type = left_dclick,x = X,y = Y}}, State = #state{}) -> wxPanel:connect(State#state.canvas, motion), {noreply, State#state{old_pos = {X,Y}}}; @@ -235,11 +240,10 @@ draw(Canvas, Bitmap, Fun) -> CDC = wxClientDC:new(Canvas), Fun(MemoryDC), - wxDC:blit(CDC, {0,0}, {wxBitmap:getWidth(Bitmap), wxBitmap:getHeight(Bitmap)}, MemoryDC, {0,0}), - + wxClientDC:destroy(CDC), wxMemoryDC:destroy(MemoryDC). diff --git a/lib/wx/examples/demo/ex_choices.erl b/lib/wx/examples/demo/ex_choices.erl index 31857e45f1..6cba2ffe87 100644 --- a/lib/wx/examples/demo/ex_choices.erl +++ b/lib/wx/examples/demo/ex_choices.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_cursor.erl b/lib/wx/examples/demo/ex_cursor.erl index 207973af96..1b0c71156f 100644 --- a/lib/wx/examples/demo/ex_cursor.erl +++ b/lib/wx/examples/demo/ex_cursor.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_dialogs.erl b/lib/wx/examples/demo/ex_dialogs.erl index 03792b2e8d..1a90812958 100644 --- a/lib/wx/examples/demo/ex_dialogs.erl +++ b/lib/wx/examples/demo/ex_dialogs.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_frame_utils.erl b/lib/wx/examples/demo/ex_frame_utils.erl index 68eda8b6b7..7f5c928617 100644 --- a/lib/wx/examples/demo/ex_frame_utils.erl +++ b/lib/wx/examples/demo/ex_frame_utils.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_gauge.erl b/lib/wx/examples/demo/ex_gauge.erl index 9ee9134be1..6312e3cc0c 100644 --- a/lib/wx/examples/demo/ex_gauge.erl +++ b/lib/wx/examples/demo/ex_gauge.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_gl.erl b/lib/wx/examples/demo/ex_gl.erl index 2693654136..3137b72161 100644 --- a/lib/wx/examples/demo/ex_gl.erl +++ b/lib/wx/examples/demo/ex_gl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_graphicsContext.erl b/lib/wx/examples/demo/ex_graphicsContext.erl index 3cb6f8a139..1193578037 100644 --- a/lib/wx/examples/demo/ex_graphicsContext.erl +++ b/lib/wx/examples/demo/ex_graphicsContext.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. @@ -135,6 +135,8 @@ draw(Win, Pen, Brush, Font) -> wxGraphicsContext:drawPath(Canvas, Path) end, wx:foreach(F, lists:seq(1,10)), + wxGraphicsObject:destroy(Path), + wxGraphicsObject:destroy(Canvas), ok catch _:{not_supported, _} -> Err = "wxGraphicsContext not available in this build of wxwidgets", diff --git a/lib/wx/examples/demo/ex_grid.erl b/lib/wx/examples/demo/ex_grid.erl index c062b7bff5..57bae6ae4d 100644 --- a/lib/wx/examples/demo/ex_grid.erl +++ b/lib/wx/examples/demo/ex_grid.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_htmlWindow.erl b/lib/wx/examples/demo/ex_htmlWindow.erl index d9fa5310ef..5b39fe47fc 100644 --- a/lib/wx/examples/demo/ex_htmlWindow.erl +++ b/lib/wx/examples/demo/ex_htmlWindow.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_listCtrl.erl b/lib/wx/examples/demo/ex_listCtrl.erl index e5eb898f29..598df0d115 100644 --- a/lib/wx/examples/demo/ex_listCtrl.erl +++ b/lib/wx/examples/demo/ex_listCtrl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_notebook.erl b/lib/wx/examples/demo/ex_notebook.erl index 1b6a1a0ee4..5b49e634db 100644 --- a/lib/wx/examples/demo/ex_notebook.erl +++ b/lib/wx/examples/demo/ex_notebook.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_pickers.erl b/lib/wx/examples/demo/ex_pickers.erl index 8c07609f9d..016e70c8c7 100644 --- a/lib/wx/examples/demo/ex_pickers.erl +++ b/lib/wx/examples/demo/ex_pickers.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_popupMenu.erl b/lib/wx/examples/demo/ex_popupMenu.erl index 976c51cd20..c4b025201c 100644 --- a/lib/wx/examples/demo/ex_popupMenu.erl +++ b/lib/wx/examples/demo/ex_popupMenu.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_radioBox.erl b/lib/wx/examples/demo/ex_radioBox.erl index 004bbb5290..893cd70e96 100644 --- a/lib/wx/examples/demo/ex_radioBox.erl +++ b/lib/wx/examples/demo/ex_radioBox.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_sashWindow.erl b/lib/wx/examples/demo/ex_sashWindow.erl index 7d0473ab8f..63528f65d1 100644 --- a/lib/wx/examples/demo/ex_sashWindow.erl +++ b/lib/wx/examples/demo/ex_sashWindow.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_sizers.erl b/lib/wx/examples/demo/ex_sizers.erl index 07dbaa4c65..800f17f014 100644 --- a/lib/wx/examples/demo/ex_sizers.erl +++ b/lib/wx/examples/demo/ex_sizers.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_slider.erl b/lib/wx/examples/demo/ex_slider.erl index 839af56aec..32d48d44e3 100644 --- a/lib/wx/examples/demo/ex_slider.erl +++ b/lib/wx/examples/demo/ex_slider.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_splitterWindow.erl b/lib/wx/examples/demo/ex_splitterWindow.erl index 932027863f..14f63600a3 100644 --- a/lib/wx/examples/demo/ex_splitterWindow.erl +++ b/lib/wx/examples/demo/ex_splitterWindow.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_static.erl b/lib/wx/examples/demo/ex_static.erl index 2f36732aed..c0a6a0b054 100644 --- a/lib/wx/examples/demo/ex_static.erl +++ b/lib/wx/examples/demo/ex_static.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_textCtrl.erl b/lib/wx/examples/demo/ex_textCtrl.erl index 0674b5ef1c..99492259cb 100644 --- a/lib/wx/examples/demo/ex_textCtrl.erl +++ b/lib/wx/examples/demo/ex_textCtrl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2012. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. diff --git a/lib/wx/examples/demo/ex_treeCtrl.erl b/lib/wx/examples/demo/ex_treeCtrl.erl index 4c69c7091c..fc0d9ba117 100644 --- a/lib/wx/examples/demo/ex_treeCtrl.erl +++ b/lib/wx/examples/demo/ex_treeCtrl.erl @@ -1,7 +1,7 @@ %% %% %CopyrightBegin% %% -%% Copyright Ericsson AB 2009-2013. All Rights Reserved. +%% Copyright Ericsson AB 2009-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. |