Example #1
0
        private void getPictureInGrid(DataGridViewCellEventArgs e, DataGridView senderGrid)
        {
            if (senderGrid.Columns[e.ColumnIndex] is DataGridViewButtonColumn &&
                e.RowIndex >= 0)
            {
                var d = dtgv_DocsN2.CurrentRow;

                if (d == null)
                {
                    throw new Exception("Selecione um registro!");
                }

                string PAS_REGISTRO            = (string)d.Cells["PAS_REGISTRO"].Value;
                string DOC_DIVISAO             = (string)d.Cells["DOC_DIVISAO"].Value;
                string PAS_CODIGOPASSAGEM      = (string)d.Cells["PAS_CODIGOPASSAGEM"].Value;
                string DOC_NOMEARQUIVO         = (string)d.Cells["DOC_NOMEARQUIVO"].Value;
                string DOC_EXTENSAONOMEARQUIVO = (string)d.Cells["DOC_EXTENSAONOMEARQUIVO"].Value;

                if (PAS_REGISTRO != null)
                {
                    if (DOC_EXTENSAONOMEARQUIVO.Contains("_"))
                    {
                        DOC_EXTENSAONOMEARQUIVO = ".Jpeg";
                    }

                    GEDDocumentosNivel2 obj;
                    var OutputIni = ACSConfig.GetStorage().Output;
                    var NewName   = OutputIni + "\\" +
                                    PAS_REGISTRO + "\\" +
                                    PAS_REGISTRO + DOC_DIVISAO + "\\" +
                                    PAS_CODIGOPASSAGEM + "\\" + DOC_NOMEARQUIVO + DOC_EXTENSAONOMEARQUIVO;

                    sCaminhoIMGZoom = NewName;

                    if (!System.IO.File.Exists(NewName))
                    {
                        WFMessageBox.Show("Arquivo Inexistente", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        pctSelected.Image = Resources.documentNull;
                        // pctSelected.SizeMode = PictureBoxSizeMode.Zoom;
                    }
                    else
                    {
                        ImagePanel panelImage = new ImagePanel();
                        panelImage.displayScrollbar();
                        panelImage.setScrollbarValues();
                        Bitmap a = new Bitmap(System.Drawing.Image.FromFile(NewName));
                        pctSelected.Image                 = a;
                        pctSelected.AutoSizeMode          = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
                        tableLayoutPanel1.ColumnStyles[0] = new ColumnStyle(SizeType.Percent, 0);
                        tableLayoutPanel1.ColumnStyles[1] = new ColumnStyle(SizeType.Percent, 100);
                        btnVoltar.Visible                 = true;
                        // pctSelected.SizeMode = PictureBoxSizeMode.StretchImage;
                    }
                }
            }
            else
            {
                //criar lista
            }
        }
        public void View(string path, ContextObject context)
        {
            var header = NativeMethods.FitsImageGetHeader(_fitsImagePtr);

            ImageDim outputDim = NativeMethods.FitsImageGetOutputDim(_fitsImagePtr);

            byte[] img = new byte[outputDim.nx * outputDim.ny * outputDim.nc];
            NativeMethods.FitsImageGetPixData(_fitsImagePtr, img);

            BitmapSource bitmapSource;
            int          rawStride = outputDim.nx * outputDim.nc;

            if (outputDim.nc == 3)
            {
                bitmapSource = BitmapSource.Create(outputDim.nx, outputDim.ny, 96, 96, PixelFormats.Rgb24, null, img, rawStride);
            }
            else
            {
                bitmapSource = BitmapSource.Create(outputDim.nx, outputDim.ny, 96, 96, PixelFormats.Gray8, null, img, rawStride);
            }

            _ip = new ImagePanel(context, header);

            context.ViewerContent = _ip;
            context.Title         = $"{Path.GetFileName(path)}";
            _ip.Source            = bitmapSource;

            context.IsBusy = false;
        }
Example #3
0
 public void ExitImageShow()
 {
     swipeController.SetActive(false);
     ImagePanel.SetActive(false);
     // Show Webview
     webView.GetComponent <WebView>().ShowWeb();
 }
Example #4
0
        private void UpdateResource()
        {
            var index = 0;

            foreach (var item in _itemui.Data.Inventorys.Resource.Resources)
            {
                if (item.Value.numver > 0)
                {
                    if (PanelGrid.GetChild(index).ChildPanel.Count == 0)
                    {
                        var currentpanel = new ImagePanel(PanelGrid.GetChild(index), GetItemPath(item.Key))
                        {
                            Position  = PanelGrid.GetChild(index).Bounds.Center.ToVector2(),
                            Origin    = new Vector2(17, 15),
                            Scale     = 11,
                            PanelCode = item.Key,
                        };
                        currentpanel.UpdateEvent += Currentpanel_UpdateEvent;

                        new TextPanel(PanelGrid.GetChild(index).GetChild(item.Key), _itemui.ParantMenu.StandardFont, item.Value.numver.ToString(), TextSortMode.MIDDLE)
                        {
                            Position = PanelGrid.GetChild(index).Bounds.Center.ToVector2() + new Vector2(25, 25),
                            Color    = Color.White
                        };
                    }
                    else
                    {
                        PanelExt.GetPanel <TextPanel>(PanelGrid.GetChild(index).GetChild(item.Key).GetChild(0)).Text = item.Value.numver.ToString();
                    }
                    index++;
                }
            }
        }
Example #5
0
        } /* ResizeWindow */

        private void  RePaintImage()
        {
            if ((sizeRatio <= 0.0f) || (image == null))
            {
                return;
            }

            byte[][] processedRaster = PerformAllOperations(raster);


            Bitmap newImage = BuildBitmapFromRasterData(processedRaster);

            int newWidth  = (int)((float)width * sizeRatio + 0.5f);
            int newHeight = (int)((float)height * sizeRatio + 0.5f);

            image = new Bitmap(newWidth, newHeight);
            Graphics imageDC = Graphics.FromImage(image);

            imageDC.Clear(backGroundColor);
            imageDC.ScaleTransform(sizeRatio, sizeRatio);
            imageDC.DrawImageUnscaled(newImage, 0, 0);

            newImage.Dispose();
            newImage = null;

            pictureBox1.Height = newHeight;
            pictureBox1.Width  = newWidth;
            pictureBox1.Image  = image;

            ImagePanel.AutoScroll        = true;
            ImagePanel.AutoScrollMinSize = image.Size;
            ImagePanel.Invalidate();
        } /* RePaintImage */
Example #6
0
 private void lvMyTagRank_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (lvMyTagRank.SelectedItems.Count > 0)
     {
         string[] tags = lvMyTagRank.SelectedItems.OfType <ListViewItem>().Select(x => x.SubItems[0].Text).ToArray();
         ImagePanel.SuspendLayout();
         for (int i = 0; i < ImagePanel.Controls.Count; i++)
         {
             PicElement pe = ImagePanel.Controls[i] as PicElement;
             if (tags.All(x => pe.Article.Tags != null && pe.Article.Tags.Contains(x)))
             {
                 pe.Selected = true;
             }
             else
             {
                 pe.Selected = false;
             }
         }
         ImagePanel.ResumeLayout();
     }
     else
     {
         for (int i = 0; i < ImagePanel.Controls.Count; i++)
         {
             (ImagePanel.Controls[i] as PicElement).Selected = false;
         }
     }
 }
