Exemplo n.º 1
0
            public PopupWindow()
            {
                Color bg = new Color(85, 87, 83);
                Color fg = new Color(211, 215, 207);

                EventBox box = new EventBox();

                vbox = new VBox();

                box.ButtonPressEvent += HandleButtonEvent;

                box.Add(vbox);

                win.Decorated   = false;
                win.BorderWidth = 6;

                win.SetPosition(WindowPosition.CenterAlways);

                image             = new Gtk.Image();
                label             = new Label();
                label.CanFocus    = false;
                label.Wrap        = true;
                urlLabel          = new LinkLabel();
                urlLabel.Clicked += HandleClick;

                win.Add(box);

                win.ModifyBg(StateType.Normal, bg);
                label.ModifyFg(StateType.Normal, fg);
                box.ModifyBg(StateType.Normal, bg);
                urlLabel.ModifyBg(StateType.Selected, bg);
                urlLabel.ModifyBg(StateType.Normal, bg);

                vbox.PackStart(image, true, true, 0);
                vbox.PackStart(label, false, false, 0);
                vbox.PackStart(urlLabel, false, false, 0);

                vbox.Spacing = 6;
                box.ShowAll();
            }
Exemplo n.º 2
0
        public static void Main()
        {
            Application.Init ();

            //Create the new window
            Window myWindow = new Window ("");
            myWindow.Resize (300, 300);
            myWindow.SetPosition (WindowPosition.Center);
            myWindow.ModifyBg (StateType.Normal, new Gdk.Color (174, 229, 218));

            //Creamos una etiqueta

            Label label = new Label ();
            label.Text = "Mi 1.º aplicación con GTK";

            //Añadimos la etiqueta al formulario
            myWindow.Add (label);

            //Ver todo
            myWindow.ShowAll ();

            Application.Run ();
        }
