public wifInnerFrame(wx.Window _parent, int _id, string _title, Point _pos, Size _size, uint _style) : base(_parent, _id, _pos, _size, wx.Panel.wxRAISED_BORDER | wx.Panel.wxFULL_REPAINT_ON_RESIZE) { wintitle = _title; style = _style; m_sizing = mSizing.NONE; m_resizeBorder = 10; // title_bar = new wifInnerTitleBar(this, -1, _title, new Point(0, 0), new Size(this.Width, 20), _style); // frame_content = new wifInnerFrameContent(this, -1, new Point(0, 0), wx.Panel.wxDefaultSize); frame_content = new wx.Panel(this, -1, new Point(0, 0), wx.Panel.wxDefaultSize, 0); // wx.BoxSizer sizer = new wx.BoxSizer(wx.Orientation.wxVERTICAL); sizer.Add(title_bar, 0, wx.Stretch.wxGROW | wx.Direction.wxRIGHT, 2); wx.BoxSizer horiSizer = new wx.BoxSizer(wx.Orientation.wxHORIZONTAL); horiSizer.Add(frame_content, 1, wx.Stretch.wxGROW); sizer.Add(horiSizer, 1, wx.Stretch.wxGROW | wx.Direction.wxBOTTOM | wx.Direction.wxRIGHT, 2); SetSizer(sizer); this.AutoLayout = true; Layout(); m_minSize = title_bar.MinSize; m_minSize.Width += 8; m_minSize.Height += 10; m_baseMinSize = m_minSize; this.EVT_MOTION(new wx.EventListener(OnMouseMotion)); this.EVT_LEFT_DOWN(new wx.EventListener(OnLeftDown)); this.EVT_LEFT_UP(new wx.EventListener(OnLeftUp)); this.EVT_UPDATE_UI(this.ID, new wx.EventListener(OnUpdateUI)); }
// public wiwFrame(wx.Window _parent, string _title, Point _pos, Size _size, uint _style) : // base(_parent, wx.Panel.wxID_ANY, new Point(5, 5), new Size(300, 300), wx.Panel.wxRAISED_BORDER | wx.Panel.wxFULL_REPAINT_ON_RESIZE) public wiwFrame(wx.Window _parent) : base(_parent, -1, new Point(5, 5), new Size(300, 300), wx.Panel.wxRAISED_BORDER | wx.Panel.wxFULL_REPAINT_ON_RESIZE) { m_sizing = mSizing.NONE; m_resizeBorder = 12; _real_pos = new Point(0, 0); _real_size = new Size(300, 300); // this.AutoLayout = true; // Layout(); this.EVT_MOTION(new wx.EventListener(OnMouseMotion)); this.EVT_LEFT_DOWN(new wx.EventListener(OnLeftDown)); this.EVT_LEFT_UP(new wx.EventListener(OnLeftUp)); this.EVT_PAINT(new wx.EventListener(OnPaint)); this.EVT_SIZE(new wx.EventListener(OnSize)); _props = new wdbFrameProps(); _frame_cur_index++; string temp_name = "Frame" + _frame_cur_index.ToString(); SetDefaultProps(temp_name); SetWidgetProps(); InitPyClassFile(); LoadXmlActions(); }
protected void OnLeftUp(object sender, wx.Event e) { if ( m_sizing != mSizing.NONE ) { m_sizing = mSizing.NONE; ReleaseMouse(); Graphics dc = Graphics.FromHwnd((IntPtr)m_parent_hwnd); dc.Clear(m_parent_back); SetSize(0, 0, m_curX, m_curY); title_bar.SetSize(0, 0, m_curX - 8, 20); /* if (m_inner_frame_resized != null) { wx.CommandEvent _event = new wx.CommandEvent(wxEVT_INNER_FRAME_RESIZED, this.ID); this.EventHandler.ProcessEvent(_event); } */ /* wxCommandEvent event( wxEVT_INNER_FRAME_RESIZED, GetId() ); event.SetEventObject( this ); GetEventHandler()->ProcessEvent( event ); */ m_curX = m_curY = -1; } }
protected void OnLeftDown(object sender, wx.Event evt) { wx.MouseEvent e = (wx.MouseEvent)evt; if ( m_sizing == mSizing.NONE ) { if (e.Position.X >= this.Size.Width - m_resizeBorder && e.Position.Y >= this.Size.Height - m_resizeBorder) { m_sizing = mSizing.RIGHTBOTTOM; } else if (e.Position.X >= this.Size.Width - m_resizeBorder) { m_sizing = mSizing.RIGHT; } else if (e.Position.Y >= this.Size.Height - m_resizeBorder) { m_sizing = mSizing.BOTTOM; } if ( m_sizing != mSizing.NONE ) { m_difX = this.Size.Width - e.Position.X; m_difY = this.Size.Height - e.Position.Y; CaptureMouse(); OnMouseMotion(this, evt); } } }
protected void OnLeftUp(object sender, wx.Event e) { if ( m_sizing != mSizing.NONE ) { m_sizing = mSizing.NONE; ReleaseMouse(); Panel pan = Common.Instance().Canvas; Graphics dc = pan.CreateGraphics(); dc.Clear(pan.BackColor); SetSize(5, 5, m_curX, m_curY); // Check _props.EnableNotification = false; Size diff = new Size(m_curX, m_curY); _props.Size += diff; _props.EnableNotification = true; // Check m_curX = m_curY = -1; } }
public wifSimpleFrame(wx.Window _parent, int _id, string _title, Point _pos, Size _size, uint _style) : base(_parent, _id, _pos, _size, wx.Panel.wxRAISED_BORDER | wx.Panel.wxFULL_REPAINT_ON_RESIZE) { m_wintitle = _title; m_style = _style; m_sizing = mSizing.NONE; m_resizeBorder = 10; this.AutoLayout = true; Layout(); m_minSize = new Size(100, 30); // !!! // SetBufferSize(_parent.Width, _parent.Height); // !!! this.EVT_MOTION(new wx.EventListener(OnMouseMotion)); this.EVT_LEFT_DOWN(new wx.EventListener(OnLeftDown)); this.EVT_LEFT_UP(new wx.EventListener(OnLeftUp)); this.EVT_PAINT(new wx.EventListener(OnPaint)); this.EVT_SIZE(new wx.EventListener(OnSize)); }