Example #7
0
        void InitShipRename()
        {
            pnRename       = new ImagePanel();
            pnRename.Image = Root.Singleton.Material("img/customizeUI/box_shipname.png");
            Util.LayoutControl(pnRename, 10, 10, pnRename.Image.Size, rctScreen);
            pnRename.Parent = Root.Singleton.Canvas;
            pnRename.Init();

            var btnRenameShip = new ImageButton();

            btnRenameShip.Image         = Root.Singleton.Material("img/customizeUI/button_name_on.png");
            btnRenameShip.HoveredImage  = Root.Singleton.Material("img/customizeUI/button_name_select2.png");
            btnRenameShip.DisabledImage = Root.Singleton.Material("img/customizeUI/button_name_off.png");
            btnRenameShip.Enabled       = true;
            btnRenameShip.OnClick      += sender =>
            {
                tbShipName.EditMode         = true;
                Root.Singleton.Canvas.Focus = tbShipName;
            };
            btnRenameShip.HoverSound = Root.Singleton.Sound("audio/waves/ui/select_light1.wav");
            Util.LayoutControl(btnRenameShip, 8, 8, btnRenameShip.Image.Size, rctScreen);
            btnRenameShip.Parent = pnRename;
            btnRenameShip.Init();

            tbShipName           = new TextEntry();
            tbShipName.Centered  = true;
            tbShipName.AutoScale = false;
            tbShipName.Font      = Root.Singleton.Font("fonts/num_font.ttf");
            tbShipName.Text      = "test";
            Util.LayoutControl(tbShipName, 115, 4, 320, 33, rctScreen);
            tbShipName.Parent = pnRename;
            tbShipName.Init();
        }
Example #8
0
        private void UpdateSelection()
        {
            if (SelectedDescriptor == null || !SelectedDescriptor.IsLoaded)
            {
                return;
            }

            PropertiesPanel.ClearChildren();
            GridLayout layout = new GridLayout(GUI, PropertiesPanel, 5, 1);

            ImagePanel worldPanel = new ImagePanel(GUI, layout, SelectedDescriptor.Button.Image)
            {
                KeepAspectRatio = true
            };

            layout.SetComponentPosition(worldPanel, 0, 1, 1, 1);

            Label worldLabel = new Label(GUI, PropertiesPanel, SelectedDescriptor.WorldName, GUI.DefaultFont);

            layout.SetComponentPosition(worldLabel, 0, 2, 1, 1);

            Button loadButton = new Button(GUI, layout, "Load", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Save));

            layout.SetComponentPosition(loadButton, 0, 3, 1, 1);

            loadButton.OnClicked += loadButton_OnClicked;

            Button deleteButton = new Button(GUI, layout, "Delete", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Ex));

            layout.SetComponentPosition(deleteButton, 0, 4, 1, 1);

            deleteButton.OnClicked += deleteButton_OnClicked;
        }
Example #9
0
        private void Button_Del_Click(object sender, RoutedEventArgs e)
        {
            if (mUVAnim == null)
            {
                return;
            }
            // 至少有一帧
            if (mUVAnim.Frames.Count <= 1)
            {
                return;
            }

            if (ListBox_Frames.SelectedIndex < 0 || ListBox_Frames.SelectedIndex >= mUVAnim.Frames.Count)
            {
                return;
            }

            ImagePanel.RemoveFrame(ListBox_Frames.SelectedIndex);
            mUVAnim.DelFrame(ListBox_Frames.SelectedIndex);
            ListBox_Frames.Items.RemoveAt(ListBox_Frames.SelectedIndex);

            for (int i = 0; i < ListBox_Frames.Items.Count; i++)
            {
                ListBox_Frames.Items[i] = KeyFrameWord + i;
            }
        }
        //Init
        public EventWindow(Canvas gameCanvas)
        {
            //Event Dialog Window
            mEventDialogWindow = new ImagePanel(gameCanvas, "EventDialogueWindow");
            mEventDialogWindow.Hide();
            Interface.InputBlockingElements.Add(mEventDialogWindow);

            mEventFace = new ImagePanel(mEventDialogWindow, "EventFacePanel");

            mEventDialogArea          = new ScrollControl(mEventDialogWindow, "EventDialogArea");
            mEventDialogLabelTemplate = new Label(mEventDialogArea, "EventDialogLabel");
            mEventDialogLabel         = new RichLabel(mEventDialogArea);

            mEventDialogAreaNoFace          = new ScrollControl(mEventDialogWindow, "EventDialogAreaNoFace");
            mEventDialogLabelNoFaceTemplate = new Label(mEventDialogAreaNoFace, "EventDialogLabel");
            mEventDialogLabelNoFace         = new RichLabel(mEventDialogAreaNoFace);

            mEventResponse1          = new Button(mEventDialogWindow, "EventResponse1");
            mEventResponse1.Clicked += EventResponse1_Clicked;

            mEventResponse2          = new Button(mEventDialogWindow, "EventResponse2");
            mEventResponse2.Clicked += EventResponse2_Clicked;

            mEventResponse3          = new Button(mEventDialogWindow, "EventResponse3");
            mEventResponse3.Clicked += EventResponse3_Clicked;

            mEventResponse4          = new Button(mEventDialogWindow, "EventResponse4");
            mEventResponse4.Clicked += EventResponse4_Clicked;
        }
Example #11
0
        /// <summary>
        /// Repositions any rendered skulls in the ImagePanel
        /// </summary>
        void ArrangeSkullSets()
        {
            int xLocation = 0;
            int yLocation = 0;

            if (ImagePanel.ActualWidth < 128)
            {
                return;
            }

            foreach (SkullSet skullSet in SkullSets)
            {
                if (xLocation + 128 > ImagePanel.ActualWidth)
                {
                    //Go to next line, out of room for skulls on this one
                    xLocation  = 0;
                    yLocation += 64;
                }

                skullSet.SetLocation(xLocation, yLocation);

                xLocation += 128 + 16;  //128 for two skulls' width, 16 for space between skullsets
            }

            ImagePanel.UpdateLayout();
        }
Example #12
0
        public ItemInventory(ItemScreen ui, UiSkinComponent skin, Texture2D texture, int x, int y, int width, int height, float sourceScale) : base(texture, x, y, width, height, sourceScale)
        {
            _itemui       = ui;
            TopRect       = new UiRectangle(this, skin.GetSkin("test"), PanelExt.SizeToBounds(Bounds, 0f, 0f, 1f, 0.1f), 0.5f);
            TopRect.Color = Microsoft.Xna.Framework.Color.Silver;


            _itemText = new TextPanel(this, ui.ParantMenu.StandardFont, "Item", TextSortMode.LEFT)
            {
                Color    = Color.Black,
                Position = PanelExt.PositionToBounds(TopRect.Bounds, 0.05f, 0.5f)
            };


            PanelGrid = new GridPanel(this, 4, 4, PanelExt.SizeToBounds(Bounds, 0f, 0.1f, 1f, 0.9f), 10, 10);
            for (int i = 0; i < 16; i++)
            {
                PanelGrid.AddGridChilde(new UiRectangle(skin.GetSkin("item"), new Rectangle(0, 0, 100, 100), 2)
                {
                    PanelCode = i
                });
            }

            _exit = new ImagePanel(this, "UI\\exit");
            _exit.SetPosition(PanelExt.PositionToBounds(Bounds, 0.95f, 0.05f));
            _exit.Scale = 1.5f;
            _exit.Recalculate();

            SelectOnEvent += ItemPanel_SelectOnEvent;
        }
 public void Setup()
 {
     Pnl             = new ImagePanel(Container, "StatusIcon");
     Pnl.HoverEnter += pnl_HoverEnter;
     Pnl.HoverLeave += pnl_HoverLeave;
     mDurationLabel  = new Framework.Gwen.Control.Label(Container, "DurationLabel");
 }
 public void Setup()
 {
     Pnl             = new ImagePanel(Container, "MapItemIcon");
     Pnl.HoverEnter += pnl_HoverEnter;
     Pnl.HoverLeave += pnl_HoverLeave;
     Pnl.Clicked    += pnl_Clicked;
 }
