-module(eSample130_1).
-export([start/0]).
%%-export([new/2]). %% API
-include_lib("wx.hrl").
start()->
Wx = wx:new(),
Dialog = wx:batch(fun()->new(Wx, 100) end),
loop(Dialog).
new(Parent,Id)->
Option = [ { size, {210, 100} } ],
Head = "Target Display",
Dialog = wxDialog:new(Parent, Id, Head, Option),
%OPP = [{size,{100,50}}],
%Panel = wxPanel:new(Parent,OPP),
Str = "Push close Button.",
OPST1 = [{pos, {50,10}}],
ST = wxStaticText:new( Dialog, 1 , Str, OPST1),
%ST = wxStaticText:new( Panel, 1 , Str, OPST1),
wxDialog:connect(Dialog, close_window),
%wxStaticText:connect(ST, left_down),
wxDialog:connect(Dialog, left_down),
wxDialog:connect(Dialog, left_up),
wxDialog:connect(Dialog, middle_down),
wxDialog:connect(Dialog, middle_up),
wxDialog:connect(Dialog, right_down),
wxDialog:connect(Dialog, right_up),
wxDialog:connect(Dialog, motion),
wxDialog:connect(Dialog, enter_window),
wxDialog:connect(Dialog, leave_window),
wxDialog:connect(Dialog, left_dclick),
wxDialog:connect(Dialog, middle_dclick),
wxDialog:connect(Dialog, right_dclick),
wxDialog:connect(Dialog, mousewheel),
wxDialog:connect(Dialog, nc_left_down),
wxDialog:connect(Dialog, nc_left_up),
wxDialog:connect(Dialog, nc_middle_down),
wxDialog:connect(Dialog, nc_middle_up),
wxDialog:connect(Dialog, nc_right_down),
wxDialog:connect(Dialog, nc_right_up),
wxDialog:connect(Dialog, nc_motion),
wxDialog:connect(Dialog, nc_enter_window),
wxDialog:connect(Dialog, nc_leave_window),
wxDialog:connect(Dialog, nc_left_dclick),
wxDialog:connect(Dialog, nc_middle_dclick),
wxDialog:connect(Dialog, nc_right_dclick),
Dialog.
%% 閉じるボタン押下時の動作
loop(Dialog)->
receive
%% closeボタン押下時
#wx{event = #wxClose{ type = close_window }}->
wxDialog:show(Dialog, [{show, false}]),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = left_down}}->
wxDialog:setLabel(Obj, "left_down!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = left_up}}->
wxDialog:setLabel(Obj, "left_up!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = middle_down}}->
wxDialog:setLabel(Obj, "middle_down!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = middle_up}}->
wxDialog:setLabel(Obj, "middle_up!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = right_down}}->
wxDialog:setLabel(Obj, "right_down!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = right_up}}->
wxDialog:setLabel(Obj, "right_up!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = motion}}->
wxDialog:setLabel(Obj, "motion!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = enter_window}}->
wxDialog:setLabel(Obj, "enter_window!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = leave_window}}->
wxDialog:setLabel(Obj, "leave_window!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = left_dclick}}->
wxDialog:setLabel(Obj, "left_dclick!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = middle_dclick}}->
wxDialog:setLabel(Obj, "middle_dclick!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = right_dclick}}->
wxDialog:setLabel(Obj, "right_dclick!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = mousewheel}}->
wxDialog:setLabel(Obj, "mousewheel!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_left_down}}->
wxDialog:setLabel(Obj, "nc_left_down!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_left_up}}->
wxDialog:setLabel(Obj, "nc_left_up!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_middle_down}}->
wxDialog:setLabel(Obj, "nc_middle_down!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_middle_up}}->
wxDialog:setLabel(Obj, "nc_middle_up!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_right_down}}->
wxDialog:setLabel(Obj, "nc_right_down!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_right_up}}->
wxDialog:setLabel(Obj, "nc_right_up!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_motion}}->
wxDialog:setLabel(Obj, "nc_motion!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_enter_window}}->
wxDialog:setLabel(Obj, "nc_enter_window!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_leave_window}}->
wxDialog:setLabel(Obj, "nc_leave_window!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_left_dclick}}->
wxDialog:setLabel(Obj, "nc_left_dclick!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_middle_dclick}}->
wxDialog:setLabel(Obj, "nc_middle_dclick!"),
loop(Dialog);
#wx{obj = Obj, event = #wxMouse{ type = nc_right_dclick}}->
wxDialog:setLabel(Obj, "nc_right_dclick!"),
loop(Dialog);
%% 他ウィンドウのボタンが押下された時
{visible, _From} ->
%% Dialogを表示する
wxDialog:show(Dialog, [{show, true}]),
_From ! {reply, ok},
loop(Dialog)
end.