Exemplo n.º 1
0
        public CstatusWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor)
            : base(OuterSpace.playership.shipName, x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            base.IsModal = false;

            SetSprites();

            //add 9 static lines of text
            controls.Add(new CStaticText("", 10, 22, 94, 15, Color.Blue, ref thisWindow, true, false));
            //X Corrdinate
            controls.Add(new CStaticText("", 10, 37, 94, 15, Color.Blue, ref thisWindow, true, false));
            //Y Corrdinate
            controls.Add(new CStaticText("", 10, 52, 94, 15, Color.Blue, ref thisWindow, true, false));
            //Theta
            controls.Add(new CStaticText("SHEILDS", 10, 72, 64, 15, Color.Blue, ref thisWindow, true, false));
            //Sheilds
            controls.Add(new CStaticText("ARMOR", 10, 102, 64, 15, Color.Blue, ref thisWindow, true, false));
            //Armor
            controls.Add(new CStaticText("DAY", 125, 22, 96, 15, Color.Blue, ref thisWindow, true, false));
            //Day
            controls.Add(new CStaticText("YEAR", 125, 37, 96, 15, Color.Blue, ref thisWindow, true, false));
            //Year
            controls.Add(new CStaticText("WEAPONS", 125, 72, 64, 15, Color.Blue, ref thisWindow, true, false));
            //Weapons
            controls.Add(new CStaticText("CARGO", 125, 102, 64, 15, Color.Blue, ref thisWindow, true, false));
            //Cargo
        }