Example #15
0
        //Init
        public LoginWindow(Canvas parent, MainMenu mainMenu, ImagePanel parentPanel)
        {
            //Assign References
            mMainMenu = mainMenu;

            //Main Menu Window
            mLoginWindow = new ImagePanel(parent, "LoginWindow");

            //Menu Header
            mLoginHeader = new Label(mLoginWindow, "LoginHeader");
            mLoginHeader.SetText(Strings.Login.title);

            mUsernameBackground = new ImagePanel(mLoginWindow, "UsernamePanel");

            //Login Username Label
            mUsernameLabel = new Label(mUsernameBackground, "UsernameLabel");
            mUsernameLabel.SetText(Strings.Login.username);

            //Login Username Textbox
            mUsernameTextbox = new TextBox(mUsernameBackground, "UsernameField");
            mUsernameTextbox.SubmitPressed += UsernameTextbox_SubmitPressed;
            mUsernameTextbox.Clicked       += _usernameTextbox_Clicked;

            mPasswordBackground = new ImagePanel(mLoginWindow, "PasswordPanel");

            //Login Password Label
            mPasswordLabel = new Label(mPasswordBackground, "PasswordLabel");
            mPasswordLabel.SetText(Strings.Login.password);

            //Login Password Textbox
            mPasswordTextbox = new TextBoxPassword(mPasswordBackground, "PasswordField");
            mPasswordTextbox.SubmitPressed += PasswordTextbox_SubmitPressed;
            mPasswordTextbox.TextChanged   += _passwordTextbox_TextChanged;

            //Login Save Pass Checkbox
            mSavePassChk = new LabeledCheckBox(mLoginWindow, "SavePassCheckbox")
            {
                Text = Strings.Login.savepass
            };

            //Forgot Password Button
            mForgotPassswordButton          = new Button(mLoginWindow, "ForgotPasswordButton");
            mForgotPassswordButton.IsHidden = true;
            mForgotPassswordButton.SetText(Strings.Login.forgot);
            mForgotPassswordButton.Clicked += mForgotPassswordButton_Clicked;

            //Login - Send Login Button
            mLoginBtn = new Button(mLoginWindow, "LoginButton");
            mLoginBtn.SetText(Strings.Login.login);
            mLoginBtn.Clicked += LoginBtn_Clicked;

            //Login - Back Button
            mBackBtn = new Button(mLoginWindow, "BackButton");
            mBackBtn.SetText(Strings.Login.back);
            mBackBtn.Clicked += BackBtn_Clicked;

            LoadCredentials();

            mLoginWindow.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());
        }
Example #16
0
        /// <summary>
        /// When editing an image index value, let the user choose an image from
        /// a popup that displays all the images in the associated <see cref="ImageSet"/>
        /// </summary>
        /// <param name="context">designer context</param>
        /// <param name="provider">designer service provider</param>
        /// <param name="value">image index item</param>
        /// <returns>
        /// An image index (selected from the popup) or -1 if the user canceled the
        /// selection
        /// </returns>
        public override object EditValue(ITypeDescriptorContext context,IServiceProvider provider,object value)
        {
            wfes = (IWindowsFormsEditorService)
                provider.GetService(typeof(IWindowsFormsEditorService));

            if((wfes == null) || (context == null))
                return null ;

            // Get the image set
            ImageSet imageSet = GetImageSet(context.Instance) ;

            // anything to show?
            if ((imageSet == null) || (imageSet.Count==0))
                return -1 ;

            // Create an image panel that is close to square
            Size dims = ImagePanel.CalculateBestDimensions(imageSet.Count,ImagePanel.PanelSizeHints.MinimizeBoth) ;
            imagePanel = new ImagePanel((Bitmap) imageSet.Preview,imageSet.Count,dims.Height,dims.Width) ;
            // set the current image index value as the default selection
            imagePanel.DefaultImage = (int) value ;
            // no grid
            imagePanel.GridColor = Color.Empty ;
            // listen for an image to be selected
            imagePanel.ImageSelected += new EventHandler(imagePanel_ImageSelected);

            // show the popup as a drop-down
            wfes.DropDownControl(imagePanel) ;

            // return the selection (or the original value if none selected)
            return (selectedIndex != -1) ? selectedIndex : (int) value ;
        }
Example #17
0
        public ImageEditor(string _fileName,
                           int _height,
                           int _width,
                           byte[][]        _raster,// Will take ownership of '_raster'
                           InstrumentData _instrumentData
                           )
        {
            InitializeComponent();

            fileName       = _fileName;
            instrumentData = _instrumentData;
            raster         = _raster;
            height         = _height;
            width          = _width;

            imageFileName = _fileName;;

            BuildColorValues();

            SizeOptions.SelectedOption = "100%";

            image = BuildBitmapFromRasterData(raster);

            pictureBox1.Height = image.Height;
            pictureBox1.Width  = image.Width;
            pictureBox1.Image  = image;

            ImagePanel.AutoScroll = true;
            //ImagePanel.SetStyle   (ControlStyles.ResizeRedraw, false);
            ImagePanel.AutoScroll        = true;
            ImagePanel.AutoScrollMinSize = image.Size;
            ImagePanel.Invalidate();

            MakePredictions();
        }
Example #18
0
        public ImageEditor(PicesRaster _raster)
        {
            InitializeComponent();

            //raster         = (byte[][])_raster.BuildRasterArray ();
            raster        = _raster.BuildRasterArray2();
            imageFileName = _raster.FileName;

            instrumentData = null;
            height         = _raster.Height;
            width          = _raster.Width;

            _raster = null;

            BuildColorValues();

            SizeOptions.SelectedOption = "100%";

            image = BuildBitmapFromRasterData(raster);

            pictureBox1.Height = image.Height;
            pictureBox1.Width  = image.Width;
            pictureBox1.Image  = image;

            ImagePanel.AutoScroll = true;
            //ImagePanel.SetStyle   (ControlStyles.ResizeRedraw, false);
            ImagePanel.AutoScroll        = true;
            ImagePanel.AutoScrollMinSize = image.Size;
            ImagePanel.Invalidate();

            MakePredictions();
        }
Example #19
0
        private void ImagePanel_MouseWheel(object sender, MouseEventArgs e)
        {
            ImagePanel.Focus();

            if (ModifierKeys.HasFlag(Keys.Control))
            {
                // zoom
                if (e.Delta < 0)
                {
                    bitSize.Value = Math.Max(bitSize.Value - 1, bitSize.Minimum);
                }
                else
                {
                    bitSize.Value = Math.Min(bitSize.Value + 1, bitSize.Maximum);
                }
            }
            else
            {
                // scroll
                if (e.Delta < 0)
                {
                    vScrollBar1.Value = Math.Min(vScrollBar1.Maximum, vScrollBar1.Value + 1);
                }
                else
                {
                    vScrollBar1.Value = Math.Max(vScrollBar1.Minimum, vScrollBar1.Value - 1);
                }
            }
        }
