/// <summary> /// Default constructor. /// </summary> /// <param name="title">Title.</param> public Panel(string title) : base(title) { Style = ComponentStyles.SolidBorder; Layer l = _layers.First.Value; closeButton = new Button ("x"); closeButton.Style = ComponentStyles.Named | ComponentStyles.SolidBorder; closeButton.Width = SystemFonts.CaptionFont.Height - 3; closeButton.Height = SystemFonts.CaptionFont.Height - 3; closeButton.BorderColor = closeButton.BackgroundColor; closeButton.Parent = this; l.Add (closeButton); closeButton._layer = l; MouseMove += closeButton.OnMouseMoved; Button += closeButton.OnButton; closeButton.Click += OnCloseClicked; minimizeButton = new Button ("-"); minimizeButton.Style = ComponentStyles.Named | ComponentStyles.SolidBorder; minimizeButton.Width = SystemFonts.CaptionFont.Height - 3; minimizeButton.Height = SystemFonts.CaptionFont.Height - 3; minimizeButton.BorderColor = minimizeButton.BackgroundColor; minimizeButton.Parent = this; l.Add (minimizeButton); minimizeButton._layer = l; MouseMove += minimizeButton.OnMouseMoved; Button += minimizeButton.OnButton; // minimizeButton.Click += OnCloseClicked; maximizeButton = new Button ("+"); maximizeButton.Style = ComponentStyles.Named | ComponentStyles.SolidBorder; maximizeButton.Width = SystemFonts.CaptionFont.Height - 3; maximizeButton.Height = SystemFonts.CaptionFont.Height - 3; maximizeButton.BorderColor = maximizeButton.BackgroundColor; maximizeButton.Parent = this; l.Add (maximizeButton); maximizeButton._layer = l; MouseMove += maximizeButton.OnMouseMoved; Button += maximizeButton.OnButton; // maximizeButton.Click += OnCloseClicked; }
/// <summary> /// Handles the 'Load' event. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">E.</param> void OnLoad(object sender, System.EventArgs e) { // UNDONE load application stuff ui = new UIManager (Name); // UNDONE load UI from data/xml? // set up connection to OpenTK if (!multithread) { window.UpdateFrame += OnUpdate; window.RenderFrame += OnRender; } window.Resize += ProcessResizeEvent; window.MouseMove += ProcessMouseEvents; window.MouseDown += ProcessMouseEvents; window.MouseUp += ProcessMouseEvents; window.MouseWheel += ProcessMouseEvents; // UNDONE set up keyboard connection // HACK UI set up p = new Panel ("keep me"); p.Width = 600; p.Height = 300; p.X = window.Width / 2 - p.Width / 2; p.Y = window.Height / 2 - p.Height / 2; p.Style |= ComponentStyles.TitledPanel; ui.Add (p); b = new Button (); b.Width = 90; b.Height = 30; b.X = p.Width / 2 - b.Width / 2; b.Y = p.Height / 2 - b.Height / 2; p.Add (b); // DEBUG var rng = new Random (); for (int i = 1; i <= 20; i++) { Panel p = new Panel ("Random-Panel " + i); p.Width = 260; p.Height = 120; p.X = rng.Next (600); p.Y = rng.Next (450); p.Style = ComponentStyles.TitledPanel | ComponentStyles.SolidBorder; ui.Add (p); } // UNDONE set up OpenGL defaults clearColor = Color4.DarkGray; GL.ClearColor (clearColor); GL.Enable (EnableCap.DepthTest); GL.Enable (EnableCap.Texture2D); if (multithread) { // release OpenGL context window.Context.MakeCurrent (null); // start render thread renderThread = new Thread (Loop); renderThread.Name = "Akio Render Thread"; renderThread.IsBackground = true; renderThread.Start (); } }