Exemplo n.º 2
0
        protected void OnRadioBtnClicked(int ctrlindex)
        {
            CCheckbox aControl;
            int       iGroup = -1;

            aControl = (CCheckbox)controls[ctrlindex];
            iGroup   = aControl.GetGroupID();

            for (int i = 0; i < controls.Count; i++)
            {
                CWindow aWindow = (CWindow)controls[i];

                if (i != ctrlindex)
                {
                    if (aWindow.ClassName == "CCheckbox")
                    {
                        CCheckbox aRadioBtn = (CCheckbox)controls[i];
                        if (aRadioBtn.GetGroupID() == iGroup)
                        {
                            aRadioBtn.SetCheck(false);
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
        public CTextBox(string caption, int x, int y, int width, int height,
                        System.Drawing.Color wndcolor, ref CWindow pWnd, bool showWnd,
                        int charlimit)
        {
            IsControl = true;
            Parent    = pWnd;
            IsModal   = false;

            if (width < 64)
            {
                width = 64;
            }
            if (height < 32)
            {
                height = 32;
            }

            // windowRectangle is relative to the parent top, left corner
            Create("CTextbox", caption, x, y, x + width, y + height, wndcolor);

            LoadSprite(2, "textboxbackground.bmp", 48, 48, Color.FromArgb(255, 0, 0, 0).ToArgb());

            lineheight = OuterSpace.textfont.GetTextExtent("X").ToSize().Height;
            maxlines   = Convert.ToInt32((windowRectangle.Height - 10) / lineheight);

            splittext.Initialize();

            Show(showWnd);
        }
Exemplo n.º 4
0
        public CButton(string caption, int x, int y, int width, int height,
                       Color wndcolor, ref CWindow pWnd, bool showWnd)
        {
            IsControl = true;
            Parent    = pWnd;
            IsModal   = false;

            if (width < 64)
            {
                width = 64;
            }
            if (height < 32)
            {
                height = 32;
            }

            // windowRectangle is relative to the parent top, left corner
            Create("CButton", caption, x, y, (x + width), (y + height), wndcolor);

            LoadSprite(2, "buttonleft.bmp", 32, 32, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(3, "buttoncenter.bmp", 32, 32, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(4, "buttonright.bmp", 32, 32, Color.FromArgb(255, 0, 0, 0).ToArgb());

            Show(showWnd);
        }
Exemplo n.º 5
0
        public override bool RunWindow()
        {
            bool bHandled = false;
            int  index    = 1;

            Point aPoint = new Point(OuterSpace.userinput.mousexpos, OuterSpace.userinput.mouseypos);

            bHandled = base.RunWindow();

            if (!bHandled)
            {
                // find the control with focus
                if (this.PtInRect(aPoint))
                {
                    bHandled = true;
                    foreach (object aControl in controls)
                    {
                        CWindow aWindow = null;
                        aWindow = (CWindow)aControl;

                        bHandled = aWindow.HandleInput(index);

                        index += 1;
                        if (bHandled)
                        {
                            break;
                        }
                    }
                }
            }

            return(bHandled);
        }
Exemplo n.º 6
0
        public CStaticText(string caption, int x, int y, int width, int height, 
            Color wndcolor, ref CWindow pWnd, bool showWnd, bool link)
        {
            IsControl = true;
            Parent = pWnd;
            IsModal = false;

            if (link)
            {
                SetAsHyperlink();
            }

            if (width < 64) width = 64;
            if (height < 32) height = 32;

            // windowRectangle is relative to the parent top, left corner
            Create("CStaticText", caption, x, y, (x + width), (y + height), wndcolor);

            lineheight = OuterSpace.textfont.GetTextExtent("X").ToSize().Height;

            maxlines = Convert.ToInt32((windowRectangle.Height - 10) / lineheight);

            splittext.Initialize();

            Show(showWnd);
        }
Exemplo n.º 7
0
        public bool RunWindows2()
        {
            bool bRetHandled = false;
            int  i;

            for (i = (WindowCollection.Count - 1); i >= 0; i--)
            {
                CWindow aWindow = null;
                System.Drawing.Point aPoint;

                aWindow = WindowCollection[i];

                aPoint = new System.Drawing.Point(OuterSpace.userinput.mousexpos, OuterSpace.userinput.mouseypos);
                if (aWindow.PtInRect(aPoint) || OuterSpace.userinput.noKeysPressed() == false)
                {
                    bRetHandled = aWindow.RunWindow();
                }

                if (aWindow.IsModal)
                {
                    bRetHandled = true;
                    break;
                }
            }

            return(bRetHandled);
        }
Exemplo n.º 8
0
        public override void NewMessage(int ctrlIndex, CWindow.WindowMessages message)
        {
            switch (ctrlIndex)
            {
                case 1:
                    //button 1
                    if (iButtonsToDisplay < 3)
                        OnOK();
                    else
                        OnYes();

                    break;
                case 2:
                    //button 2
                    //Cancel or No
                    if (iButtonsToDisplay == 2)
                        OnCancel();
                    else
                        OnNo();

                    break;
                case 3:
                    //icon
                    break;
                //nothing
                case 4:
                    //text
                    break;
                //nothing
            }
        }
Exemplo n.º 9
0
        public CStaticText(string caption, int x, int y, int width, int height,
                           Color wndcolor, ref CWindow pWnd, bool showWnd, bool link)
        {
            IsControl = true;
            Parent    = pWnd;
            IsModal   = false;

            if (link)
            {
                SetAsHyperlink();
            }

            if (width < 64)
            {
                width = 64;
            }
            if (height < 32)
            {
                height = 32;
            }

            // windowRectangle is relative to the parent top, left corner
            Create("CStaticText", caption, x, y, (x + width), (y + height), wndcolor);

            lineheight = OuterSpace.textfont.GetTextExtent("X").ToSize().Height;

            maxlines = Convert.ToInt32((windowRectangle.Height - 10) / lineheight);

            splittext.Initialize();

            Show(showWnd);
        }
Exemplo n.º 10
0
        public CDropdownListBox(int x, int y, int width, int height, Color wndcolor, ref CWindow pWnd,
                                bool showWnd)
        {
            IsControl = true;
            Parent    = pWnd;
            IsModal   = false;

            if (width < 64)
            {
                width = 64;
            }
            if (height < 32)
            {
                height = 32;
            }

            // windowRectangle is relative to the parent top, left corner
            Create("CDropdownListBox", "", x, y, x + width, y + height, wndcolor);

            LoadSprite(2, "textboxbackground.bmp", 48, 48, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(3, "vscrollbar.bmp", 16, 64, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(4, "lbitemselection.bmp", 16, 16, Color.FromArgb(255, 0, 0, 0).ToArgb());

            lineheight = szFont.Height;

            Show(showWnd);
        }
Exemplo n.º 11
0
        public CCheckbox(string caption, int x, int y, int width, int height,
                         System.Drawing.Color wndcolor, ref CWindow pWnd, bool showWnd,
                         bool radio, int group)
        {
            IsControl = true;
            Parent    = pWnd;
            IsModal   = false;
            SetRadioMode(radio);
            SetGroupID(group);

            if (width < 16)
            {
                width = 16;
            }
            if (height < 16)
            {
                height = 16;
            }

            // windowRectangle is relative to the parent top, left corner
            Create("CCheckbox", caption, x, y, (x + width), (y + height), wndcolor);

            LoadSprite(2, "chkbox_unchecked.bmp", 16, 16, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(3, "chkbox_checked.bmp", 16, 16, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(4, "radiobtn_unchecked.bmp", 16, 16, Color.FromArgb(255, 0, 0, 0).ToArgb());
            LoadSprite(5, "radiobtn_checked.bmp", 16, 16, Color.FromArgb(255, 0, 0, 0).ToArgb());

            Show(showWnd);
        }
Exemplo n.º 12
0
 private void ResetWindowIndexes()
 {
     for (int i = 0; i < WindowCollection.Count; i++)
     {
         CWindow aWindow = WindowCollection[i];
         aWindow.WindowIndexInManager = i;
     }
 }
Exemplo n.º 13
0
 public void DrawWindows()
 {
     foreach (object aObject in WindowCollection)
     {
         CWindow aWindow = null;
         aWindow = (CWindow)aObject;
         aWindow.Draw();
     }
 }
Exemplo n.º 14
0
 public void KillFocusForAll()
 {
     foreach (object aObject in WindowCollection)
     {
         CWindow aWindow = null;
         aWindow = (CWindow)aObject;
         aWindow.KillFocus();
     }
 }
Exemplo n.º 15
0
        public CWindow GetWindow(int index)
        {
            CWindow aWindow = null;

            if (index < WindowCollection.Count)
            {
                aWindow = (CWindow)WindowCollection[index];
            }

            return(aWindow);
        }
Exemplo n.º 16
0
        public void DoModal(int index)
        {
            CWindow aWindow = GetWindow(index);

            aWindow.DoModal();

            WindowCollection.RemoveAt(index);
            WindowCollection.Insert(index, aWindow);

            ResetWindowIndexes();
        }
Exemplo n.º 17
0
        public void ShowWindow(int index, bool value)
        {
            CWindow aWindow = GetWindow(index);

            aWindow.Show(value);

            WindowCollection.RemoveAt(index);
            WindowCollection.Insert(index, aWindow);

            ResetWindowIndexes();
        }
Exemplo n.º 18
0
        public CScanWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor)
            : base("Scan Results:", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            IsModal = false;
            SetSprites();

            //add 2 static lines of text
            controls.Add(new CStaticText("Bio:", 10, 22, 50, 15, System.Drawing.Color.Blue, ref thisWindow, true, false)); //X Corrdinate
            controls.Add(new CStaticText("Min:", 10, 37, 50, 15, System.Drawing.Color.Blue, ref thisWindow, true, false)); //Y Corrdinate
        }
Exemplo n.º 19
0
        public CStarportWindow(string caption, int x, int y, int width, int height, Color wndcolor)
            : base(caption, x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            int btnTop        = (OuterSpace.ClientArea.Height / 2) - 196;
            int windowCenterX = windowRectangle.Left + (windowRectangle.Width / 2);

            moveable = false;

            CButton depotButton = new CButton("TRADE DEPOT", windowCenterX - windowRectangle.Left - 87,
                                              btnTop, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton opsButton = new CButton("OPERATIONS", windowCenterX - windowRectangle.Left - 87,
                                            btnTop + 40, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton bankButton = new CButton("BANK", windowCenterX - windowRectangle.Left - 87,
                                             btnTop + 80, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton personnelButton = new CButton("PERSONNEL", windowCenterX - windowRectangle.Left - 87,
                                                  btnTop + 120, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton dockingbayButton = new CButton("DOCKING BAY", windowCenterX - windowRectangle.Left - 87,
                                                   btnTop + 160, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton obsdeckButton = new CButton("OBSERVATION DECK", windowCenterX - windowRectangle.Left - 87,
                                                btnTop + 200, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton barButton = new CButton("BAR", windowCenterX - windowRectangle.Left - 87,
                                            btnTop + 240, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton casinoButton = new CButton("CASINO", windowCenterX - windowRectangle.Left - 87,
                                               btnTop + 280, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow, false);

            CButton orbitButton = new CButton("ORBIT PLANET", windowCenterX - windowRectangle.Left - 87,
                                              btnTop + 320, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow);

            CButton launchButton = new CButton("LAUNCH", windowCenterX - windowRectangle.Left - 87,
                                               btnTop + 360, 175, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow);

            controls.Add(depotButton);
            controls.Add(opsButton);
            controls.Add(bankButton);
            controls.Add(personnelButton);
            controls.Add(dockingbayButton);
            controls.Add(obsdeckButton);
            controls.Add(barButton);
            controls.Add(casinoButton);
            controls.Add(orbitButton);
            controls.Add(launchButton);
        }
Exemplo n.º 20
0
        public override void NewMessage(int ctrlIndex, CWindow.WindowMessages message)
        {
            switch (ctrlIndex)
            {
                case -1:
                    if (message == CWindow.WindowMessages.MessageBoxOK) OnOK();
                    break;
                case 1:
                    //CStaticText (hyperlink)
                    break;
                //nothing
                case 2:
                    //CTextbox
                    break;
                //nothing
                case 3:
                    //CCheckbox
                    break;
                //nothing
                case 4:
                    //CCheckbox (radio mode)
                    if (message == CWindow.WindowMessages.LeftMouseButtonClicked)
                        OnRadioBtnClicked(ctrlIndex);
                    break;
                case 5:
                    //CCheckbox (radio mode)
                    if (message == CWindow.WindowMessages.LeftMouseButtonClicked)
                        OnRadioBtnClicked(ctrlIndex);
                    break;
                case 6:
                    //CListBox
                    break;
                //nothing
                case 7:
                    //CButton
                    if (message == CWindow.WindowMessages.LeftMouseButtonClicked)
                    {
                        CWindow thisWindow = (CWindow)this;
                        CDropdownListBox aListbox = (CDropdownListBox)controls[5];
                        OuterSpace.theWindowMgr.MessageBox("You Selected",
                            aListbox.GetItemText(aListbox.GetNextSelection(1)), 0, 1, -1, ref thisWindow);

                        //OuterSpace.theWindowMgr.MessageBox("Confirm OK", "Are you sure you want to close the PDA? " + _
                        //"If so, click Yes. If not, click No. Now for a bunch of gibberish to fill space and test things.", 0, 3, -1, Me)
                    }

                    break;
            }
        }
Exemplo n.º 21
0
        public CTitleWindow(int x, int y, int width, int height, Color wndcolor)
            : base(" ", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;
            int     btnTop     = 300;

            moveable = false;

            //add New Game button
            //add Load Game button
            //add options button
            //add quit button
            controls.Add(new CButton("NEW GAME", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 75, btnTop, 150, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
            controls.Add(new CButton("LOAD GAME", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 75, btnTop + 40, 150, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
            controls.Add(new CButton("OPTIONS", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 75, btnTop + 80, 150, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
            controls.Add(new CButton("QUIT", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 75, btnTop + 120, 150, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
        }
Exemplo n.º 22
0
        public CPDAWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor)
            : base("Captain's PDA", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            SetSprites();

            //add some static text
            controls.Add(new CStaticText("Static:", 10, 60, 30, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true));

            //add a textbox
            CTextBox aTxtbox = new CTextBox("", 60, 60, 185, 24, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, 30);

            aTxtbox.SetFocus();
            controls.Add(aTxtbox);

            //add a checkbox
            controls.Add(new CCheckbox("Checkbox", 60, 100, 60, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow));

            //add a radio button
            CCheckbox aRadioBtn = new CCheckbox("RB1", 60, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1);

            aRadioBtn.SetCheck(true);
            controls.Add(aRadioBtn);

            //add a radio button
            controls.Add(new CCheckbox("RB2", 130, 120, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1));

            //add a listbox control
            CDropdownListBox aListbox = new CDropdownListBox(60, 150, 185, 100, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true);

            aListbox.AddItem("item 1", 1);
            aListbox.AddItem("item 2", 2);
            aListbox.AddItem("item 3", 3);
            aListbox.AddItem("item 4", 4);
            aListbox.AddItem("item 5", 5);
            aListbox.AddItem("item 6", 6);
            aListbox.AddItem("item 7", 7);
            aListbox.AddItem("item 8", 8);

            controls.Add(aListbox);

            //add a button
            controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 48,
                                     windowRectangle.Height - 75, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
        }
Exemplo n.º 23
0
        public CMsgWindow(int x, int y, int width, int height, System.Drawing.Color wndcolor)
            : base("HAL-9000", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            IsModal = false;

            SetSprites();

            //add 7 static lines of text
            controls.Add(new CStaticText("", 10, 22, 198, 15, System.Drawing.Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 37, 198, 15, System.Drawing.Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 52, 198, 15, System.Drawing.Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 67, 198, 15, System.Drawing.Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 82, 198, 15, System.Drawing.Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 97, 198, 15, System.Drawing.Color.Blue, ref thisWindow, true, false));
        }
Exemplo n.º 24
0
        public int FindWindow(string caption)
        {
            int index = -1;

            for (int i = 0; i < WindowCollection.Count; i++)
            {
                CWindow aWindow = null;
                aWindow = (CWindow)WindowCollection[i];
                if (aWindow.GetWindowText() == caption)
                {
                    index = i;
                    break;
                }
            }

            return(index);
        }
Exemplo n.º 25
0
        public void SetButtons(int buttons)
        {
            // 1 = OK
            // 2 = OK/Cancel
            // 3 = Yes/No
            string strText  = "";
            string strText2 = "";

            if (buttons == 0)
            {
                buttons = 1;
            }
            if (buttons > 3)
            {
                buttons = 3;
            }
            iButtonsToDisplay = buttons;

            switch (buttons)
            {
            case 1:
                strText = "OK";
                break;

            case 2:
                strText  = "OK";
                strText2 = "Cancel";
                break;

            case 3:
                strText  = "Yes";
                strText2 = "No";
                break;
            }

            CWindow thisWindow = (CWindow)this;

            //add first button
            controls.Add(new CButton(strText, 12, windowRectangle.Height - 44, 80, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));

            if (buttons > 1)
            {
                controls.Add(new CButton(strText2, 104, windowRectangle.Height - 44, 80, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
            }
        }
Exemplo n.º 26
0
        public CMessageBoxWindow(string strTitle, string strMessage, int icon, int buttons, int boxid, ref CWindow myparent)
            : base(strTitle, 0, 0, 0, 0, Color.FromArgb(255, 255, 255, 255))
        {
            CWindow thisWindow = (CWindow)this;

            iParentBoxID = boxid;
            Parent       = myparent;

            int textleft;
            int texttop;
            int textwidth;
            int textheight;
            int anIcon = 0;

            if (icon > 0)
            {
                anIcon = 1;
            }

            strMessageText    = strMessage;
            iIconToDisplay    = icon;
            iButtonsToDisplay = buttons;

            SetMsgBoxRect();

            SetSprites();

            SetButtons(buttons);

            SetIcon(icon);

            //add static text for message
            textleft = 12 + (anIcon * 32) + (anIcon * 12);
            //12 pixel spacer + icon and spacer
            texttop = 44;
            //32 pixel caption + 12 pixel spacer
            textwidth = windowRectangle.Width - 24 - (anIcon * 32) - (anIcon * 12);
            //2, 12 pixel spacers + icon and spacer
            textheight = windowRectangle.Height - 100;
            //32 pixel caption + 3, 12 pixel spacers, + 32 pixel button

            controls.Add(new CStaticText(strMessage, textleft, texttop, textwidth, textheight, Color.FromArgb(255, 255, 255, 255), ref thisWindow));

            this.Show(true);
        }
Exemplo n.º 27
0
        public CButton(string caption, int x, int y, int width, int height, 
            Color wndcolor, ref CWindow pWnd, bool showWnd)
        {
            IsControl = true;
            Parent = pWnd;
            IsModal = false;

            if (width < 64) width = 64;
            if (height < 32) height = 32;

            // windowRectangle is relative to the parent top, left corner
            Create("CButton", caption, x, y, (x + width), (y + height), wndcolor);

            LoadSprite(2, "buttonleft.bmp", 32, 32, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(3, "buttoncenter.bmp", 32, 32, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(4, "buttonright.bmp", 32, 32, Color.FromArgb(255,0,0,0).ToArgb());

            Show(showWnd);
        }
Exemplo n.º 28
0
        public CAnalysisWindow(int x, int y, int width, int height, Color wndcolor)
            : base("Scan Analysis:", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            IsModal = false;

            SetSprites();

            //add 2 static lines of text
            controls.Add(new CStaticText("Atmosphere:", 10, 22, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 37, 128, 15, Color.Green, ref thisWindow, true, false));
            //Atmosphere #1
            controls.Add(new CStaticText("", 10, 52, 128, 15, Color.Green, ref thisWindow, true, false));
            //#2
            controls.Add(new CStaticText("", 10, 67, 128, 15, Color.Green, ref thisWindow, true, false));
            //#3
            controls.Add(new CStaticText("Hydrosphere:", 10, 82, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 97, 128, 15, Color.Green, ref thisWindow, true, false));
            //Hydrosphere #1
            controls.Add(new CStaticText("", 10, 112, 128, 15, Color.Green, ref thisWindow, true, false));
            //#2
            controls.Add(new CStaticText("", 10, 127, 128, 15, Color.Green, ref thisWindow, true, false));
            //#3
            controls.Add(new CStaticText("Lithosphere:", 10, 142, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 10, 157, 128, 15, Color.Green, ref thisWindow, true, false));
            //Lithosphere #1
            controls.Add(new CStaticText("", 10, 172, 128, 15, Color.Green, ref thisWindow, true, false));
            //#2
            controls.Add(new CStaticText("", 10, 187, 128, 15, Color.Green, ref thisWindow, true, false));
            //#3
            controls.Add(new CStaticText("Climate:", 10, 202, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 65, 202, 128, 15, Color.Green, ref thisWindow, true, false));
            // Climate value
            controls.Add(new CStaticText("Mass:", 10, 217, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 65, 217, 128, 15, Color.Green, ref thisWindow, true, false));
            controls.Add(new CStaticText("Weather:", 10, 232, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 65, 232, 128, 15, Color.Green, ref thisWindow, true, false));
            // Climate value
            controls.Add(new CStaticText("Gravity:", 10, 247, 128, 15, Color.Blue, ref thisWindow, true, false));
            controls.Add(new CStaticText("", 65, 247, 128, 15, Color.Green, ref thisWindow, true, false));
        }
Exemplo n.º 29
0
        public CListBox(int x, int y, int width, int height, Color wndcolor, ref CWindow pWnd, bool showWnd)
        {
            IsControl = true;
            Parent = pWnd;
            IsModal = false;

            if (width < 64) width = 64;
            if (height < 32) height = 32;

            // windowRectangle is relative to the parent top, left corner
            Create("CListBox", "", x, y, x + width, y + height, wndcolor);

            LoadSprite(2, "textboxbackground.bmp", 48, 48, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(3, "vscrollbar.bmp", 16, 64, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(4, "lbitemselection.bmp", 16, 16, Color.FromArgb(255,0,0,0).ToArgb());

            lineheight = szFont.Height;

            Show(showWnd);
        }
Exemplo n.º 30
0
        public CMessageBoxWindow(string strTitle, string strMessage, int icon, int buttons, int boxid, ref CWindow myparent)
            : base(strTitle, 0, 0, 0, 0, Color.FromArgb(255, 255, 255, 255))
        {
            CWindow thisWindow = (CWindow)this;
            iParentBoxID = boxid;
            Parent = myparent;

            int textleft;
            int texttop;
            int textwidth;
            int textheight;
            int anIcon = 0;

            if (icon > 0) anIcon = 1;

            strMessageText = strMessage;
            iIconToDisplay = icon;
            iButtonsToDisplay = buttons;

            SetMsgBoxRect();

            SetSprites();

            SetButtons(buttons);

            SetIcon(icon);

            //add static text for message
            textleft = 12 + (anIcon * 32) + (anIcon * 12);
            //12 pixel spacer + icon and spacer
            texttop = 44;
            //32 pixel caption + 12 pixel spacer
            textwidth = windowRectangle.Width - 24 - (anIcon * 32) - (anIcon * 12);
            //2, 12 pixel spacers + icon and spacer
            textheight = windowRectangle.Height - 100;
            //32 pixel caption + 3, 12 pixel spacers, + 32 pixel button

            controls.Add(new CStaticText(strMessage, textleft, texttop, textwidth, textheight, Color.FromArgb(255, 255, 255, 255), ref thisWindow));

            this.Show(true);
        }
Exemplo n.º 31
0
        public COptionsWindow(int x, int y, int width, int height, Color wndcolor)
            : base("Game Options", x, y, width, height, wndcolor)
        {
            CWindow thisWindow = (CWindow)this;

            SetSprites();

            //add static text for screen res
            controls.Add(new CStaticText("Screen Resolution:", 10, 60, 150, 26, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, false));

            //add two radio buttons for screen res
            controls.Add(new CCheckbox("800 x 600", 30, 90, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1));

            CCheckbox resRadioBtn2 = new CCheckbox("1024 x 768", 130, 90, 40, 16, Color.FromArgb(225, 255, 255, 255), ref thisWindow, true, true, 1);

            resRadioBtn2.SetCheck(true);
            controls.Add(resRadioBtn2);

            //add New Game button
            //add Load Game button
            controls.Add(new CButton("OK", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left - 100, windowRectangle.Bottom - windowRectangle.Top - 40, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
            controls.Add(new CButton("Cancel", (windowRectangle.Left + windowRectangle.Width / 2) - windowRectangle.Left + 4, windowRectangle.Bottom - windowRectangle.Top - 40, 96, 32, Color.FromArgb(225, 255, 255, 255), ref thisWindow));
        }
Exemplo n.º 32
0
        public CTextBox(string caption, int x, int y, int width, int height,
            System.Drawing.Color wndcolor, ref CWindow pWnd, bool showWnd,
            int charlimit)
        {
            IsControl = true;
            Parent = pWnd;
            IsModal = false;

            if (width < 64) width = 64;
            if (height < 32) height = 32;

            // windowRectangle is relative to the parent top, left corner
            Create("CTextbox", caption, x, y, x + width, y + height, wndcolor);

            LoadSprite(2, "textboxbackground.bmp", 48, 48, Color.FromArgb(255,0,0,0).ToArgb());

            lineheight = OuterSpace.textfont.GetTextExtent("X").ToSize().Height;
            maxlines = Convert.ToInt32((windowRectangle.Height - 10) / lineheight);

            splittext.Initialize();

            Show(showWnd);
        }
Exemplo n.º 33
0
        public CCheckbox(string caption, int x, int y, int width, int height, 
            System.Drawing.Color wndcolor, ref CWindow pWnd, bool showWnd, 
            bool radio, int group)
        {
            IsControl = true;
            Parent = pWnd;
            IsModal = false;
            SetRadioMode(radio);
            SetGroupID(group);

            if (width < 16) width = 16;
            if (height < 16) height = 16;

            // windowRectangle is relative to the parent top, left corner
            Create("CCheckbox", caption, x, y, (x + width), (y + height), wndcolor);

            LoadSprite(2, "chkbox_unchecked.bmp", 16, 16, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(3, "chkbox_checked.bmp", 16, 16, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(4, "radiobtn_unchecked.bmp", 16, 16, Color.FromArgb(255,0,0,0).ToArgb());
            LoadSprite(5, "radiobtn_checked.bmp", 16, 16, Color.FromArgb(255,0,0,0).ToArgb());

            Show(showWnd);
        }
Exemplo n.º 34
0
 public CDropdownListBox(int x, int y, int width, int height, Color wndcolor, ref CWindow pWnd)
     : this(x, y, width, height, wndcolor, ref pWnd, true)
 {
 }
Exemplo n.º 35
0
 public CStaticText(string caption, int x, int y, int width, int height,
     Color wndcolor, ref CWindow pWnd, bool showWnd)
     : this(caption, x, y, width, height, wndcolor, ref pWnd, showWnd, false)
 {
 }
Exemplo n.º 36
0
        public override void NewMessage(int ctrlIndex, CWindow.WindowMessages message)
        {
            switch (ctrlIndex)
            {
                case NEWGAMEBTN:
                    //new game
                    if (message == WindowMessages.LeftMouseButtonClicked)
                    {
                        OuterSpace.MainTitle.SetState(1);
                        OuterSpace.theGameState.AddState(OuterSpace.GameStates.Interstellar);
                        Close();
                    }

                    break;
                case LOADGAMEBTN:
                    //load game
                    break;
                case OPTIONSBTN:
                    //options
                    if (OuterSpace.theWindowMgr.FindWindow("Game Options") == -1)
                    {
                        if (OuterSpace.theWindowMgr.LoadWindow("COptionsWindow", OuterSpace.ClientArea.Center.X - 256, OuterSpace.ClientArea.Center.Y - 256, 512, 512, Color.FromArgb(225, 255, 255, 255)) == true)
                        {
                            OuterSpace.theWindowMgr.DoModal(OuterSpace.theWindowMgr.FindWindow("Game Options"));
                        }
                    }

                    break;
                case QUITBTN:
                    //quit
                    if (message == WindowMessages.LeftMouseButtonClicked)
                    {
                        OuterSpace.MainTitle.SetState(-1);
                        Close();
                    }

                    break;
            }
        }
Exemplo n.º 37
0
        public override void NewMessage(int ctrlIndex, CWindow.WindowMessages message)
        {
            switch (ctrlIndex)
            {
                case RADBTN800:
                    //CCheckbox (radio mode)
                    if (message == WindowMessages.LeftMouseButtonClicked)
                        OnRadioBtnClicked(ctrlIndex);

                    break;
                case RADBTN1024:
                    //CCheckbox (radio mode)
                    if (message == WindowMessages.LeftMouseButtonClicked)
                        OnRadioBtnClicked(ctrlIndex);

                    break;
                case OKBTN:
                    //ok button
                    if (message == WindowMessages.LeftMouseButtonClicked)
                    {
                        OnOK();
                    }

                    break;
                case CANCELBTN:
                    //cancel button
                    if (message == WindowMessages.LeftMouseButtonClicked)
                    {
                        Close();
                    }

                    break;
            }
        }
Exemplo n.º 38
0
 public CCheckbox(string caption, int x, int y, int width, int height, 
     System.Drawing.Color wndcolor, ref CWindow pWnd, bool showWnd, 
     bool radio)
     : this(caption, x, y, width, height, wndcolor, ref pWnd, showWnd, radio, -1)
 {
 }
Exemplo n.º 39
0
 public CListBox(int x, int y, int width, int height, Color wndcolor, ref CWindow pWnd)
     : this(x, y, width, height, wndcolor, ref pWnd, true)
 {
 }
Exemplo n.º 40
0
 public override void NewMessage(int ctrlIndex, CWindow.WindowMessages message)
 {
     switch (ctrlIndex)
     {
         case (int)StarportButtons.TradeDepot:
         case (int)StarportButtons.Operations:
         case (int)StarportButtons.Bank:
         case (int)StarportButtons.Personnel:
         case (int)StarportButtons.DockingBay:
         case (int)StarportButtons.ObservationDeck:
         case (int)StarportButtons.Bar:
         case (int)StarportButtons.Casino:
         case (int)StarportButtons.OrbitPlanet:
             if (message == WindowMessages.LeftMouseButtonClicked)
             {
                 OuterSpace.theGameState.RemoveState(OuterSpace.GameStates.DockedAtStation);
                 OuterSpace.theGameState.AddState(OuterSpace.GameStates.Orbiting);
                 Close();
             }
             break;
         case (int)StarportButtons.Launch:
             if (message == WindowMessages.LeftMouseButtonClicked)
             {
                 OuterSpace.theGameState.RemoveState(OuterSpace.GameStates.DockedAtStation);
                 OuterSpace.theGameState.AddState(OuterSpace.GameStates.InSystem);
                 Close();
             }
             break;
     }
 }
Exemplo n.º 41
0
        public bool LoadWindow(string wndType, int x, int y, int width, int height, Color wndcolor, define_sprite_struct[] spritedefs)
        {
            CWindow aWindow = null;
            bool    bRetVal = false;

            switch (wndType)
            {
            case "CPDAWindow":
                aWindow = new CPDAWindow(x, y, width, height, wndcolor);
                break;

            case "CTitleWindow":
                aWindow = new CTitleWindow(x, y, width, height, wndcolor);
                break;

            case "COptionsWindow":
                aWindow = new COptionsWindow(x, y, width, height, wndcolor);
                break;

            case "CmsgWindow":
                aWindow = new CMsgWindow(x, y, width, height, wndcolor);
                break;

            case "CstatusWindow":
                aWindow = new CstatusWindow(x, y, width, height, wndcolor);
                break;

            case "CStarportWindow":
                aWindow = new CStarportWindow(x, y, width, height, wndcolor);
                break;

            case "CScanWindow":
                aWindow = new CScanWindow(x, y, width, height, wndcolor);
                break;

            case "CAnalysisWindow":
                aWindow = new CAnalysisWindow(x, y, width, height, wndcolor);
                break;

            case "CMenuWindow":
                aWindow = new CMenuWindow(x, y, width, height, wndcolor);
                break;
            }

            if (spritedefs != null)
            {
                for (int i = 0; i < (spritedefs.GetUpperBound(0) + 1); i++)
                {
                    aWindow.LoadSprite(spritedefs[i].number, spritedefs[i].file, spritedefs[i].width,
                                       spritedefs[i].height, spritedefs[i].Colorkey);
                }
            }

            if (aWindow != null)
            {
                AddWindow(aWindow);
                bRetVal = true;
            }

            return(bRetVal);
        }
Exemplo n.º 42
0
 public void AddWindow(CWindow value)
 {
     WindowCollection.Add(value);
     ResetWindowIndexes();
 }
Exemplo n.º 43
0
        public void MessageBox(string caption, string text, int icon, int buttons, int parentboxid, ref CWindow parent)
        {
            CMessageBoxWindow aMsgBox = new CMessageBoxWindow(caption, text, icon, buttons, parentboxid, ref parent);

            aMsgBox.DoModal();
            WindowCollection.Add(aMsgBox);

            ResetWindowIndexes();
        }
Exemplo n.º 44
0
 public CButton(string caption, int x, int y, int width, int height, Color wndcolor, ref CWindow pWnd)
     : this(caption, x, y, width, height, wndcolor, ref pWnd, true)
 {
 }
Exemplo n.º 45
0
 public void AddWindow(CWindow value)
 {
     WindowCollection.Add(value);
     ResetWindowIndexes();
 }
Exemplo n.º 46
0
 public CButton(string caption, int x, int y, int width, int height, Color wndcolor, ref CWindow pWnd)
     : this(caption, x, y, width, height, wndcolor, ref pWnd, true)
 {
 }
Exemplo n.º 47
0
        public void MessageBox(string caption, string text, int icon, int buttons, int parentboxid, ref CWindow parent)
        {
            CMessageBoxWindow aMsgBox = new CMessageBoxWindow(caption, text, icon, buttons, parentboxid, ref parent);

            aMsgBox.DoModal();
            WindowCollection.Add(aMsgBox);

            ResetWindowIndexes();
        }
Exemplo n.º 48
0
 public CCheckbox(string caption, int x, int y, int width, int height, 
     System.Drawing.Color wndcolor, ref CWindow pWnd)
     : this(caption, x, y, width, height, wndcolor, ref pWnd, true, false, -1)
 {
 }