Example #20
0
        //Init
        public Menu(Canvas gameCanvas)
        {
            mGameCanvas = gameCanvas;

            mMenuContainer = new ImagePanel(gameCanvas, "MenuContainer");
            mMenuContainer.ShouldCacheToTexture = true;

            mInventoryBackground = new ImagePanel(mMenuContainer, "InventoryContainer");
            mInventoryButton     = new Button(mInventoryBackground, "InventoryButton");
            mInventoryButton.SetToolTipText(Strings.GameMenu.items);
            mInventoryButton.Clicked += InventoryButton_Clicked;

            mSpellsBackground = new ImagePanel(mMenuContainer, "SpellsContainer");
            mSpellsButton     = new Button(mSpellsBackground, "SpellsButton");
            mSpellsButton.SetToolTipText(Strings.GameMenu.spells);
            mSpellsButton.Clicked += SpellsButton_Clicked;

            mCharacterBackground = new ImagePanel(mMenuContainer, "CharacterContainer");
            mCharacterButton     = new Button(mCharacterBackground, "CharacterButton");
            mCharacterButton.SetToolTipText(Strings.GameMenu.character);
            mCharacterButton.Clicked += CharacterButton_Clicked;

            mQuestsBackground = new ImagePanel(mMenuContainer, "QuestsContainer");
            mQuestsButton     = new Button(mQuestsBackground, "QuestsButton");
            mQuestsButton.SetToolTipText(Strings.GameMenu.quest);
            mQuestsButton.Clicked += QuestBtn_Clicked;

            mFriendsBackground = new ImagePanel(mMenuContainer, "FriendsContainer");
            mFriendsButton     = new Button(mFriendsBackground, "FriendsButton");
            mFriendsButton.SetToolTipText(Strings.GameMenu.friends);
            mFriendsButton.Clicked += FriendsBtn_Clicked;

            mPartyBackground = new ImagePanel(mMenuContainer, "PartyContainer");
            mPartyButton     = new Button(mPartyBackground, "PartyButton");
            mPartyButton.SetToolTipText(Strings.GameMenu.party);
            mPartyButton.Clicked += PartyBtn_Clicked;

            mGuildBackground = new ImagePanel(mMenuContainer, "GuildContainer");
            mGuildButton     = new Button(mGuildBackground, "GuildButton");
            mGuildButton.SetToolTipText(Strings.Guilds.Guild);
            mGuildButton.Clicked += GuildBtn_Clicked;

            mMenuBackground = new ImagePanel(mMenuContainer, "MenuContainer");
            mMenuButton     = new Button(mMenuBackground, "MenuButton");
            mMenuButton.SetToolTipText(Strings.GameMenu.Menu);
            mMenuButton.Clicked += MenuButtonClicked;

            mMenuContainer.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());

            //Assign Window References
            mPartyWindow     = new PartyWindow(gameCanvas);
            mFriendsWindow   = new FriendsWindow(gameCanvas);
            mInventoryWindow = new InventoryWindow(gameCanvas);
            mSpellsWindow    = new SpellsWindow(gameCanvas);
            mCharacterWindow = new CharacterWindow(gameCanvas);
            mQuestsWindow    = new QuestsWindow(gameCanvas);
            mMapItemWindow   = new MapItemWindow(gameCanvas);
            mGuildWindow     = new GuildWindow(gameCanvas);
        }
Example #21
0
 public void Setup()
 {
     Pnl                = new ImagePanel(Container, "ShopItemIcon");
     Pnl.HoverEnter    += pnl_HoverEnter;
     Pnl.HoverLeave    += pnl_HoverLeave;
     Pnl.RightClicked  += Pnl_RightClicked;
     Pnl.DoubleClicked += Pnl_RightClicked; //Allow buying via double click OR right click
 }
Example #22
0
    //void LoadData()
    //{
    //    if (contacts.HasValue)
    //    {
    //        Contacts contactsValue = contacts.Value;

    //        // 정렬
    //        contactsValue.contactList.Sort();

    //        for (int i = 0; i < contactsValue.contactList.Count; i++)
    //        {
    //            AddList(contactsValue.contactList[i], i);
    //        }
    //    }
    //}

    void AddList(Contact contact, int index)
    {
        ImagePanel imagePanel = Instantiate(imagePanelPrefab).GetComponent <ImagePanel>();

        imagePanel.photoImageSprite   = SpriteManager.GetSprite(contact.photoFileName);
        imagePanel.imagePanelDelegate = this;
        imagesList.Add(imagePanel);
    }
Example #23
0
 void InitShipNamePanel()
 {
     pnRename       = new ImagePanel();
     pnRename.Image = Root.Singleton.Material("img/customizeUI/box_shipname.png");
     Util.LayoutControl(pnRename, 10, 10, 442, 48, rctScreen);
     pnRename.Parent = Root.Singleton.Canvas;
     pnRename.Init();
 }
        /// <summary>
        /// Adds a new image status panel</summary>
        /// <returns>IStatusImage panel</returns>
        public IStatusImage AddImage()
        {
            ImagePanel imagePanel = new ImagePanel();

            imagePanel.Name = "$Status" + (s_controlCount++);
            m_statusStrip.Items.Add(imagePanel);
            return(imagePanel);
        }
Example #25
0
    private void ActiveImage()
    {
        // Hide Webview
        webView.GetComponent <WebView>().HideWeb();

        swipeController.SetActive(true);
        ImagePanel.SetActive(true);
    }
        /// <summary>
        /// Create a new instance of the <see cref="AnnouncementWindow"/> class.
        /// </summary>
        /// <param name="gameCanvas">The <see cref="Canvas"/> to render this control on.</param>
        public AnnouncementWindow(Canvas gameCanvas)
        {
            mGameCanvas = gameCanvas;
            mPicture    = new ImagePanel(gameCanvas, "AnnouncementWindow");
            mLabel      = new Label(mPicture, "AnnouncementLabel");

            mPicture.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());
        }
Example #27
0
        public EscapeMenu([NotNull] Canvas gameCanvas) : base(gameCanvas, "EscapeMenu")
        {
            Interface.InputBlockingElements?.Add(this);

            Width  = gameCanvas.Width;
            Height = gameCanvas.Height;

            mContainer = new ImagePanel(this, "EscapeMenu");

            mTitle = new Label(mContainer, "TitleLabel")
            {
                Text = Strings.EscapeMenu.Title,
            };

            mOptionsWindow = new OptionsWindow(gameCanvas, null, null);

            mOptions = new Button(mContainer, "OptionsButton")
            {
                Text = Strings.EscapeMenu.Options
            };

            mOptions.Clicked += Options_Clicked;

            mGoToCharacterSelect = new Button(mContainer, "CharacterSelectButton")
            {
                Text = Strings.EscapeMenu.CharacterSelect
            };

            mGoToCharacterSelect.Clicked += GoToCharacterSelect_Clicked;

            mLogout = new Button(mContainer, "LogoutButton")
            {
                Text = Strings.EscapeMenu.Logout
            };

            mLogout.Clicked += Logout_Clicked;

            mExitToDesktop = new Button(mContainer, "ExitToDesktopButton")
            {
                Text = Strings.EscapeMenu.ExitToDesktop
            };

            mExitToDesktop.Clicked += ExitToDesktop_Clicked;

            mClose = new Button(mContainer, "CloseButton")
            {
                Text = Strings.EscapeMenu.Close
            };

            mClose.Clicked += Close_Clicked;

            mContainer.LoadJsonUi(GameContentManager.UI.InGame, Graphics.Renderer.GetResolutionString());

            if (Options.Player.MaxCharacters <= 1)
            {
                mGoToCharacterSelect.IsDisabled = true;
            }
        }