Exemplo n.º 3
0
        public void Start()
        {
            window = new Window(WindowType.Toplevel);
            window.Move(10, 60);
            window.Resize(230, 700);
            window.Title = "Toolbar";
            window.Deletable = false;
            window.ModifyBg(StateType.Normal, new Gdk.Color(182, 195, 205));

            Fixed fix = new Fixed();

            openButton = new Button();
            openButton.Label = "Open Images";
            openButton.SetSizeRequest(100, 30);
            openButton.TooltipText = "Shortcut: " + keymap["open images"].ToString();
            openButton.Name = "open images";
            openButton.Clicked += OperatorButtonClicked;

            saveButton = new Button();
            saveButton.Label = "Save Collage";
            saveButton.SetSizeRequest(100, 30);
            saveButton.TooltipText = "Shortcut: " + keymap["save collage"].ToString();
            saveButton.Name = "save collage";
            saveButton.Clicked += OperatorButtonClicked;

            deleteButton = new Button();
            deleteButton.Label = "Delete";
            deleteButton.SetSizeRequest(100, 30);
            deleteButton.TooltipText = "Shortcut: " + keymap["delete images"].ToString();
            deleteButton.Name = "delete images";
            deleteButton.Clicked += OperatorButtonClicked;

            changeAspectRatioButton = new Button();
            changeAspectRatioButton.Label = "Aspect Ratio";
            changeAspectRatioButton.SetSizeRequest(100, 30);
            changeAspectRatioButton.TooltipText = "Shortcut: " + keymap["change aspect ratio"].ToString();
            changeAspectRatioButton.Name = "change aspect ratio";
            changeAspectRatioButton.Clicked += OperatorButtonClicked;

            autoPositionButton = new Button();
            autoPositionButton.Label = "Auto Position";
            autoPositionButton.SetSizeRequest(100, 30);
            autoPositionButton.TooltipText = "Shortcut: " + keymap["auto position"].ToString();
            autoPositionButton.Name = "auto position";
            autoPositionButton.Clicked += OperatorButtonClicked;

            changeBackgroundColorButton = new Button();
            changeBackgroundColorButton.Label = "Background";
            changeBackgroundColorButton.SetSizeRequest(100, 30);
            changeBackgroundColorButton.TooltipText = "Shortcut: " + keymap["change background color"].ToString();
            changeBackgroundColorButton.Name = "change background color";
            changeBackgroundColorButton.Clicked += OperatorButtonClicked;

            setBackwardButton = new Button();
            setBackwardButton.Label = "Set Backward";
            setBackwardButton.SetSizeRequest(100, 30);
            setBackwardButton.TooltipText = "Shortcut: " + keymap["set backward"].ToString();
            setBackwardButton.Name = "set backward";
            setBackwardButton.Clicked += OperatorButtonClicked;

            setForwardButton = new Button();
            setForwardButton.Label = "Set Forward";
            setForwardButton.SetSizeRequest(100, 30);
            setForwardButton.TooltipText = "Shortcut: " + keymap["set forward"].ToString();
            setForwardButton.Name = "set forward";
            setForwardButton.Clicked += OperatorButtonClicked;

            setAsBackgroundButton = new Button();
            setAsBackgroundButton.Label = "Set Background";
            setAsBackgroundButton.SetSizeRequest(100, 30);
            setAsBackgroundButton.TooltipText = "Shortcut: " + keymap["set as background"].ToString();
            setAsBackgroundButton.Name = "set as background";
            setAsBackgroundButton.Clicked += OperatorButtonClicked;

            setToFrontButton = new Button();
            setToFrontButton.Label = "Set to Front";
            setToFrontButton.SetSizeRequest(100, 30);
            setToFrontButton.TooltipText = "Shortcut: " + keymap["set to front"].ToString();
            setToFrontButton.Name = "set to front";
            setToFrontButton.Clicked += OperatorButtonClicked;

            clearButton = new Button();
            clearButton.Label = "Clear Collage";
            clearButton.SetSizeRequest(100, 30);
            clearButton.TooltipText = "Shortcut: " + keymap["clear collage"].ToString();
            clearButton.Name = "clear collage";
            clearButton.Clicked += OperatorButtonClicked;

            selectAllButton = new Button();
            selectAllButton.Label = "Select All";
            selectAllButton.SetSizeRequest(100, 30);
            selectAllButton.TooltipText = "Shortcut: " + keymap["select all"].ToString();
            selectAllButton.Name = "select all";
            selectAllButton.Clicked += OperatorButtonClicked;

            undoButton = new Button();
            undoButton.Label = "Undo";
            undoButton.SetSizeRequest(100, 30);
            undoButton.TooltipText = "Shortcut: " + keymap["undo"].ToString();
            undoButton.Name = "undo";
            undoButton.Clicked += OperatorButtonClicked;

            redoButton = new Button();
            redoButton.Label = "Redo";
            redoButton.SetSizeRequest(100, 30);
            redoButton.TooltipText = "Shortcut: " + keymap["redo"].ToString();
            redoButton.Name = "redo";
            redoButton.Clicked += OperatorButtonClicked;

            stayOnTopCheckbutton = new CheckButton();
            stayOnTopCheckbutton.Label = "Stay on Top";
            stayOnTopCheckbutton.Toggled += StayOnTopToogled;

            // place objects in window
            fix.Put(openButton, 10, 20); fix.Put(saveButton, 120, 20);
            fix.Put(deleteButton, 10, 55); fix.Put(changeAspectRatioButton, 120, 55);
            fix.Put(autoPositionButton, 10, 90); fix.Put(changeBackgroundColorButton, 120, 90);

            fix.Put(setBackwardButton, 10, 140); fix.Put(setForwardButton, 120, 140);
            fix.Put(setAsBackgroundButton, 10, 175); fix.Put(setToFrontButton, 120, 175);
            fix.Put(clearButton, 10, 210); fix.Put(selectAllButton, 120, 210);

            fix.Put(undoButton, 10, 260); fix.Put(redoButton, 120, 260);

            fix.Put(stayOnTopCheckbutton, 10, 300);

            window.Add(fix);
            window.ShowAll();
        }
