예제 #1
0
        private void AddBackButton()
        {
            OxButton backButton = new OxButton("..");

            backButton.clicked += BackButton_clicked;
            AddItems(backButton);
        }
예제 #2
0
 public OxScrollbar(Vector2 position, Vector2 size) : base(position, size)
 {
     ApplyAppearanceFromResources(this, "Textures/OxGUI/Element2", true, false, false);
     scrubButton            = new OxButton();
     scrubButton.parentInfo = new ParentInfo(this);
     scrubButton.dragged   += ScrubButton_dragged;
 }
예제 #3
0
        private void AddFiles()
        {
            string searchPattern = "";

            for (int i = 0; i < extensions.Count; i++)
            {
                searchPattern += "*." + extensions[i];
                if (i < extensions.Count - 1)
                {
                    searchPattern += "|";
                }
            }
            string[] files = new string[0];
            if (searchPattern.Length > 0)
            {
                files = Directory.GetFiles(currentDirectory, searchPattern, SearchOption.TopDirectoryOnly);
            }
            else
            {
                files = Directory.GetFiles(currentDirectory);
            }
            foreach (string file in files)
            {
                string   shortednedFile = OxHelpers.GetLastPartInAbsolutePath(file);
                OxButton fileButton     = new OxButton(shortednedFile);
                AddItems(fileButton);
            }
        }
예제 #4
0
 private void AddDrives()
 {
     string[] drives = Directory.GetLogicalDrives();
     foreach (string drive in drives)
     {
         OxButton driveButton = new OxButton(OxHelpers.PathConvention(drive));
         driveButton.clicked += DirectoryButton_clicked;
         AddItems(driveButton);
     }
 }
예제 #5
0
 public OxListFileSelectorPrompt(Vector2 position, Vector2 size, string startingDir) : base(position, size, startingDir)
 {
     acceptButton = new OxButton("Accept");
     acceptButton.elementFunction = OxHelpers.ElementType.Accept;
     acceptButton.parentInfo      = new ParentInfo(this, new Rect(position, size));
     acceptButton.clicked        += promptButton_clicked;
     cancelButton = new OxButton("Cancel");
     cancelButton.elementFunction = OxHelpers.ElementType.Cancel;
     cancelButton.parentInfo      = new ParentInfo(this, new Rect(position, size));
     cancelButton.clicked        += promptButton_clicked;
 }
예제 #6
0
        private void AddDirectories()
        {
            string[] directories = Directory.GetDirectories(currentDirectory);
            foreach (string directory in directories)
            {
                string shortenedDirectory = OxHelpers.GetLastPartInAbsolutePath(directory);

                OxButton dirButton = new OxButton(shortenedDirectory + "/");
                dirButton.clicked += DirectoryButton_clicked;
                AddItems(dirButton);
            }
        }
예제 #7
0
 public OxCheckbox(Vector2 position, Vector2 size, string text, bool checkboxChecked) : base(position, size)
 {
     this.text            = text;
     this.checkboxChecked = checkboxChecked;
     ApplyAppearanceFromResources(this, "Textures/OxGUI/Panel2", true, false, false);
     highlightedChanged += OxCheckbox_highlightedChanged;
     pressed            += OxCheckbox_pressed;
     clicked            += OxCheckbox_clicked;
     checkbox            = new OxButton();
     check = new OxButton();
     ApplyAppearanceFromResources(checkbox, "Textures/OxGUI/Checkbox/");
     ApplyAppearanceFromResources(check, "Textures/OxGUI/Check", true, false, false);
     label = new OxLabel();
 }
예제 #8
0
        public OxPanel AddTab(string name)
        {
            OxButton tabButton = new OxButton(name);

            tabButton.clicked += TabButton_clicked;
            tabButton.ClearAllAppearances();
            ApplyAppearanceFromResources(tabButton, "Textures/OxGUI/Element3");
            tabs.AddItems(tabButton);

            Rect    tabPanelDimensions = CalculateTabPanelDimensions();
            OxPanel tabPanel           = new OxPanel(new Vector2(tabPanelDimensions.x, tabPanelDimensions.y), new Vector2(tabPanelDimensions.width, tabPanelDimensions.height));

            tabPanel.parentInfo = new ParentInfo(this);
            tabPanel.anchor     = (OxHelpers.Anchor.Top | OxHelpers.Anchor.Bottom | OxHelpers.Anchor.Left | OxHelpers.Anchor.Right);
            tabPanel.ClearAllAppearances();
            ApplyAppearanceFromResources(tabPanel, "Textures/OxGUI/Element4", true, false, false);
            items.Add(tabPanel);

            if (selectedIndex < 0)
            {
                selectedIndex = tabs.IndexOf(tabButton); tabs.SelectItem(tabButton);
            }
            return(tabPanel);
        }
예제 #9
0
        private void CreateContainerButtons()
        {
            Rect group = new Rect(position, size);

            for (int i = 0; i < containerButtons.Length; i++)
            {
                containerButtons[i] = new OxButton();
                containerButtons[i].ClearAllAppearances();
                containerButtons[i].parentInfo = new ParentInfo(this, group);
                if (i == ((int)OxHelpers.Alignment.Top))
                {
                    containerButtons[i].elementFunction = OxHelpers.ElementType.Position_Changer;
                }
                else if (i == ((int)OxHelpers.Alignment.Center))
                {
                    containerButtons[i].elementFunction = OxHelpers.ElementType.None;
                }
                else
                {
                    containerButtons[i].elementFunction = OxHelpers.ElementType.Size_Changer;
                }
                containerButtons[i].dragged += ContainerButton_dragged;
            }
        }