Example #28
0
 public void Setup()
 {
     Pnl                = new ImagePanel(Container, "TradeIcon");
     Pnl.HoverEnter    += pnl_HoverEnter;
     Pnl.HoverLeave    += pnl_HoverLeave;
     Pnl.RightClicked  += Pnl_DoubleClicked; //Revoke with right click or double click
     Pnl.DoubleClicked += Pnl_DoubleClicked;
     Pnl.Clicked       += pnl_Clicked;
 }
Example #29
0
 public void Setup()
 {
     Pnl                = new ImagePanel(Container, "BankItemIcon");
     Pnl.HoverEnter    += pnl_HoverEnter;
     Pnl.HoverLeave    += pnl_HoverLeave;
     Pnl.RightClicked  += Pnl_DoubleClicked; //Allow withdrawing via double click OR right click
     Pnl.DoubleClicked += Pnl_DoubleClicked;
     Pnl.Clicked       += pnl_Clicked;
 }
Example #30
0
        public void SetupSpellTab()
        {
            KnownSpellTab = new MagicTab
            {
                Tab = SpellsTab
            };
            CreateMagicTab(KnownSpellTab);
            //BuildItemTab.BuildButton.OnClicked += BuildItemButton_OnClicked;
            List <Spell> spells = Master.Spells.GetKnownSpells();

            int        numItems   = spells.Count();
            int        numColumns = 1;
            GridLayout layout     = new GridLayout(GUI, KnownSpellTab.Scroller, numItems, numColumns)
            {
                LocalBounds    = new Rectangle(0, 0, 720, 40 * numItems),
                EdgePadding    = 0,
                WidthSizeMode  = SizeMode.Fit,
                HeightSizeMode = SizeMode.Fixed
            };

            int i = 0;

            foreach (Spell spell in spells)
            {
                Spell      currSpell  = spell;
                GridLayout itemLayout = new GridLayout(GUI, layout, 1, 3)
                {
                    WidthSizeMode  = SizeMode.Fixed,
                    HeightSizeMode = SizeMode.Fixed,
                    EdgePadding    = 0
                };

                itemLayout.OnClicked += () => ItemTabOnClicked(currSpell);
                int i1 = i;
                itemLayout.OnHover += () => HoverItem(layout, i1);

                layout.SetComponentPosition(itemLayout, 0, i, 1, 1);

                ImagePanel icon = new ImagePanel(GUI, itemLayout, spell.Image)
                {
                    KeepAspectRatio = true,
                    ConstrainSize   = true,
                    MinWidth        = 32,
                    MinHeight       = 32
                };
                itemLayout.SetComponentPosition(icon, 0, 0, 1, 1);

                Label description = new Label(GUI, itemLayout, spell.Name, GUI.SmallFont)
                {
                    ToolTip = spell.Description
                };
                itemLayout.SetComponentPosition(description, 1, 0, 1, 1);
                i++;
            }
            layout.UpdateSizes();
        }
        //Init
        public SelectCharacterWindow(Canvas parent, MainMenu mainMenu, ImagePanel parentPanel)
        {
            //Assign References
            mMainMenu = mainMenu;

            //Main Menu Window
            mCharacterSelectionPanel = new ImagePanel(parent, "CharacterSelectionWindow");

            //Menu Header
            mCharacterSelectionHeader = new Label(mCharacterSelectionPanel, "CharacterSelectionHeader");
            mCharacterSelectionHeader.SetText(Strings.CharacterSelection.title);

            //Character Name
            mCharnameLabel = new Label(mCharacterSelectionPanel, "CharacterNameLabel");
            mCharnameLabel.SetText(Strings.CharacterSelection.empty);

            //Character Info
            mInfoLabel = new Label(mCharacterSelectionPanel, "CharacterInfoLabel");
            mInfoLabel.SetText(Strings.CharacterSelection.New);

            //Character Container
            mCharacterContainer = new ImagePanel(mCharacterSelectionPanel, "CharacterContainer");

            //Next char Button
            mNextCharButton          = new Button(mCharacterContainer, "NextCharacterButton");
            mNextCharButton.Clicked += _nextCharButton_Clicked;

            //Prev Char Button
            mPrevCharButton          = new Button(mCharacterContainer, "PreviousCharacterButton");
            mPrevCharButton.Clicked += _prevCharButton_Clicked;

            //Play Button
            mPlayButton = new Button(mCharacterSelectionPanel, "PlayButton");
            mPlayButton.SetText(Strings.CharacterSelection.play);
            mPlayButton.Clicked += _playButton_Clicked;
            mPlayButton.Hide();

            //Delete Button
            mDeleteButton = new Button(mCharacterSelectionPanel, "DeleteButton");
            mDeleteButton.SetText(Strings.CharacterSelection.delete);
            mDeleteButton.Clicked += _deleteButton_Clicked;
            mDeleteButton.Hide();

            //Create new char Button
            mNewButton = new Button(mCharacterSelectionPanel, "NewButton");
            mNewButton.SetText(Strings.CharacterSelection.New);
            mNewButton.Clicked += _newButton_Clicked;

            //Logout Button
            mLogoutButton = new Button(mCharacterSelectionPanel, "LogoutButton");
            mLogoutButton.SetText(Strings.CharacterSelection.logout);
            mLogoutButton.IsHidden = true;
            mLogoutButton.Clicked += mLogoutButton_Clicked;

            mCharacterSelectionPanel.LoadJsonUi(GameContentManager.UI.Menu, Graphics.Renderer.GetResolutionString());
        }