Exemplo n.º 4
0
        private static void Init()
        {
            _random = new Random();

            InitializeLua();

            Application.Init();
            if (!GLib.Thread.Supported)
            {
                GLib.Thread.Init();
            }
            Gdk.Threads.Init();

            Gdk.Threads.Enter();

            _window = new Gtk.Window(Globals.WINDOW_NAME);
            _window.SetDefaultSize(Globals.WIDTH, Globals.HEIGHT);
            _window.AppPaintable     = true;
            _window.DoubleBuffered   = false;
            _window.DeleteEvent     += OnWinDelete;
            _window.KeyPressEvent   += OnKeyPress;
            _window.KeyReleaseEvent += OnKeyRelease;
            //_window.ConfigureEvent += OnWindowConfigure;

            DrawingArea da = new DrawingArea();

            da.ExposeEvent += OnExposed;

            Gdk.Color col = new Gdk.Color(0, 0, 0);
            _window.ModifyBg(StateType.Normal, col);
            da.ModifyBg(StateType.Normal, col);

            GLib.Timeout.Add(33, new GLib.TimeoutHandler(Graphics.TimedDraw));

            _window.Add(da);
            _window.ShowAll();

            Gdk.Threads.Leave();

            Graphics.Init();    // depends on _window being initialized
            Item.Init();
            Enemy.Init();       // depends on Globals ctor
            Weapon.Init();      // depends on Globals ctor
            Armor.Init();       // depends on Globals ctor
            Accessory.Init();   // depends on Globals ctor
            Materia.Init();     // depends on Globals ctor
            Character.Init();   // depends on [Weapons|Armor|Materia].Init()
            Globals.Init();     // depends on Character.Init()
            MenuScreen.Init();  // depends on Globals.Init()
            Inventory.Init();   // depends on a whole lot of things
            Spell.Init();       // depends on Globals ctor
            Materiatory.Init(); // depends on Materia.Init()

            int time = Int32.Parse(Globals.SaveGame.SelectSingleNode("//time").InnerText);

            _clock = new Clock(time); // depends on Globals ctor

            // Go to Main Menu
            _state = MainMenu;

            // Go to new Battle
            //GoToBattleState();

            // Go to Post-Battle
            //List<IItem> i = new List<IItem>();
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["potion"]);
            //PostBattle = new PostBattleState(234, 12, 1200, i);
            //_state = PostBattle;

            _state.Init();

            if (Globals.Party[0] == null && Globals.Party[1] == null && Globals.Party[2] == null)
            {
                throw new GamedataException("No character in party!");
            }

            // Level-up demo
            //using (StreamWriter w = new StreamWriter(@"c:\scripts\test.txt"))
            //{
            //    while (Character.Cloud.Level < 98)
            //    {
            //        Character.Cloud.GainExperience(Character.Cloud.ToNextLevel + 10);
            //        w.WriteLine(Character.Cloud.ToString());
            //    }
            //    w.Flush();
            //}
        }
Exemplo n.º 5
0
        private static void Init()
        {
            _random = new Random();

            InitializeLua();

            Application.Init();
            if (!GLib.Thread.Supported)
                GLib.Thread.Init();
            Gdk.Threads.Init();

            Gdk.Threads.Enter();

            _window = new Gtk.Window(Globals.WINDOW_NAME);
            _window.SetDefaultSize(Globals.WIDTH, Globals.HEIGHT);
            _window.AppPaintable = true;
            _window.DoubleBuffered = false;
            _window.DeleteEvent += OnWinDelete;
            _window.KeyPressEvent += OnKeyPress;
            _window.KeyReleaseEvent += OnKeyRelease;
            //_window.ConfigureEvent += OnWindowConfigure;

            DrawingArea da = new DrawingArea();
            da.ExposeEvent += OnExposed;

            Gdk.Color col = new Gdk.Color(0, 0, 0);
            _window.ModifyBg(StateType.Normal, col);
            da.ModifyBg(StateType.Normal, col);

            GLib.Timeout.Add(33, new GLib.TimeoutHandler(Graphics.TimedDraw));

            _window.Add(da);
            _window.ShowAll();

            Gdk.Threads.Leave();

            Graphics.Init();    // depends on _window being initialized
            Item.Init();
            Enemy.Init();       // depends on Globals ctor
            Weapon.Init();      // depends on Globals ctor
            Armor.Init();       // depends on Globals ctor
            Accessory.Init();   // depends on Globals ctor
            Materia.Init();     // depends on Globals ctor
            Character.Init();   // depends on [Weapons|Armor|Materia].Init()
            Globals.Init();     // depends on Character.Init()
            MenuScreen.Init();  // depends on Globals.Init()
            Inventory.Init();   // depends on a whole lot of things
            Spell.Init();       // depends on Globals ctor
            Materiatory.Init(); // depends on Materia.Init()

            int time = Int32.Parse(Globals.SaveGame.SelectSingleNode("//time").InnerText);
            _clock = new Clock(time); // depends on Globals ctor

            // Go to Main Menu
            _state = MainMenu;

            // Go to new Battle
            //GoToBattleState();

            // Go to Post-Battle
            //List<IItem> i = new List<IItem>();
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["powersource"]);
            //i.Add(Item.ItemTable["potion"]);
            //PostBattle = new PostBattleState(234, 12, 1200, i);
            //_state = PostBattle;

            _state.Init();

            if (Globals.Party[0] == null && Globals.Party[1] == null && Globals.Party[2] == null)
                throw new GamedataException("No character in party!");

            // Level-up demo
            //using (StreamWriter w = new StreamWriter(@"c:\scripts\test.txt"))
            //{
            //    while (Character.Cloud.Level < 98)
            //    {
            //        Character.Cloud.GainExperience(Character.Cloud.ToNextLevel + 10);
            //        w.WriteLine(Character.Cloud.ToString());
            //    }
            //    w.Flush();
            //}
        }