/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="onClick"></param> /// <param name="left"></param> /// <param name="top"></param> /// <param name="right"></param> /// <param name="bottom"></param> public Button(string text, _Click onClick, int left = -1, int top = -1, int right = -1, int bottom = -1) { Font font = new Font("Segoe UI", 11); Size textSize = System.Windows.Forms.TextRenderer.MeasureText(text, font); _tile = new Rectangle(left, top, textSize.Width + 4, textSize.Height + 4); font.Dispose(); if ((left > -1) && (right > -1)) { _tile.Width = right - left; } ; if ((left < 0) && (right > -1)) { _tile.X = right - _tile.Width; } ; if ((top > -1) && (bottom > -1)) { _tile.Height = bottom - top; } ; if ((top < 0) && (bottom > -1)) { _tile.Y = bottom - _tile.Height; } ; _label = text; Click += onClick; }
internal static _Click Click() { if (_ClickFunc == null) { _ClickFunc = (_Click)Marshal.GetDelegateForFunctionPointer( Torque3D.DllLoadUtils.GetProcAddress( Torque3D.Torque3DLibHandle, "cbGuiFadeinBitmapCtrl_click"), typeof(_Click)); } return(_ClickFunc); }
internal static _Click Click() { if (_ClickFunc == null) { _ClickFunc = (_Click)Marshal.GetDelegateForFunctionPointer( NativeLibrary.GetExport( Torque3D.Torque3DLibHandle, "cbGuiFadeinBitmapCtrl_click"), typeof(_Click)); } return(_ClickFunc); }
public Dispatcher(MainWindow opener) { // References to Frontend and Backend objects _opener = opener; _input = new Input(this); _timer = new EventLoop(this); _output = new Draw(this); _toolbox = new Toolbox(this, "images/terrain_atlas.png", new System.Drawing.Rectangle(_opener.ClientRectangle.Width - 325, 60, 320, _opener.ClientRectangle.Height - 130)); _map = new Backend.Map(this, "start"); if (_map.Width < 1) { _map = new Backend.Map(this, 10, 10, false); } _attachedImagePos = new System.Drawing.Rectangle(); // Hook up Delegates Refresh += _output.Refresh; Move += _input.Move; Click += _input.Click; Keyboard += _input.Keyboard; Repaint(); // Generate lists for interaction objects _buttons = new List <Crawler.Frontend.Button>(); _mapview = new MapTiles(this); _buttons.Add(new Frontend.Button("Map-Level", ToggleMap, 120, -1, -1, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("Quit", Quit, -1, 5, _opener.ClientRectangle.Width - 5, -1)); // _buttons.Add(new Frontend.Button("Edit", Edit, -1, 5, _opener.ClientRectangle.Width - 64, -1)); _buttons.Add(new Frontend.Button("Save", Save, -1, 5, _opener.ClientRectangle.Width - 114, -1)); // _buttons.Add(new Frontend.Button("File", File, -1, 5, _opener.ClientRectangle.Width - 177, -1)); _buttons.Add(new Frontend.Button("+", ZoomPageIn, -1, -1, _opener.ClientRectangle.Width - 130, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("-", ZoomPageOut, -1, -1, _opener.ClientRectangle.Width - 105, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("+", ZoomMapIn, 55, -1, -1, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("-", ZoomMapOut, 29, -1, -1, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("<", PrevPage, -1, -1, _opener.ClientRectangle.Width - 50, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button(">", NextPage, -1, -1, _opener.ClientRectangle.Width - 17, _opener.ClientRectangle.Height - 28)); }
public Dispatcher(MainWindow opener) { // References to Frontend and Backend objects _opener = opener; _input = new Input(this); _timer = new EventLoop(this); _output = new Draw(this); _toolbox = new Toolbox(this, "images/terrain_atlas.png", new System.Drawing.Rectangle(_opener.ClientRectangle.Width - 325, 60, 320, _opener.ClientRectangle.Height - 130)); _map = new Backend.Map(this, "start"); if (_map.Width < 1) { _map = new Backend.Map(this, 10, 10, false); } _attachedImagePos = new System.Drawing.Rectangle(); // Hook up Delegates Refresh += _output.Refresh; Move += _input.Move; Click += _input.Click; Keyboard += _input.Keyboard; Repaint(); // Generate lists for interaction objects _buttons = new List<Crawler.Frontend.Button>(); _mapview = new MapTiles(this); _buttons.Add(new Frontend.Button("Map-Level", ToggleMap, 120, -1, -1, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("Quit", Quit, -1, 5, _opener.ClientRectangle.Width - 5, -1)); // _buttons.Add(new Frontend.Button("Edit", Edit, -1, 5, _opener.ClientRectangle.Width - 64, -1)); _buttons.Add(new Frontend.Button("Save", Save, -1, 5, _opener.ClientRectangle.Width - 114, -1)); // _buttons.Add(new Frontend.Button("File", File, -1, 5, _opener.ClientRectangle.Width - 177, -1)); _buttons.Add(new Frontend.Button("+", ZoomPageIn, -1, -1, _opener.ClientRectangle.Width - 130, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("-", ZoomPageOut, -1, -1, _opener.ClientRectangle.Width - 105, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("+", ZoomMapIn, 55, -1, -1, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("-", ZoomMapOut, 29, -1, -1, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button("<", PrevPage, -1, -1, _opener.ClientRectangle.Width - 50, _opener.ClientRectangle.Height - 28)); _buttons.Add(new Frontend.Button(">", NextPage, -1, -1, _opener.ClientRectangle.Width - 17, _opener.ClientRectangle.Height - 28)); }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="onClick"></param> /// <param name="left"></param> /// <param name="top"></param> /// <param name="right"></param> /// <param name="bottom"></param> public Button(string text, _Click onClick, int left = -1, int top = -1, int right = -1, int bottom = -1) { Font font = new Font("Segoe UI", 11); Size textSize = System.Windows.Forms.TextRenderer.MeasureText(text, font); _tile = new Rectangle(left, top, textSize.Width + 4, textSize.Height + 4); font.Dispose(); if ((left > -1) && (right > -1)) { _tile.Width = right - left; }; if ((left < 0) && (right > -1)) { _tile.X = right - _tile.Width; }; if ((top > -1) && (bottom > -1)) { _tile.Height = bottom - top; }; if ((top < 0) && (bottom > -1)) { _tile.Y = bottom - _tile.Height; }; _label = text; Click += onClick; }