Example #32
0
        /// <summary>
        /// Creates all of the sub-components of the GUI in for the PlayState (buttons, etc.)
        /// </summary>
        public void CreateGUIComponents()
        {
            GUI.RootComponent.ClearChildren();
            GridLayout layout = new GridLayout(GUI, GUI.RootComponent, 11, 11)
            {
                LocalBounds = new Rectangle(0, 0, GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height),
                WidthSizeMode = GUIComponent.SizeMode.Fixed,
                HeightSizeMode = GUIComponent.SizeMode.Fixed
            };

            GUI.RootComponent.AddChild(Master.Debugger.MainPanel);
            layout.AddChild(Master.ToolBar);
            Master.ToolBar.Parent = layout;
            layout.SetComponentPosition(Master.ToolBar, 7, 10, 4, 1);

            GUIComponent companyInfoComponent = new GUIComponent(GUI, layout);

            layout.SetComponentPosition(companyInfoComponent, 0, 0, 4, 2);

            GUIComponent resourceInfoComponent = new ResourceInfoComponent(GUI, layout, Master.Faction);
            layout.SetComponentPosition(resourceInfoComponent, 7, 0, 2, 2);

            GridLayout infoLayout = new GridLayout(GUI, companyInfoComponent, 3, 4);

            CompanyLogoPanel = new ImagePanel(GUI, infoLayout, PlayerCompany.Logo);
            infoLayout.SetComponentPosition(CompanyLogoPanel, 0, 0, 1, 1);

            CompanyNameLabel = new Label(GUI, infoLayout, PlayerCompany.Name, GUI.DefaultFont)
            {
                TextColor = Color.White,
                StrokeColor = new Color(0, 0, 0, 255),
                ToolTip = "Our company Name.",
                Alignment = Drawer2D.Alignment.Top,
            };
            infoLayout.SetComponentPosition(CompanyNameLabel, 1, 0, 1, 1);

            MoneyLabel = new DynamicLabel(GUI, infoLayout, "Money:\n", "", GUI.DefaultFont, "C2", () => Master.Faction.Economy.CurrentMoney)
            {
                TextColor = Color.White,
                StrokeColor = new Color(0, 0, 0, 255),
                ToolTip = "Amount of money in our treasury.",
                Alignment = Drawer2D.Alignment.Top,
            };
            infoLayout.SetComponentPosition(MoneyLabel, 3, 0, 1, 1);

            StockLabel = new DynamicLabel(GUI, infoLayout, "Stock:\n", "", GUI.DefaultFont, "C2", () => Master.Faction.Economy.Company.StockPrice)
            {
                TextColor = Color.White,
                StrokeColor = new Color(0, 0, 0, 255),
                ToolTip = "The price of our company stock.",
                Alignment = Drawer2D.Alignment.Top,
            };
            infoLayout.SetComponentPosition(StockLabel, 5, 0, 1, 1);

            TimeLabel = new Label(GUI, layout, Time.CurrentDate.ToShortDateString() + " " + Time.CurrentDate.ToShortTimeString(), GUI.SmallFont)
            {
                TextColor = Color.White,
                StrokeColor = new Color(0, 0, 0, 255),
                Alignment = Drawer2D.Alignment.Top,
                ToolTip = "Current time and date."
            };
            layout.SetComponentPosition(TimeLabel, 6, 0, 1, 1);

            CurrentLevelLabel = new Label(GUI, infoLayout, "Slice: " + ChunkManager.ChunkData.MaxViewingLevel, GUI.DefaultFont)
            {
                TextColor = Color.White,
                StrokeColor = new Color(0, 0, 0, 255),
                ToolTip = "The maximum height of visible terrain"
            };
            infoLayout.SetComponentPosition(CurrentLevelLabel, 0, 1, 1, 1);

            CurrentLevelUpButton = new Button(GUI, infoLayout, "", GUI.DefaultFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowUp))
            {
                ToolTip = "Go up one level of visible terrain",
                KeepAspectRatio = true,
                DontMakeBigger = true,
                DontMakeSmaller = true
            };

            infoLayout.SetComponentPosition(CurrentLevelUpButton, 1, 1, 1, 1);
            CurrentLevelUpButton.OnClicked += CurrentLevelUpButton_OnClicked;

            CurrentLevelDownButton = new Button(GUI, infoLayout, "", GUI.DefaultFont, Button.ButtonMode.ImageButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.SmallArrowDown))
            {
                ToolTip = "Go down one level of visible terrain",
                KeepAspectRatio = true,
                DontMakeBigger = true,
                DontMakeSmaller = true
            };
            infoLayout.SetComponentPosition(CurrentLevelDownButton, 1, 2, 1, 1);
            CurrentLevelDownButton.OnClicked += CurrentLevelDownButton_OnClicked;

            /*
            LevelSlider = new Slider(GUI, layout, "", ChunkManager.ChunkData.MaxViewingLevel, 0, ChunkManager.ChunkData.ChunkSizeY, Slider.SliderMode.Integer)
            {
                Orient = Slider.Orientation.Vertical,
                ToolTip = "Controls the maximum height of visible terrain",
                DrawLabel = false
            };

            layout.SetComponentPosition(LevelSlider, 0, 1, 1, 6);
            LevelSlider.OnClicked += LevelSlider_OnClicked;
            LevelSlider.InvertValue = true;
            */

            MiniMap = new Minimap(GUI, layout, 192, 192, this, TextureManager.GetTexture(ContentPaths.Terrain.terrain_colormap), TextureManager.GetTexture(ContentPaths.GUI.gui_minimap))
            {
                IsVisible =  true
            };

            layout.SetComponentPosition(MiniMap, 0, 8, 4, 4);
            Rectangle rect = layout.GetRect(new Rectangle(0, 8, 4, 4));
            layout.SetComponentOffset(MiniMap,  new Point(0, rect.Height - 250));

            Button moneyButton = new Button(GUI, layout, "Economy", GUI.SmallFont, Button.ButtonMode.ImageButton, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 2, 1))
            {
                KeepAspectRatio = true,
                ToolTip = "Opens the Economy Menu",
                DontMakeBigger = true,
                DrawFrame = true,
                TextColor = Color.White
            };

            moneyButton.OnClicked += moneyButton_OnClicked;

            Button settingsButton = new Button(GUI, layout, "Settings", GUI.SmallFont, Button.ButtonMode.ImageButton, new ImageFrame(TextureManager.GetTexture(ContentPaths.GUI.icons), 32, 4, 1))
            {
                KeepAspectRatio = true,
                ToolTip = "Opens the Settings Menu",
                DontMakeBigger = true,
                DrawFrame = true,
                TextColor = Color.White
            };

            settingsButton.OnClicked += OpenPauseMenu;

            layout.SetComponentPosition(settingsButton, 10, 0, 1, 1);

            layout.SetComponentPosition(moneyButton, 9, 0, 1, 1);

            InputManager.KeyReleasedCallback -= InputManager_KeyReleasedCallback;
            InputManager.KeyReleasedCallback += InputManager_KeyReleasedCallback;

            AnnouncementViewer = new AnnouncementViewer(GUI, layout, AnnouncementManager);
            layout.SetComponentPosition(AnnouncementViewer, 3, 10, 3, 1);
            layout.UpdateSizes();
        }
Example #33
0
        void AddPicture()
        {
            if (UserInterfaceIdiomIsPhone) {
                image = new ImagePanel (new RectangleF (x, y, cube, cube), this.ancestor);
            } else {
                image = new ImagePanel (new RectangleF (x, y + 10, UIScreen.MainScreen.Bounds.Width - 20, cube * 2 - 50), this.ancestor);
            }

            image.ImageSaved += (object sender, SavedImageStringsEventArgs e) => {
                myLager.thumbFileName = e.Thumbfilename;
                myLager.LagerImage = e.imageFilename;
                AppDelegate.dao.SaveLager(myLager);
            };

            image.ImageDeleted += (object sender, EventArgs e) => {
                myLager.thumbFileName = null;
                myLager.LagerImage = null;
                AppDelegate.dao.SaveLager(myLager);
            };

            y += cube;
            Add (image.View);
        }
Example #34
0
        public override void OnEnter()
        {
            PlayState.WorldWidth = Settings.Width;
            PlayState.WorldHeight = Settings.Height;
            PlayState.SeaLevel = Settings.SeaLevel;
            PlayState.Random = new ThreadSafeRandom(Seed);
            PlayState.WorldSize = new Point3(8, 1, 8);

            Overworld.Volcanoes = new List<Vector2>();

            DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default);
            GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input);
            IsInitialized = true;
            Drawer = new Drawer2D(Game.Content, Game.GraphicsDevice);
            GenerationComplete = false;
            MainWindow = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };

            GridLayout layout = new GridLayout(GUI, MainWindow, 7, 4)
            {
                LocalBounds = new Rectangle(0, 0, MainWindow.LocalBounds.Width, MainWindow.LocalBounds.Height)
            };

            Button startButton = new Button(GUI, layout, "Start!", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check))
            {
                ToolTip = "Start the game with the currently generated world."
            };

            layout.SetComponentPosition(startButton, 2, 6, 1, 1);
            startButton.OnClicked += StartButtonOnClick;

            Button saveButton = new Button(GUI, layout, "Save", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Save))
            {
                ToolTip = "Save the generated world to a file."
            };
            layout.SetComponentPosition(saveButton, 1, 6, 1, 1);
            saveButton.OnClicked += saveButton_OnClicked;

            Button exitButton = new Button(GUI, layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow))
            {
                ToolTip = "Back to the main menu."
            };
            layout.SetComponentPosition(exitButton, 0, 6, 1, 1);

            exitButton.OnClicked += ExitButtonOnClick;

            MapPanel = new ImagePanel(GUI, layout, worldMap)
            {
                ToolTip = "Map of the world.\nClick to select a location to embark."
            };

            GridLayout mapLayout = new GridLayout(GUI, MapPanel, 4, 5);

            ColorKeys = new ColorKey(GUI, mapLayout)
            {
                ColorEntries = Overworld.HeightColors
            };

            mapLayout.SetComponentPosition(ColorKeys, 3, 0, 1, 1);

            CloseupPanel = new ImagePanel(GUI, mapLayout, new ImageFrame(worldMap, new Rectangle(0, 0, 128, 128)))
            {
                KeepAspectRatio = true,
                ToolTip = "Closeup of the colony location"
            };

            mapLayout.SetComponentPosition(CloseupPanel, 3, 2, 2, 2);

            layout.SetComponentPosition(MapPanel, 0, 0, 3, 5);

            if(worldMap != null)
            {
                MapPanel.Image = new ImageFrame(worldMap);
            }

            MapPanel.OnClicked += OnMapClick;

            layout.UpdateSizes();

            GroupBox mapProperties = new GroupBox(GUI, layout, "Map Controls");

            GridLayout mapPropertiesLayout = new GridLayout(GUI, mapProperties, 7, 2)
            {
                LocalBounds = new Rectangle(mapProperties.LocalBounds.X, mapProperties.LocalBounds.Y + 32, mapProperties.LocalBounds.Width, mapProperties.LocalBounds.Height)
            };

            ComboBox worldSizeBox = new ComboBox(GUI, mapPropertiesLayout)
            {
                ToolTip = "Size of the colony spawn area."
            };

            worldSizeBox.AddValue("Tiny Colony");
            worldSizeBox.AddValue("Small Colony");
            worldSizeBox.AddValue("Medium Colony");
            worldSizeBox.AddValue("Large Colony");
            worldSizeBox.AddValue("Huge Colony");
            worldSizeBox.CurrentIndex = 1;

            worldSizeBox.OnSelectionModified += worldSizeBox_OnSelectionModified;
            mapPropertiesLayout.SetComponentPosition(worldSizeBox, 0, 0, 2, 1);

            ViewSelectionBox = new ComboBox(GUI, mapPropertiesLayout)
            {
                ToolTip = "Display type for the map."
            };

            ViewSelectionBox.AddValue("Height");
            ViewSelectionBox.AddValue("Factions");
            ViewSelectionBox.AddValue("Biomes");
            ViewSelectionBox.AddValue("Temp.");
            ViewSelectionBox.AddValue("Rain");
            ViewSelectionBox.AddValue("Erosion");
            ViewSelectionBox.AddValue("Faults");
            ViewSelectionBox.CurrentIndex = 0;

            mapPropertiesLayout.SetComponentPosition(ViewSelectionBox, 1, 1, 1, 1);

            Label selectLabel = new Label(GUI, mapPropertiesLayout, "Display", GUI.DefaultFont);
            mapPropertiesLayout.SetComponentPosition(selectLabel, 0, 1, 1, 1);
            selectLabel.Alignment = Drawer2D.Alignment.Right;

            layout.SetComponentPosition(mapProperties, 3, 0, 1, 6);

            Progress = new ProgressBar(GUI, layout, 0.0f);
            layout.SetComponentPosition(Progress, 0, 5, 3, 1);

            ViewSelectionBox.OnSelectionModified += DisplayModeModified;
            base.OnEnter();
        }
Example #35
0
 /// <summary>
 /// Adds a new image status panel
 /// </summary>
 /// <returns>Image status panel</returns>
 public IStatusImage AddImage()
 {
     ImagePanel imagePanel = new ImagePanel();
     imagePanel.Name = "$Status" + (s_controlCount++).ToString();
     m_statusStrip.Items.Add(imagePanel);
     return imagePanel;
 }
Example #36
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            this.fieldName.Placeholder = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Item Name", "Item Name");
            this.fieldDescription.Placeholder = MonoTouch.Foundation.NSBundle.MainBundle.LocalizedString ("Item description", "Item description");

            this.fieldName.Ended += (object sender, EventArgs e) => this.SaveIt();

            this.fieldDescription.Ended += (object sender, EventArgs e) => this.SaveIt();

            releaseKeyboard ();
            if (UserInterfaceIdiomIsPhone) {
                imp = new ImagePanel (new RectangleF (10, 400, UIScreen.MainScreen.Bounds.Width - 20, 300), this.ancestor);
            } else {
                imp = new ImagePanel (new RectangleF (10, 475, UIScreen.MainScreen.Bounds.Width - 20, 500), this.ancestor);
            }
            imp.ImageDeleted += (object sender, EventArgs e) => {
                currentItem.ImageFileName = null;
                currentItem.ThumbFileName = null;
                AppDelegate.dao.SaveItem(currentItem);
                RaiseItemSaved();
            };

            imp.ImageSaved += (object sender, SavedImageStringsEventArgs e) => {
                currentItem.ImageFileName = e.imageFilename;
                currentItem.ThumbFileName = e.Thumbfilename;
                AppDelegate.dao.SaveItem(currentItem);
                RaiseItemSaved();
            };

            View.Add (imp.View);

            ShowDetails (this.currentItem);

            initializePlaceObject ();
        }
Example #37
0
        public String Note; // additional text to display in status bar

        public UnitTest(ZGE.Components.ZComponent parent) : base(parent)
        {
            Dock = Pos.Fill;
            SetSize(1024, 768);
            m_List = new Control.CollapsibleList(this);

            LeftDock.TabControl.AddPage("Unit tests", m_List);
            LeftDock.Width = 150;

            m_TextOutput = new Control.ListBox(BottomDock);
            m_Button = BottomDock.TabControl.AddPage("Output", m_TextOutput);
            BottomDock.Height = 200;

            m_DebugCheck = new Control.LabeledCheckBox(m_List);
            m_DebugCheck.Text = "Debug outlines";
            m_DebugCheck.CheckChanged += DebugCheckChanged;

            m_StatusBar = new Control.StatusBar(this);
            m_StatusBar.Dock = Pos.Bottom;
            m_StatusBar.AddControl(m_DebugCheck, true);

            //m_Center = new Center(this);
            //m_Center.Dock = Pos.Fill;
            GUnit test;

            {
                CollapsibleCategory cat = m_List.Add("Non-Interactive");
                {
                    test = new Label(this);
                    RegisterUnitTest("Label", cat, test);
                    test = new RichLabel(this);
                    RegisterUnitTest("RichLabel", cat, test);
                    test = new GroupBox(this);
                    RegisterUnitTest("GroupBox", cat, test);
                    test = new ProgressBar(this);
                    RegisterUnitTest("ProgressBar", cat, test);
                    test = new ImagePanel(this);
                    RegisterUnitTest("ImagePanel", cat, test);
                    test = new StatusBar(this);
                    RegisterUnitTest("StatusBar", cat, test);
                }
            }

            {
                CollapsibleCategory cat = m_List.Add("Standard");
                {
                    test = new Button(this);
                    RegisterUnitTest("Button", cat, test);
                    test = new TextBox(this);
                    RegisterUnitTest("TextBox", cat, test);
                    test = new CheckBox(this);
                    RegisterUnitTest("CheckBox", cat, test);
                    test = new RadioButton(this);
                    RegisterUnitTest("RadioButton", cat, test);
                    test = new ComboBox(this);
                    RegisterUnitTest("ComboBox", cat, test);
                    test = new ListBox(this);
                    RegisterUnitTest("ListBox", cat, test);
                    test = new NumericUpDown(this);
                    RegisterUnitTest("NumericUpDown", cat, test);
                    test = new Slider(this);
                    RegisterUnitTest("Slider", cat, test);
                    test = new MenuStrip(this);
                    RegisterUnitTest("MenuStrip", cat, test);
                    test = new CrossSplitter(this);
                    RegisterUnitTest("CrossSplitter", cat, test);
                }
            }
            
            {
                CollapsibleCategory cat = m_List.Add("Containers");
                {
                    test = new Window(this);
                    RegisterUnitTest("Window", cat, test);
                    test = new TreeControl(this);
                    RegisterUnitTest("TreeControl", cat, test);
                    test = new Properties(this);
                    RegisterUnitTest("Properties", cat, test);
                    test = new TabControl(this);
                    RegisterUnitTest("TabControl", cat, test);
                    test = new ScrollControl(this);
                    RegisterUnitTest("ScrollControl", cat, test);
                    test = new Docking(this);
                    RegisterUnitTest("Docking", cat, test);
                }
            }
            
            {
                CollapsibleCategory cat = m_List.Add("Non-standard");
                {
                    test = new CollapsibleList(this);
                    RegisterUnitTest("CollapsibleList", cat, test);
                    test = new ColorPickers(this);
                    RegisterUnitTest("Color pickers", cat, test);
                }
            }

            m_StatusBar.SendToBack();
            PrintText("Unit Test started!");
        }
Example #38
0
        private void UpdateSelection()
        {
            if (SelectedDescriptor == null || !SelectedDescriptor.IsLoaded)
            {
                return;
            }

            PropertiesPanel.ClearChildren();
            GridLayout layout = new GridLayout(GUI, PropertiesPanel, 5, 1);

            ImagePanel worldPanel = new ImagePanel(GUI, layout, SelectedDescriptor.Button.Image)
            {
                KeepAspectRatio = true
            };
            layout.SetComponentPosition(worldPanel, 0, 1, 1, 1);

            Label worldLabel = new Label(GUI, PropertiesPanel, SelectedDescriptor.Button.Text, GUI.DefaultFont);
            layout.SetComponentPosition(worldLabel, 0, 2, 1, 1);

            Button loadButton = new Button(GUI, layout, "Load", GUI.DefaultFont, Button.ButtonMode.ToolButton,
                GUI.Skin.GetSpecialFrame(GUISkin.Tile.Save));

            layout.SetComponentPosition(loadButton, 0, 3, 1, 1);

            loadButton.OnClicked += loadButton_OnClicked;

            Button deleteButton = new Button(GUI, layout, "Delete", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Ex));
            layout.SetComponentPosition(deleteButton, 0, 4, 1, 1);

            deleteButton.OnClicked += deleteButton_OnClicked;
        }
Example #39
0
        public override void OnEnter()
        {
            IsInitialized = true;
            DefaultFont = Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Default);
            GUI = new DwarfGUI(Game, DefaultFont, Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Title), Game.Content.Load<SpriteFont>(ContentPaths.Fonts.Small), Input);
            MainWindow = new Panel(GUI, GUI.RootComponent)
            {
                LocalBounds = new Rectangle(EdgePadding, EdgePadding, Game.GraphicsDevice.Viewport.Width - EdgePadding * 2, Game.GraphicsDevice.Viewport.Height - EdgePadding * 2)
            };
            Layout = new GridLayout(GUI, MainWindow, 10, 3);

            Label title = new Label(GUI, Layout, "Create a Company", GUI.TitleFont);
            Layout.SetComponentPosition(title, 0, 0, 1, 1);

            Label companyNameLabel = new Label(GUI, Layout, "Name", GUI.DefaultFont);
            Layout.SetComponentPosition(companyNameLabel, 0, 1, 1, 1);

            CompanyNameEdit = new LineEdit(GUI, Layout, CompanyName);
            Layout.SetComponentPosition(CompanyNameEdit, 1, 1, 1, 1);

            Button randomButton = new Button(GUI, Layout, "Random", GUI.DefaultFont, Button.ButtonMode.PushButton, null)
            {
                ToolTip = "Randomly generate a name"
            };
            Layout.SetComponentPosition(randomButton, 2, 1, 1, 1);
            randomButton.OnClicked += randomButton_OnClicked;

            Label companyMottoLabel = new Label(GUI, Layout, "Motto", GUI.DefaultFont);
            Layout.SetComponentPosition(companyMottoLabel, 0, 2, 1, 1);

            CompanyMottoEdit = new LineEdit(GUI, Layout, CompanyMotto);
            Layout.SetComponentPosition(CompanyMottoEdit, 1, 2, 1, 1);
            CompanyMottoEdit.OnTextModified += companyMottoEdit_OnTextModified;

            CompanyNameEdit.OnTextModified += companyNameEdit_OnTextModified;

            Button randomButton2 = new Button(GUI, Layout, "Random", GUI.DefaultFont, Button.ButtonMode.PushButton, null)
            {
                ToolTip = "Randomly generate a motto"
            };
            Layout.SetComponentPosition(randomButton2, 2, 2, 1, 1);
            randomButton2.OnClicked += randomButton2_OnClicked;

            Label companyLogoLabel = new Label(GUI, Layout, "Logo", GUI.DefaultFont);
            Layout.SetComponentPosition(companyLogoLabel, 0, 3, 1, 1);

            CompanyLogoPanel = new ImagePanel(GUI, Layout, CompanyLogo)
            {
                KeepAspectRatio = true,
                AssetName = CompanyLogo.AssetName
            };
            Layout.SetComponentPosition(CompanyLogoPanel, 1, 3, 1, 1);

            Button selectorButton = new Button(GUI, Layout, "Select", GUI.DefaultFont, Button.ButtonMode.PushButton, null)
            {
                ToolTip = "Load a custom company logo"
            };
            Layout.SetComponentPosition(selectorButton, 2, 3, 1, 1);
            selectorButton.OnClicked += selectorButton_OnClicked;

            Label companyColorLabel = new Label(GUI, Layout, "Color", GUI.DefaultFont);
            Layout.SetComponentPosition(companyColorLabel, 0, 4, 1, 1);

            CompanyColorPanel = new ColorPanel(GUI, Layout) {CurrentColor = DefaultColor};
            Layout.SetComponentPosition(CompanyColorPanel, 1, 4, 1, 1);
            CompanyColorPanel.OnClicked += CompanyColorPanel_OnClicked;

            Button apply = new Button(GUI, Layout, "Continue", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.Check));
            Layout.SetComponentPosition(apply, 2, 9, 1, 1);

            apply.OnClicked += apply_OnClicked;

            Button back = new Button(GUI, Layout, "Back", GUI.DefaultFont, Button.ButtonMode.ToolButton, GUI.Skin.GetSpecialFrame(GUISkin.Tile.LeftArrow));
            Layout.SetComponentPosition(back, 1, 9, 1, 1);

            back.OnClicked += back_onClicked;

            base.OnEnter();
        }
Example #40
0
        /// <summary>
        /// <see cref="ImagePanel.ImageSelected"/> listener
        /// </summary>
        /// <param name="sender">The <see cref="ImagePanel"/></param>
        /// <param name="e"><see cref="ImageSelectedEventArgs"/> specifying the selection (or -1)</param>
        private void imagePanel_ImageSelected(object sender, EventArgs e)
        {
            // get the selection
            selectedIndex = ((ImageSelectedEventArgs) e).ImageIndex ;
            // remove the listener
            imagePanel.ImageSelected -= new EventHandler(imagePanel_ImageSelected);
            // close the drop-dwon, we are done
            wfes.CloseDropDown() ;

            imagePanel.Dispose() ;
            imagePanel = null ;
        }