Ejemplo n.º 1
0
		public AutoHideBox (DockFrame frame, DockItem item, Gtk.PositionType pos, int size)
		{
			this.position = pos;
			this.frame = frame;
			this.targetSize = size;
			horiz = pos == PositionType.Left || pos == PositionType.Right;
			startPos = pos == PositionType.Top || pos == PositionType.Left;
			Events = Events | Gdk.EventMask.EnterNotifyMask | Gdk.EventMask.LeaveNotifyMask;
			
			Box fr;
			CustomFrame cframe = new CustomFrame ();
			switch (pos) {
				case PositionType.Left: cframe.SetMargins (1, 1, 0, 1); break;
				case PositionType.Right: cframe.SetMargins (1, 1, 1, 0); break;
				case PositionType.Top: cframe.SetMargins (0, 1, 1, 1); break;
				case PositionType.Bottom: cframe.SetMargins (1, 0, 1, 1); break;
			}
			EventBox sepBox = new EventBox ();
			cframe.Add (sepBox);
			
			if (horiz) {
				fr = new HBox ();
				sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorW; };
				sepBox.WidthRequest = gripSize;
			} else {
				fr = new VBox ();
				sepBox.Realized += delegate { sepBox.GdkWindow.Cursor = resizeCursorH; };
				sepBox.HeightRequest = gripSize;
			}
			
			sepBox.Events = EventMask.AllEventsMask;
			
			if (pos == PositionType.Left || pos == PositionType.Top)
				fr.PackEnd (cframe, false, false, 0);
			else
				fr.PackStart (cframe, false, false, 0);

			Add (fr);
			ShowAll ();
			Hide ();
			
			scrollable = new ScrollableContainer ();
			scrollable.ScrollMode = false;
			scrollable.Show ();

			if (item.Widget.Parent != null) {
				((Gtk.Container)item.Widget.Parent).Remove (item.Widget);
			}

			item.Widget.Show ();
			scrollable.Add (item.Widget);
			fr.PackStart (scrollable, true, true, 0);
			
			sepBox.ButtonPressEvent += OnSizeButtonPress;
			sepBox.ButtonReleaseEvent += OnSizeButtonRelease;
			sepBox.MotionNotifyEvent += OnSizeMotion;
			sepBox.ExposeEvent += OnGripExpose;
			sepBox.EnterNotifyEvent += delegate { insideGrip = true; sepBox.QueueDraw (); };
			sepBox.LeaveNotifyEvent += delegate { insideGrip = false; sepBox.QueueDraw (); };
		}
		public CanvasExample () {
			Gtk.Window win = new Gtk.Window ("Canvas example");
			win.DeleteEvent += new DeleteEventHandler (Window_Delete);

			VBox vbox = new VBox (false, 0);
			win.Add (vbox);

			vbox.PackStart (new Label ("Drag - move object.\n" +
						   "Double click - change color\n" +
						   "Right click - delete object"),
					false, false, 0);
			
			canvas = new Canvas ();
			canvas.SetSizeRequest (width, height);
			canvas.SetScrollRegion (0.0, 0.0, (double) width, (double) height);
			vbox.PackStart (canvas, false, false, 0);

			HBox hbox = new HBox (false, 0);
			vbox.PackStart (hbox, false, false, 0);

			Button add_button = new Button ("Add an object");
			add_button.Clicked += new EventHandler (AddObject);
			hbox.PackStart (add_button, false, false, 0);

			Button quit_button = new Button ("Quit");
			quit_button.Clicked += new EventHandler (Quit);
			hbox.PackStart (quit_button, false, false, 0);

			win.ShowAll ();
		}
Ejemplo n.º 3
0
		public void Clear ()
		{
			if (contentBox != null)
				contentBox.Destroy ();
			
			noContentLabel = new Label ();
			noContentLabel.Text = noContentMessage;
			noContentLabel.Xalign = 0F;
			noContentLabel.Justify = Justification.Left;
			noContentLabel.SetPadding (6, 6);
			addButton = new Button ();
			addButton.Label = addMessage;
//			addButton.Relief = ReliefStyle.None;
			addButton.Clicked += delegate {
				OnCreateNew (EventArgs.Empty);
			};
			
			contentBox = new VBox ();
			contentBox.PackStart (this.noContentLabel, true, true, 6);
			var hbox = new HBox ();
			hbox.PackStart (addButton, false, false, 0);
			contentBox.PackEnd (hbox, false, false, 0);
			
			PackStart (contentBox, true, true, 6);
			
			ShowAll ();
		}
Ejemplo n.º 4
0
        public Dialog(VariableSet variables)
            : base("Splitter", variables)
        {
            var vbox = new VBox(false, 12) {BorderWidth = 12};
              VBox.PackStart(vbox, true, true, 0);

              var table = new GimpTable(4, 2)
            {ColumnSpacing = 6, RowSpacing = 6};
              vbox.PackStart(table, false, false, 0);

              var hbox = new HBox(false, 6);
              table.Attach(hbox, 0, 2, 0, 1);

              hbox.Add(new Label("f(x, y):"));
              hbox.Add(new GimpEntry(GetVariable<string>("formula")));
              hbox.Add(new Label("= 0"));

              table.Attach(CreateLayerFrame("Layer 1", "translate_1_x", "translate_1_y",
                    "rotate_1"), 0, 1, 1, 2);

              table.Attach(CreateLayerFrame("Layer 2", "translate_2_x", "translate_2_y",
                    "rotate_2"), 1, 2, 1, 2);

              table.Attach(new GimpCheckButton(_("_Merge visible layers"),
                       GetVariable<bool>("merge")), 0, 1, 3, 4);

              table.Attach(CreateAdvancedOptions(), 1, 2, 3, 4);

              var keep = new GimpComboBox(GetVariable<int>("keep_layer"),
                  new string[]{_("Both Layers"),
                           _("Layer 1"), _("Layer 2")});
              table.AttachAligned(0, 5, _("Keep:"), 0.0, 0.5, keep, 1, true);
        }
	private void ShowLogFileButton(){
		HBox box = new HBox();
        box.PackStart(logFileButImage, true, true, 0);
        box.PackStart(logFileButLabel, true, true, 0);
        setSensorLogNameButton.Add(box);
		setSensorLogNameButton.ShowAll();	
	}
Ejemplo n.º 6
0
        public ListPage(Notebook notebook, ModulesTreeInfo module)
        {
            this.notebook = notebook;
            this.module = module;

            headerbox = new HBox();
            headerlabel = new Label(module.Text);
            headerbox.PackStart(headerlabel);
            //Image img = new Image("gtk-close", IconSize.Menu);
            close_img = ImageManager.GetImage("Images.close-button.png");
            //close_img = new Image("gtk-close", IconSize.Menu);
            btnCloseTab = new Button(close_img);
            btnCloseTab.BorderWidth = 0;
            btnCloseTab.Relief = ReliefStyle.None;
            //btnCloseTab.WidthRequest = 19;
            //btnCloseTab.HeightRequest = 19;
            btnCloseTab.Clicked += delegate { this.Dispose(); };
            headerbox.PackStart(btnCloseTab);
            headerbox.ShowAll();

            tableview = new DataTableView(module);
            this.Add(tableview);
            this.ShowAll();

            notebook.AppendPage(this, headerbox);
            notebook.SetTabReorderable(this, true);
        }
        public AboutMonoDevelopTabPage ()
        {
            Label label = new Label();
            label.Markup = String.Format (
                "<b>{0}</b>\n    {1}", 
                GettextCatalog.GetString ("Version"), 
                BuildVariables.PackageVersion == BuildVariables.PackageVersionLabel ? BuildVariables.PackageVersionLabel : String.Format ("{0} ({1})", 
                BuildVariables.PackageVersionLabel, 
                BuildVariables.PackageVersion));
            HBox hBoxVersion = new HBox ();
            hBoxVersion.PackStart (label, false, false, 5);
            this.PackStart (hBoxVersion, false, true, 0);

            label = null;
            label = new Label ();
            label.Markup = GettextCatalog.GetString ("<b>License</b>\n    {0}", GettextCatalog.GetString ("Released under the GNU Lesser General Public License."));
            HBox hBoxLicense = new HBox ();
            hBoxLicense.PackStart (label, false, false, 5);
            this.PackStart (hBoxLicense, false, true, 5);

            label = null;
            label = new Label ();
            label.Markup = GettextCatalog.GetString ("<b>Copyright</b>\n    (c) 2000-2003 by icsharpcode.net\n    (c) 2004-{0} by MonoDevelop contributors", 2009);
            HBox hBoxCopyright = new HBox ();
            hBoxCopyright.PackStart (label, false, false, 5);
            this.PackStart (hBoxCopyright, false, true, 5);

            this.ShowAll ();
        }
Ejemplo n.º 8
0
        public AboutPintaTabPage()
        {
            Label label = new Label ();
            label.Markup = String.Format (
                "<b>{0}</b>\n    {1}",
                Catalog.GetString ("Version"),
                "1.2");

            HBox hBoxVersion = new HBox ();
            hBoxVersion.PackStart (label, false, false, 5);
            this.PackStart (hBoxVersion, false, true, 0);

            label = null;
            label = new Label ();
            label.Markup = string.Format ("<b>{0}</b>\n    {1}", Catalog.GetString ("License"), Catalog.GetString ("Released under the MIT X11 License."));
            HBox hBoxLicense = new HBox ();
            hBoxLicense.PackStart (label, false, false, 5);
            this.PackStart (hBoxLicense, false, true, 5);

            label = null;
            label = new Label ();
            label.Markup = string.Format ("<b>{0}</b>\n    (c) 2010-2011 {1}", Catalog.GetString ("Copyright"), Catalog.GetString ("by Pinta contributors"));
            HBox hBoxCopyright = new HBox ();
            hBoxCopyright.PackStart (label, false, false, 5);
            this.PackStart (hBoxCopyright, false, true, 5);

            this.ShowAll ();
        }
Ejemplo n.º 9
0
		public DockFrame ()
		{
			GtkWorkarounds.FixContainerLeak (this);

			dockBarTop = new DockBar (this, Gtk.PositionType.Top);
			dockBarBottom = new DockBar (this, Gtk.PositionType.Bottom);
			dockBarLeft = new DockBar (this, Gtk.PositionType.Left);
			dockBarRight = new DockBar (this, Gtk.PositionType.Right);
			
			container = new DockContainer (this);
			HBox hbox = new HBox ();
			hbox.PackStart (dockBarLeft, false, false, 0);
			hbox.PackStart (container, true, true, 0);
			hbox.PackStart (dockBarRight, false, false, 0);
			mainBox = new VBox ();
			mainBox.PackStart (dockBarTop, false, false, 0);
			mainBox.PackStart (hbox, true, true, 0);
			mainBox.PackStart (dockBarBottom, false, false, 0);
			Add (mainBox);
			mainBox.ShowAll ();
			mainBox.NoShowAll = true;
			CompactGuiLevel = 2;
			UpdateDockbarsVisibility ();

			DefaultVisualStyle = new DockVisualStyle ();
		}
Ejemplo n.º 10
0
		public static Widget GetButton (Action action, bool label)
		{
			Widget w = action.CreateIcon (IconSize.Button);
			if (label) {
				HBox box = new HBox ();
				box.PackStart (w, false, false, 0);
				Label l = new Label ();
				l.Markup = "<small>" + action.Label + "</small>";
				box.PackStart (l);
				w = box;
			}
			Button button;
			if (action is ToggleAction) {
				ToggleButton toggle = new ToggleButton ();
				toggle.Active = ((ToggleAction)action).Active;
				button = toggle;
			} else {
				button = new Button ();
			}
			button.Relief = ReliefStyle.None;
			button.Add (w);
			w.ShowAll ();

			action.ConnectProxy (button);
			tips.SetTip (button, action.Tooltip, String.Empty);
			return button;
		}
Ejemplo n.º 11
0
        // create the TopBar widget
        public TopBar()
        {
            // create the widgets
            Button add_button = new Button (Stock.Add);
            Button remove_button = new Button (Stock.Remove);
            Label search_label = new Label ("Search:");

            Image clear_image = new Image (Stock.Clear, IconSize.Menu);
            clear_box.Add (clear_image);

            // hook up the widget events
            add_button.Clicked += add_clicked;
            remove_button.Clicked += remove_clicked;
            search.Changed += search_changed;
            clear_box.ButtonReleaseEvent += clear_released;
            clear_box.Realized += clear_realized;

            // homogeneous button box
            HBox button_box = new HBox (true, 0);
            button_box.PackStart (add_button, false, true, 0);
            button_box.PackStart (remove_button, false, true, 0);

            // pack widgets
            this.PackStart (button_box, false, true, 0);
            this.PackStart (search_label, false, false, 5);
            this.PackStart (search, true, true, 0);
            this.PackStart (clear_box, false, false, 0);
        }
Ejemplo n.º 12
0
		public DockItemContainer (DockFrame frame, DockItem item)
		{
			this.item = item;

			mainBox = new VBox ();
			Add (mainBox);

			mainBox.ResizeMode = Gtk.ResizeMode.Queue;
			mainBox.Spacing = 0;
			
			ShowAll ();
			
			mainBox.PackStart (item.GetToolbar (PositionType.Top).Container, false, false, 0);
			
			HBox hbox = new HBox ();
			hbox.Show ();
			hbox.PackStart (item.GetToolbar (PositionType.Left).Container, false, false, 0);
			
			contentBox = new HBox ();
			contentBox.Show ();
			hbox.PackStart (contentBox, true, true, 0);
			
			hbox.PackStart (item.GetToolbar (PositionType.Right).Container, false, false, 0);
			
			mainBox.PackStart (hbox, true, true, 0);
			
			mainBox.PackStart (item.GetToolbar (PositionType.Bottom).Container, false, false, 0);
		}
Ejemplo n.º 13
0
        public ProgressDialog(Window parent)
            : base()
        {
            this.Title = "Updating iPod...";
            this.HasSeparator = false;
            this.TransientFor = parent;
            this.DefaultWidth = 400;

            VBox vbox = new VBox (false, 6);
            vbox.BorderWidth = 6;

            HBox hbox = new HBox (false, 6);

            Gdk.PixbufAnimation animation = new Gdk.PixbufAnimation (Assembly.GetExecutingAssembly (),
                                                                     "ipod.gif");
            hbox.PackStart (new Gtk.Image (animation), false, false, 0);

            label = new Label ("");
            label.Xalign = 0.0f;
            label.UseMarkup = true;

            SetEllipsize (label);
            hbox.PackStart (label, true, true, 0);

            vbox.PackStart (hbox, true, false, 0);

            bar = new ProgressBar ();
            vbox.PackStart (bar, true, false, 0);

            VBox.PackStart (vbox, false, false, 0);
            VBox.ShowAll ();

            notify = new ThreadNotify (new ReadyEvent (OnNotify));
        }
Ejemplo n.º 14
0
        public ConfigurationDialog (LCDService plugin)
        {
            this.plugin = plugin;
            Title = AddinManager.CurrentLocalizer.GetString ("LCD configuration");
            BorderWidth = 5;
            HasSeparator = false;
            Resizable = false;

            VBox lcdproc_box = new VBox ();

            HBox host_box = new HBox ();
            host_box.PackStart (new Label (AddinManager.CurrentLocalizer.GetString ("Hostname:")), false, false, 3);
            host_entry = new Entry ();
            host_box.PackStart (host_entry, true, true, 3);
            host_entry.Text = this.plugin.Host;
            host_entry.Changed += new EventHandler (Host_Changed);

            HBox port_box = new HBox ();
            port_box.PackStart (new Label (AddinManager.CurrentLocalizer.GetString ("Port:")), false, false, 3);
            port_spin = new SpinButton (1, 65535, 1);
            port_box.PackStart (port_spin, true, true, 3);
            port_spin.Value = this.plugin.Port;
            port_spin.Changed += new EventHandler (Port_Changed);

            Frame lcdproc_frame = new Frame (AddinManager.CurrentLocalizer.GetString ("LCDProc Daemon:"));
            lcdproc_box.PackStart (host_box);
            lcdproc_box.PackStart (port_box);
            lcdproc_frame.Add (lcdproc_box);
            lcdproc_frame.ShowAll ();

            VBox.PackStart (lcdproc_frame, false, false, 3);
            AddButton (Stock.Close, ResponseType.Close);
        }
		public void AddMessage (string msg, IconId icon)
		{
			if (lastImage != null) {
				HSeparator sep = new HSeparator ();
				sep.Show ();
				msgBox.PackStart (sep, false, false, 0);
				lastImage.IconSize = Gtk.IconSize.Menu;
			}
			
			HBox box = new HBox ();
			box.Spacing = 12;
			Alignment imgBox = new Alignment (0, 0, 0, 0);
			var img = new ImageView (icon, lastImage != null ? Gtk.IconSize.Menu : IconSize.Dialog);
			imgBox.Add (img);
			lastImage = img;
			box.PackStart (imgBox, false, false, 0);
			Label lab = new Label (msg);
			lab.UseUnderline = false;
			lab.Xalign = 0;
			lab.Yalign = 0;
			lab.Wrap = true;
			lab.WidthRequest = 500;
			box.PackStart (lab, true, true, 0);
			msgBox.PackStart (box, false, false, 0);
			box.ShowAll ();
		}
Ejemplo n.º 16
0
		public DialogError(string message, Exception e, Window parent) : base("Error", parent, DialogFlags.Modal, Stock.Ok, ResponseType.Ok)
		{
			HBox hbox = new HBox();
			Image icon = new Image(Stock.DialogError,IconSize.Dialog);
			Label label = new Label(message);
			Expander exp = new Expander("Details");
			ScrolledWindow sw = new ScrolledWindow();
			TextView tview = new TextView();
			
			hbox.BorderWidth = 6;
			hbox.Spacing = 6;
			label.SetAlignment(0f, 0.5f);
			exp.BorderWidth = 6;
			tview.Buffer.Text = e.Message;
			tview.Buffer.Text += "\n";
			tview.Buffer.Text += e.StackTrace;
			
			sw.Add(tview);
			exp.Add(sw);
			hbox.PackStart(icon, false, false, 0);
			hbox.PackStart(label, true, true, 0);
			this.VBox.PackStart(hbox, false, false, 0);
			this.VBox.PackStart(exp, true, true, 0);
			this.ShowAll();
			
		}
Ejemplo n.º 17
0
        public BDialog(string aName, Gtk.Window aParent, string aText)
            : base(aName, aParent, Gtk.DialogFlags.NoSeparator)
        {
            // setup dialog
              this.Modal = true;
              this.BorderWidth = 6;
              this.HasSeparator = false;
              this.Resizable = false;
              this.VBox.Spacing=12;

              // graphic items
              hbox = new Gtk.HBox();
              		Gtk.VBox labelBox = new VBox();
              		label = new Gtk.Label();
              		image = new Gtk.Image();

            hbox.Spacing=12;
            hbox.BorderWidth=6;
            this.VBox.Add(hbox);

            // set-up image
            image.Yalign=0.0F;
              hbox.Add(image);

            // set-up label
            label.Yalign=0.0F;
            label.Xalign=0.0F;
            label.UseMarkup=true;
            label.Wrap=true;
            label.Markup=aText;

            // add to dialog
            labelBox.Add(label);
            hbox.Add(labelBox);
        }
Ejemplo n.º 18
0
        private void initGui()
        {
            //create the layout
            VBox layout       = new VBox();
            //add the list
            ScrolledWindow sw = new ScrolledWindow();
            sw.AddWithViewport( list );
            layout.PackStart  ( sw   );
            //add the add/edit/remove buttons
            HBox hbox = new HBox();
            hbox.PackStart  ( BtnAdd    );
            hbox.PackStart  ( BtnEdit   );
            hbox.PackStart  ( BtnRemove );
            hbox.PackStart  ( BtnSort   );
            layout.PackStart( hbox, false, true, 0 );
            //add the checkboxes
            hbox = new HBox();
            hbox.PackStart( ChkOwnerDrawned  , true, true, 0 );
            hbox.PackStart( ChkIsCheckBoxList, true, true, 0 );
            hbox.PackStart( ChkIsEditable    , true, true, 0 );
            hbox.PackStart( ChkDragAndDrop   , true, true, 0 );
            //

            layout.PackStart( hbox, false, true, 0 );
            //add layout
            this.Add( layout );
        }
Ejemplo n.º 19
0
        void BuildDialogUI()
        {
            // Add an HBox to the dialog's VBox.
              HBox hbox = new HBox (false, 8);
              hbox.BorderWidth = 8;
              this.VBox.PackStart (hbox, false, false, 0);

              // Add an Image widget to the HBox using a stock 'info' icon.
              Image stock = new Image (Stock.DialogInfo, IconSize.Dialog);
              hbox.PackStart (stock, false, false, 0);

              // Here we are using a Table to contain the other widgets.
              // Notice that the Table is added to the hBox.
              Table table = new Table (2, 2, false);
              table.RowSpacing = 4;
              table.ColumnSpacing = 4;
              hbox.PackStart (table, true, true, 0);

              Label label = new Label ("_Username");
              table.Attach (label, 0, 1, 0, 1);
              table.Attach (usernameEntry, 1, 2, 0, 1);
              label.MnemonicWidget = usernameEntry;

              label = new Label ("_Password");
              table.Attach (label, 0, 1, 1, 2);
              table.Attach (passwordEntry , 1, 2, 1, 2);
              label.MnemonicWidget = passwordEntry ;
              hbox.ShowAll ();

              // Add OK and Cancel Buttons.
              this.AddButton(Stock.Ok, ResponseType.Ok);
              this.AddButton(Stock.Cancel, ResponseType.Cancel);
        }
Ejemplo n.º 20
0
    protected void OnButtonClicked(object sender, EventArgs e)
    {
        if (sender == button1)
        {

            Gtk.FileChooserDialog dialog = new Gtk.FileChooserDialog ("Choose item...", this, FileChooserAction.Open, "Cancel",  ResponseType.Cancel, "Insert Spacer",  ResponseType.None, "Add", ResponseType.Accept);

            Gtk.Alignment align = new Alignment (1, 0, 0, 1);
            Gtk.Frame frame = new Frame ("Position");
            Gtk.HBox hbox = new HBox (false, 4);

            RadioButton rbRight;
            rbRight = new RadioButton ("Right");
            hbox.PackEnd(rbRight, false, false, 1);
            hbox.PackEnd(new RadioButton (rbRight, "Left"), false, false, 1);

            frame.Add (hbox);
            align.Add (frame);
            align.ShowAll ();
            dialog.ExtraWidget = align;

            ResponseType response = (ResponseType)dialog.Run ();
            if (response == ResponseType.Accept) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>" + dialog.Filename + "</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>' && /bin/sleep 1 &&/usr/bin/killall Dock");
            } else if (response == ResponseType.None) {
                RunCommand ("defaults write com.apple.dock " + GetAlign(dialog.ExtraWidget) + " -array-add '{tile-data={}; tile-type=\"spacer-tile\";}' && /bin/sleep 1 &&/usr/bin/killall Dock");
            }
            dialog.Destroy ();

        }
    }
Ejemplo n.º 21
0
        public static void AddNewWordToDic(object sender, EventArgs e)
        {
            var win = new Gtk.Window("Přidej slovo");
            win.SetPosition( WindowPosition.Mouse );
            Label l = new Label();
            l.Text = "Vloží slovo do aktuálně načteného slovníku, avšak nezmění zdroj (např. soubor dic.txt )";

            Entry entry = new Entry();
            Button b = new Button("Přidej");
            VBox vbox = new VBox();
            HBox hbox = new HBox();
            vbox.BorderWidth = 10;

            vbox.PackStart( l );
            vbox.PackEnd( hbox );

            hbox.PackStart( entry );
            hbox.PackEnd( b );

            b.Clicked += delegate {
                game.dictionary.Add( entry.Text );
                win.HideAll();
                win.Destroy();
                win.Dispose();
            };

            win.Add(vbox);
            win.ShowAll();
        }
Ejemplo n.º 22
0
        public InsightWindow(SourceEditorView control, Project project, string fileName)
            : base(WindowType.Popup)
        {
            this.control             = control;
            this.fileName = fileName;
            this.project = project;
            /*System.Drawing.Point caretPos  = control.ActiveTextAreaControl.TextArea.Caret.Position;
            System.Drawing.Point visualPos = new System.Drawing.Point(control.ActiveTextAreaControl.TextArea.TextView.GetDrawingXPos(caretPos.Y, caretPos.X) + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.X,
                      (int)((1 + caretPos.Y) * control.ActiveTextAreaControl.TextArea.TextView.FontHeight) - control.ActiveTextAreaControl.TextArea.VirtualTop.Y - 1 + control.ActiveTextAreaControl.TextArea.TextView.DrawingPosition.Y);*/

            //control.ActiveTextAreaControl.Caret.PositionChanged += new EventHandler(CaretOffsetChanged);
            //			control.TextAreaPainter.IHaveTheFocusChanged += focusEventHandler;

            AddEvents ((int) (Gdk.EventMask.KeyPressMask));
            this.SkipPagerHint = true;
            this.SkipTaskbarHint = true;
            this.Decorated = false;
            this.BorderWidth = 2;
            this.TypeHint = Gdk.WindowTypeHint.Dialog;

            desc = new Gtk.Label ("");
            current = new Gtk.Label ("");
            max = new Gtk.Label ("");
            HBox mainBox = new HBox (false, 2);
            mainBox.PackStart (new Gtk.Image (Gtk.Stock.GotoTop, Gtk.IconSize.Menu), false, false, 2);
            mainBox.PackStart (current, false, false, 2);
            mainBox.PackStart (new Gtk.Label (" of "), false, false, 2);
            mainBox.PackStart (max, false, false, 2);
            mainBox.PackStart (new Gtk.Image (Gtk.Stock.GotoBottom, Gtk.IconSize.Menu), false, false, 2);
            mainBox.PackStart (desc);
            Gtk.Frame framer = new Gtk.Frame ();
            framer.Add (mainBox);
            this.Add (framer);
        }
Ejemplo n.º 23
0
        public ParameterInformationWindow()
        {
            desc = new Gtk.Label ("");
            desc.Xalign = 0;
            desc.Wrap = true;
            count = new Gtk.Label ("");

            mainBox = new HBox (false, 2);
            mainBox.BorderWidth = 3;

            HBox arrowHBox = new HBox ();

            goPrev = new Gtk.Arrow (Gtk.ArrowType.Up, ShadowType.None);
            arrowHBox.PackStart (goPrev, false, false, 0);
            arrowHBox.PackStart (count, false, false, 0);
            goNext = new Gtk.Arrow (Gtk.ArrowType.Down, ShadowType.None);
            arrowHBox.PackStart (goNext, false, false, 0);

            VBox vBox = new VBox ();
            vBox.PackStart (arrowHBox, false, false, 0);

            mainBox.PackStart (vBox, false, false, 0);
            mainBox.PackStart (desc, true, true, 0);
            mainBox.ShowAll ();
            this.Add (mainBox);

            EnableTransparencyControl = true;
        }
Ejemplo n.º 24
0
        public SparkleWindow()
            : base("")
        {
            BorderWidth    = 0;
            IconName       = "folder-sparkleshare";
            Resizable      = true;
            WindowPosition = WindowPosition.Center;

            SetDefaultSize (640, 480);

            Buttons = CreateButtonBox ();

            HBox = new HBox (false, 6);

                string image_path = SparkleHelpers.CombineMore (Defines.DATAROOTDIR, "sparkleshare",
                    "pixmaps", "side-splash.png");

                Image side_splash = new Image (image_path);

                VBox = new VBox (false, 0);

                    Wrapper = new VBox (false, 0) {
                        BorderWidth = 30
                    };

                VBox.PackStart (Wrapper, true, true, 0);
                VBox.PackStart (Buttons, false, false, 0);

            HBox.PackStart (side_splash, false, false, 0);
            HBox.PackStart (VBox, true, true, 0);

            base.Add (HBox);
        }
Ejemplo n.º 25
0
		public DockFrame ()
		{
			shadedContainer = new ShadedContainer ();
			
			dockBarTop = new DockBar (this, Gtk.PositionType.Top);
			dockBarBottom = new DockBar (this, Gtk.PositionType.Bottom);
			dockBarLeft = new DockBar (this, Gtk.PositionType.Left);
			dockBarRight = new DockBar (this, Gtk.PositionType.Right);
			
			container = new DockContainer (this);
			HBox hbox = new HBox ();
			hbox.PackStart (dockBarLeft, false, false, 0);
			hbox.PackStart (container, true, true, 0);
			hbox.PackStart (dockBarRight, false, false, 0);
			mainBox = new VBox ();
			mainBox.PackStart (dockBarTop, false, false, 0);
			mainBox.PackStart (hbox, true, true, 0);
			mainBox.PackStart (dockBarBottom, false, false, 0);
			Add (mainBox);
			mainBox.ShowAll ();
			mainBox.NoShowAll = true;
			CompactGuiLevel = 2;
			dockBarTop.UpdateVisibility ();
			dockBarBottom.UpdateVisibility ();
			dockBarLeft.UpdateVisibility ();
			dockBarRight.UpdateVisibility ();
		}
		public DockToolbarFrame ()
		{
			vbox = new VBox ();
			Add (vbox);
			
			DockToolbarPanel topPanel = new DockToolbarPanel (this, Placement.Top);
			DockToolbarPanel bottomPanel = new DockToolbarPanel (this, Placement.Bottom);
			DockToolbarPanel leftPanel = new DockToolbarPanel (this, Placement.Left);
			DockToolbarPanel rightPanel = new DockToolbarPanel (this, Placement.Right);

			panels = new DockToolbarPanel [4];
			panels [(int)Placement.Top] = topPanel;
			panels [(int)Placement.Bottom] = bottomPanel;
			panels [(int)Placement.Left] = leftPanel;
			panels [(int)Placement.Right] = rightPanel;
		
			vbox.PackStart (topPanel, false, false, 0);
			
			HBox hbox = new HBox ();
			contentBox = new VBox ();

			hbox.PackStart (leftPanel, false, false, 0);
			hbox.PackStart (contentBox, true, true, 0);
			hbox.PackStart (rightPanel, false, false, 0);
			
			vbox.PackStart (hbox, true, true, 0);
			vbox.PackStart (bottomPanel, false, false, 0);
			
			this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask; 
			ShowAll ();
		}
		public ParameterInformationWindow ()
		{
			heading = new Gtk.Label ("");
			heading.Xalign = 0;
			heading.Wrap = false;
			
			desc = new DescriptionLabel ();
			count = new Gtk.Label ("");

			var mainBox = new HBox (false, 2);
			
			HBox arrowHBox = new HBox ();

			goPrev = new Gtk.Arrow (Gtk.ArrowType.Up, ShadowType.None);
			arrowHBox.PackStart (goPrev, false, false, 0);
			arrowHBox.PackStart (count, false, false, 0);
			goNext = new Gtk.Arrow (Gtk.ArrowType.Down, ShadowType.None);
			arrowHBox.PackStart (goNext, false, false, 0);

			VBox vBox = new VBox ();
			vBox.PackStart (arrowHBox, false, false, 0);
			
			mainBox.PackStart (vBox, false, false, 0);
			mainBox.PackStart (heading, true, true, 0);
			
			var vBox2 = new VBox ();
			vBox2.BorderWidth = 3;
			vBox2.PackStart (mainBox, false, false, 0);
			vBox2.PackStart (desc, true, true, 4);
			Add (vBox2);
			EnableTransparencyControl = true;
			ShowAll ();
		}
Ejemplo n.º 28
0
	static void Main ()
	{
		Application.Init ();
		Gtk.Window w = new Gtk.Window ("System.Drawing and Gtk#");

		// Custom widget sample
		a = new PrettyGraphic ();

		// Event-based drawing
		b = new DrawingArea ();
		b.ExposeEvent += new ExposeEventHandler (ExposeHandler);
		b.SizeAllocated += new SizeAllocatedHandler (SizeAllocatedHandler);

		Button c = new Button ("Quit");
		c.Clicked += new EventHandler (quit);

		MovingText m = new MovingText ();
		
		Box box = new HBox (true, 0);
		box.Add (a);
		box.Add (b);
		box.Add (m);
		box.Add (c);
		w.Add (box);
		
		w.ShowAll ();
		Application.Run ();
	}
Ejemplo n.º 29
0
        public SetupWindow()
            : base("SparkleShare Setup")
        {
            SetWmclass ("SparkleShare", "SparkleShare");

            IconName       = "org.sparkleshare.SparkleShare";
            Resizable      = false;
            WindowPosition = WindowPosition.CenterAlways;
            Deletable      = false;
            TypeHint       = Gdk.WindowTypeHint.Dialog;

            SetSizeRequest (400, 400);

            DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };

                VBox layout_vertical = new VBox (false, 16);
            layout_vertical.BorderWidth = 16;

                    this.content_area    = new EventBox ();
                    this.option_area = new EventBox ();

                    this.buttons = CreateButtonBox ();

                HBox layout_actions = new HBox (false , 16);

                layout_actions.PackStart (this.option_area, true, true, 0);
                layout_actions.PackStart (this.buttons, false, false, 0);

                layout_vertical.PackStart (this.content_area, true, true, 0);
                layout_vertical.PackStart (layout_actions, false, false, 0);

            base.Add (layout_vertical);
        }
Ejemplo n.º 30
0
		public DemoMain ()
		{
			SetupDefaultIcon ();
		   	window = new Gtk.Window ("Gtk# Code Demos");
		   	window.SetDefaultSize (600, 400);
			window.DeleteEvent += new DeleteEventHandler (WindowDelete);

			HBox hbox = new HBox (false, 0);
			window.Add (hbox);

			treeView = CreateTree ();
			hbox.PackStart (treeView, false, false, 0);

			Notebook notebook = new Notebook ();
			hbox.PackStart (notebook, true, true, 0);

			notebook.AppendPage (CreateText (infoBuffer, false), new Label ("_Info"));
			TextTag heading = new TextTag ("heading");
			heading.Font = "Sans 18";
			infoBuffer.TagTable.Add (heading);

			notebook.AppendPage (CreateText (sourceBuffer, true), new Label ("_Source"));

			window.ShowAll ();
		}
Ejemplo n.º 31
0
    private Gtk.Widget CreateObjectList()
    {
        Gtk.HBox hbox = new Gtk.HBox(false, 0);

        Gtk.Adjustment vadjustment = new Gtk.Adjustment(0, 0, 100, 1, 10, 10);
        Gtk.VScrollbar scrollbar   = new Gtk.VScrollbar(vadjustment);

        hbox.PackStart(new ObjectListWidget(this, vadjustment), true, true, 0);
        hbox.PackEnd(scrollbar, false, true, 0);
        return(hbox);
    }
        internal void SetToolbar(DocumentToolbar toolbar)
        {
            if (info.Repository.SupportsRevertRevision)
            {
                toolbar.Add(revertButton);
            }

            if (info.Repository.SupportsRevertToRevision)
            {
                toolbar.Add(revertToButton);
            }
            toolbar.Add(refreshButton);

            Gtk.HBox a = new Gtk.HBox();
            a.PackEnd(searchEntry, false, false, 0);
            toolbar.Add(a, true);

            toolbar.ShowAll();
        }
Ejemplo n.º 33
0
        // This can be a warp that isn't in the warp list (as when editing a warp destination).
        public void SetSelectedWarp(Warp warp)
        {
            if (_selectedWarp == warp)
            {
                return;
            }
            _selectedWarp = warp;

            valueEditorContainer.Foreach((c) => c.Dispose());

            if (warp == null)
            {
                warpSourceFrame.Hide();
                return;
            }

            int index = GetWarpIndex(warp);

            warpSourceBox.SelectedIndex = index;

            Gtk.HBox hbox = new Gtk.HBox();

            if (warp.WarpSourceType == WarpSourceType.Pointed)
            {
                warpSourceTypeLabel.Text = "<b>Type</b>: Position Warp";
            }
            else
            {
                warpSourceTypeLabel.Text = "<b>Type</b>: Screen Warp";
            }

            warpSourceTypeLabel.UseMarkup = true;

            sourceEditor = new ValueReferenceEditor(Project, warp.ValueReferenceGroup);

            valueEditorContainer.Add(sourceEditor);
            warpSourceFrame.ShowAll();

            if (SelectedWarpEvent != null)
            {
                SelectedWarpEvent(this, null);
            }
        }
        public SongDuplicateView()
        {
            Gtk.ScrolledWindow Scroll = new Gtk.ScrolledWindow();
            Gtk.TreeView       Tree   = new Gtk.TreeView();
            Gtk.VBox           vbox   = new Gtk.VBox(false, 1);
            Gtk.HBox           hbox   = new Gtk.HBox(false, 1);
            Tree.RowActivated += OnRowClicked;
            //Buttons For Header
            Gtk.Button removeButton = new Gtk.Button();
            removeButton.Label    = AddinManager.CurrentLocalizer.GetString("Remove Selected Songs");
            removeButton.Clicked += OnRemoveCommand;
            Gtk.Button deleteButton = new Gtk.Button();
            deleteButton.Label    = AddinManager.CurrentLocalizer.GetString("Delete Selected Songs");
            deleteButton.Clicked += OnDeleteCommand;

            //Create 5 columns, first column is a checkbox, next 4 are text boxes
            Gtk.CellRendererToggle selectCell = new Gtk.CellRendererToggle();
            selectCell.Activatable = true;
            selectCell.Toggled    += OnSelectToggled;
            Tree.AppendColumn(AddinManager.CurrentLocalizer.GetString("Select"), selectCell, "active", 0);
            Tree.AppendColumn(AddinManager.CurrentLocalizer.GetString("Track Number"), new Gtk.CellRendererText(), "text", 1);
            Tree.AppendColumn(AddinManager.CurrentLocalizer.GetString("Song Title"), new Gtk.CellRendererText(), "text", 2);
            Tree.AppendColumn(AddinManager.CurrentLocalizer.GetString("Artist"), new Gtk.CellRendererText(), "text", 3);
            Tree.AppendColumn(AddinManager.CurrentLocalizer.GetString("Album"), new Gtk.CellRendererText(), "text", 4);
            Tree.AppendColumn(AddinManager.CurrentLocalizer.GetString("File"), new Gtk.CellRendererText(), "text", 5);
            // Remove From Library, Delete From Drive, Song Name, Artist Name, Album Name, Formated URI, Actual URI, Database Track ID
            MusicListStore = new Gtk.ListStore(typeof(bool), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(string), typeof(int));
            Tree.Model     = MusicListStore;
            //Pack the Tree in a scroll window
            Scroll.Add(Tree);
            //Pack the buttons in a hbox
            hbox.PackStart(removeButton, false, false, 0);
            hbox.PackStart(deleteButton, false, false, 0);
            //pack the hbox->buttons and Scroll->Tree in a Vbox, tell the Scroll window to Expand and Fill the vbox
            vbox.PackStart(hbox, false, false, 0);
            vbox.PackStart(Scroll, true, true, 0);
            //pack the vbox in the Rounded Frame
            Add(vbox);
            //Finally, show everything
            ShowAll();
        }
        // ============================================
        // PRIVATE Methods
        // ============================================
        private void InitializeObject(bool download)
        {
            this.hbox = new Gtk.HBox(false, 2);
            this.Add(this.hbox);

            // Initialize Image Logo
            this.imageLogo = StockIcons.GetImage(((download == true) ? "Download": "Upload"));
            this.hbox.PackStart(this.imageLogo, false, false, 2);

            // Initialize Delete Button
            this.deleteButton          = new Gtk.Button(StockIcons.GetImage("DlTrash"));
            this.deleteButton.Relief   = ReliefStyle.None;
            this.deleteButton.Clicked += new EventHandler(OnDeleteClicked);
            this.hbox.PackEnd(this.deleteButton, false, false, 2);

            // Initialize VBox
            this.vbox = new Gtk.VBox(false, 2);
            this.hbox.PackStart(this.vbox, true, true, 2);

            // Initialize Name
            this.labelName           = new Gtk.Label();
            this.labelName.UseMarkup = true;
            this.labelName.Xalign    = 0.0f;
            this.vbox.PackStart(this.labelName, false, false, 2);

            // Initialize Status "5.8Mb of 8.1Mb (at 316.1Kb/s)"
            this.labelStatus           = new Gtk.Label();
            this.labelStatus.UseMarkup = true;
            this.labelStatus.Xalign    = 0.0f;
            this.vbox.PackStart(this.labelStatus, false, false, 2);

            // Initialize ProgressBar
            this.progressBar = new Gtk.ProgressBar();
            this.vbox.PackStart(this.progressBar, false, false, 2);

            this.vbox.PackStart(new Gtk.HSeparator(), false, false, 2);

            this.ShowAll();
        }
Ejemplo n.º 36
0
    private Gtk.Widget CreateTileList()
    {
        Gtk.VBox box = new Gtk.VBox();
        box.Homogeneous = false;

        Gtk.Adjustment vadjustment = new Gtk.Adjustment(0, 0, 100, 1, 10, 10);

        tileList = new TileListWidget(this, selection, vadjustment);
        TilegroupSelector selector = new TilegroupSelector(this, tileList);

        Gtk.HBox hbox = new Gtk.HBox(false, 0);

        Gtk.VScrollbar scrollbar = new Gtk.VScrollbar(vadjustment);

        hbox.PackStart(tileList, true, true, 0);
        hbox.PackEnd(scrollbar, false, true, 0);

        box.PackStart(selector, false, true, 0);
        box.PackStart(hbox, true, true, 0);

        return(box);
    }
Ejemplo n.º 37
0
    private Gtk.HBox createHBoxStartAndLabel(Task t, Pixbuf pixbuf)
    {
        Gtk.Label l    = new Gtk.Label(t.ToString());
        HBox      hbox = new Gtk.HBox(false, 10);
        Button    button_start;

        Gtk.Image image = new Gtk.Image();
        image.Pixbuf = pixbuf;

        button_start          = new Gtk.Button(image);
        button_start.Clicked += new EventHandler(button_start_clicked);

        hbox.PackStart(button_start, false, false, 0);
        hbox.PackStart(l, false, false, 0);

        list_tasks_fixed.Add(t);
        LogB.Information("createBoxStart....");
        LogB.Information(t.ToString());
        list_buttons_start.Add(button_start);

        return(hbox);
    }
Ejemplo n.º 38
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        /// Create New Login Dialog
        public Login()
        {
            Resizable = false;
            SetDefaultSize(240, 355);
            DefaultIcon = StockIcons.GetPixbuf("NyFolderIcon");

            // Initialize Dialog Options
            Title = Info.Name + " Login";
            Logo  = StockIcons.GetPixbuf("NyFolderLogo", 240, 140);

            // Initialize Menu Manager
            this.menuManager = new LoginDialog.MenuManager();

            // Initialize Menu's HBox
            this.hboxMenu = new Gtk.HBox(false, 0);
            VBox.PackStart(this.hboxMenu, false, false, 0);
            this.VBox.ReorderChild(this.hboxMenu, 0);

            /// Initialize MenuBar
            this.hboxMenu.PackStart(this.MenuBar, false, false, 0);
            this.menuManager.Activated += new EventHandler(OnMenuActivated);
            this.AddAccelGroup(this.menuManager.AccelGroup);

            // Remember Password (CheckButton)
            checkRememberPassword.Image = new Gtk.Image(Stock.Save, IconSize.Button);

            // Secure Authentication (CheckButton)
            checkSecureAuth          = new CheckButton("Use Secure Authentication");
            checkSecureAuth.Active   = true;
            checkSecureAuth.Image    = StockIcons.GetImage("Lock", 22);
            checkSecureAuth.Toggled += new EventHandler(OnCheckSecureAuthToggled);
            VBox.PackStart(checkSecureAuth, false, false, 2);

            // Initialize Dialog Buttons
            AddButton(Gtk.Stock.Ok, ResponseType.Ok);
            AddButton(Gtk.Stock.Quit, ResponseType.Close);

            ShowAll();
        }
Ejemplo n.º 39
0
        private void build()
        {
            //this.img1 = new Image(Stock.Dnd);
            this.sbutton1               = new SpinButton(0.0, 200.0, 1.0);
            this.sbutton1.Value         = this.vital;
            this.sbutton1.WidthRequest  = 50;
            this.sbutton1.ValueChanged += delegate(object sender, EventArgs e) {
                this.calc_total();
            };
            this.label1 = new Label(this.vitalname);
            this.label1.WidthRequest = 100;
            this.label2 = new Label("racial");
            this.label2.WidthRequest = 50;
            this.label3 = new Label("total");
            this.label3.WidthRequest = 50;
            this.entry2              = new Entry("0");
            this.entry2.IsEditable   = false;
            this.entry2.WidthRequest = 50;
            this.entry3              = new Entry(this.sbutton1.Value.ToString());
            this.entry3.IsEditable   = false;
            this.entry3.WidthRequest = 50;

            this.sbutton1.TooltipText = "Player's value";
            this.entry2.TooltipText   = this.label1.Text + " racial bonus";
            this.entry3.TooltipText   = this.label1.Text + " total (racial + player)";

            this.hbox1             = new HBox(false, 1);
            this.hbox1.Homogeneous = false;
            this.hbox1.PackStart(this.label1, false, false, 0);
            this.hbox1.PackStart(this.sbutton1, false, false, 0);
            this.hbox1.PackStart(new HSeparator(), false, false, 2);
            this.hbox1.PackStart(this.label2, false, false, 0);
            this.hbox1.PackStart(this.entry2, false, false, 0);
            this.hbox1.PackStart(new HSeparator(), false, false, 2);
            this.hbox1.PackStart(this.label3, false, false, 0);
            this.hbox1.PackStart(this.entry3, false, false, 0);
            this.Add(hbox1);
        }
Ejemplo n.º 40
0
        ///<summary>Create a DataViewDisplay</summary>
        public DataViewDisplay(DataView dv)
        {
            dataView = dv;

            // load the default layout from the data directory
            layout = new Layout(FileResourcePath.GetDataPath("bless-default.layout"));

            // initialize scrollbar
            Gtk.Adjustment
                adj = new Gtk.Adjustment(0.0, 0.0, 1.0, 1.0, 10.0, 0.0);
            vscroll = new Gtk.VScrollbar(adj);

            adj.ValueChanged += OnScrolled;

            // initialize drawing area
            drawingArea                 = new Gtk.DrawingArea();
            drawingArea.Realized       += OnRealized;
            drawingArea.ExposeEvent    += OnExposed;
            drawingArea.ConfigureEvent += OnConfigured;
            drawingArea.ModifyBg(StateType.Normal, new Gdk.Color(0xff, 0xff, 0xff));

            // add events that we want to handle
            drawingArea.AddEvents((int)Gdk.EventMask.ButtonPressMask);
            drawingArea.AddEvents((int)Gdk.EventMask.ButtonReleaseMask);
            drawingArea.AddEvents((int)Gdk.EventMask.PointerMotionMask);
            drawingArea.AddEvents((int)Gdk.EventMask.PointerMotionHintMask);
            drawingArea.AddEvents((int)Gdk.EventMask.KeyPressMask);
            drawingArea.AddEvents((int)Gdk.EventMask.KeyReleaseMask);

            drawingArea.CanFocus = true;     // needed to catch key events

            hbox = new Gtk.HBox();

            hbox.PackStart(drawingArea, true, true, 0);
            hbox.PackStart(vscroll, false, false, 0);

            this.PackStart(hbox);
        }
Ejemplo n.º 41
0
        public ThemedIconBrowser(Gtk.Window parent) :
            base("Select a Themed Icon", parent, Gtk.DialogFlags.Modal,
                 Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                 Gtk.Stock.Ok, Gtk.ResponseType.Ok)
        {
            HasSeparator     = false;
            BorderWidth      = 12;
            VBox.Spacing     = 18;
            VBox.BorderWidth = 0;

            DefaultResponse = Gtk.ResponseType.Ok;

            Gtk.HBox hbox = new Gtk.HBox(false, 12);
            VBox.PackStart(hbox, false, false, 0);

            entry            = new Gtk.Entry();
            entry.Activated += DoFind;
            hbox.PackStart(entry);

            Gtk.Button button = new Gtk.Button(Gtk.Stock.Find);
            button.Clicked += DoFind;
            hbox.PackStart(button, false, false, 0);

            ScrolledWindow scwin = new Gtk.ScrolledWindow();

            scwin.SizeRequested += ScrolledWindowSizeRequested;
            VBox.PackStart(scwin, true, true, 0);
            scwin.SetPolicy(Gtk.PolicyType.Never, Gtk.PolicyType.Automatic);
            scwin.ShadowType = Gtk.ShadowType.In;

            list = new ThemedIconList();
            scwin.Add(list);
            list.SelectionChanged += ListSelectionChanged;
            list.Activated        += ListActivated;
            SetResponseSensitive(Gtk.ResponseType.Ok, false);

            VBox.ShowAll();
        }
Ejemplo n.º 42
0
        public void OnAddPls()
        {
            Hyena.Log.Information("add playlist");
            Gtk.Dialog dlg = new Gtk.Dialog();
            dlg.Title = "Add Playlist";
            Gtk.Entry pls = new Gtk.Entry();
            pls.WidthChars = 40;
            Gtk.Label lbl = new Gtk.Label("Playlist name:");
            Gtk.HBox  hb  = new Gtk.HBox();
            hb.PackStart(lbl, false, false, 1);
            hb.PackEnd(pls);
            dlg.VBox.PackStart(hb);
            dlg.AddButton(Gtk.Stock.Cancel, 0);
            dlg.AddButton(Gtk.Stock.Ok, 1);
            dlg.VBox.ShowAll();
            string plsname = "";

            while (plsname == "")
            {
                int response = dlg.Run();
                if (response == 0)
                {
                    dlg.Hide();
                    dlg.Destroy();
                    return;
                }
                else
                {
                    plsname = pls.Text.Trim();
                }
            }
            dlg.Hide();
            dlg.Destroy();
            _pls = _col.NewPlayList(plsname);
            _model.Reload();
            _pls_model.SetPlayList(_pls);
        }
Ejemplo n.º 43
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public UpdateInfo() : base("Update Informations", null, DialogFlags.Modal)
        {
            Gtk.HBox hbox = new Gtk.HBox(false, 4);
            this.VBox.PackStart(hbox, true, true, 4);

            // Add Close Button
            AddButton(Gtk.Stock.Close, ResponseType.Close);

            // Update Logo
            Gtk.Image updateLogo = StockIcons.GetImage("UpdateNotifier");
            updateLogo.Yalign = 0;
            updateLogo.Xpad   = 2;
            hbox.PackStart(updateLogo, false, false, 2);

            // Update Informations
            this.vbox = new Gtk.VBox(false, 2);
            hbox.PackStart(this.vbox, true, true, 2);

            // Title
            this.title           = new Gtk.Label("<span size='x-large'><b>Update Informations</b></span>");
            this.title.UseMarkup = true;
            this.vbox.PackStart(this.title, false, false, 2);

            // Version
            this.version           = new Gtk.Label();
            this.version.Xalign    = 0;
            this.version.UseMarkup = true;
            this.vbox.PackStart(this.version, false, false, 2);

            // Infos
            this.infos        = new Gtk.Label();
            this.infos.Xalign = 0;
            this.infos.Yalign = 0;
            this.vbox.PackStart(this.infos, true, true, 2);

            this.ShowAll();
        }
Ejemplo n.º 44
0
        private void Build()
        {
            var mainVox = new Gtk.VBox();

            var removeButton = new Gtk.Button(Gtk.Stock.Remove);
            var editButton   = new Gtk.Button(Gtk.Stock.Edit);

            removeButton.Clicked += this.OnClickRemove;
            editButton.Clicked   += this.OnClickEdit;

            var hBox = new Gtk.HBox();

            hBox.PackStart(removeButton, false, false, 0);
            hBox.PackStart(editButton, false, false, 0);

            mainVox.PackStart(hBox, false, false, 10);

            //List
            this.notesTreeView = new TreeView(this.measurementsListStore);

            ScrolledWindow sw = new ScrolledWindow();

            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy(PolicyType.Automatic, PolicyType.Automatic);
            sw.Add(notesTreeView);

            this.AddListColumns();

            mainVox.PackStart(sw, true, true, 0);


            //Wrap
            PackStart(mainVox, true, true, 0);

            //Update state and render
            this.OnViewBuilt();
        }
Ejemplo n.º 45
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public ProgressDialog(string password) :
            base(MyInfo.Name + " Login", null, DialogFlags.Modal)
        {
            // Initialize Dialog Options
            WindowPosition = Gtk.WindowPosition.Center;

            // Initialize Dialog Events
            Response += new ResponseHandler(OnResponse);

            // Initialize Dialog Components
            AddButton(Gtk.Stock.Close, ResponseType.Close);

            Gtk.HBox hbox = new Gtk.HBox(false, 2);
            Gtk.VBox vbox = new Gtk.VBox(false, 2);
            VBox.PackStart(hbox, true, true, 2);
            hbox.PackStart(StockIcons.GetImage("Channel"), false, false, 2);
            hbox.PackStart(vbox, true, true, 2);

            // Initialize Label
            labelMessage           = new Gtk.Label("<b>Waiting for " + MyInfo.Name + " Login...</b>");
            labelMessage.UseMarkup = true;
            vbox.PackStart(labelMessage, false, false, 2);

            // Initialize ProgressBar
            progressBar = new Gtk.ProgressBar();
            vbox.PackStart(progressBar, false, false, 2);

            // Initialize Timer
            timer = GLib.Timeout.Add(100, new GLib.TimeoutHandler(ProgressTimeout));

            // Initialize UserInfo
            MyInfo.LoginChecked += new LoginEventHandler(OnLoginChecked);
            MyInfo.Login(password);

            this.ShowAll();
        }
Ejemplo n.º 46
0
        private void Build()
        {
            box = new HBox(false, 0);
            box.SetSizeRequest(40, 40);
            box.BorderWidth = 2;

            button          = new Button();
            button.Clicked += CyclePoint;

            lblpoints = new Label();
            Pango.FontDescription desc = Pango.FontDescription.FromString("Bebas Neue 14");
            lblpoints.ModifyFont(desc);
            lblpoints.Text = points[10];


            button.Add(lblpoints);
            button.ShowAll();

            box.Add(this.button);
            box.ShowAll();

            // This damn this call is anoyingly needed otherwise it shant build
            this.Add(box);
        }
        Gtk.Widget AddFeature(ISolutionItemFeature feature)
        {
            Gtk.HBox    cbox  = new Gtk.HBox();
            CheckButton check = null;

            Label fl = new Label();

            fl.Wrap         = true;
            fl.WidthRequest = 630;
            fl.Markup       = "<b>" + feature.Title + "</b>\n<small>" + feature.Description + "</small>";
            bool enabledByDefault = feature.GetSupportLevel(parentCombine, entry) == FeatureSupportLevel.Enabled;

            if (enabledByDefault)
            {
                Alignment al = new Alignment(0, 0, 0, 0);
                al.SetPadding(6, 6, 6, 6);
                al.Add(fl);
                cbox.PackStart(al, false, false, 0);
            }
            else
            {
                check       = new CheckButton();
                check.Image = fl;
                cbox.PackStart(check, false, false, 0);
                check.ModifyBg(StateType.Prelight, Style.MidColors [(int)StateType.Normal]);
                check.BorderWidth = 3;
            }
            EventBox eb = new EventBox();

            if (!enabledByDefault)
            {
                eb.Realized += delegate {
                    eb.GdkWindow.Cursor = handCursor;
                };
            }
            eb.ModifyBg(StateType.Normal, Style.MidColors[(int)StateType.Normal]);
            eb.Add(cbox);
            eb.ShowAll();
            box.PackStart(eb, false, false, 0);

            HBox fbox = new HBox();

            Gtk.Widget editor = feature.CreateFeatureEditor(parentCombine, entry);
            if (editor != null)
            {
                Label sp = new Label("");
                sp.WidthRequest = 24;
                sp.Show();
                fbox.PackStart(sp, false, false, 0);
                editor.Show();
                fbox.PackStart(editor, false, false, 0);
                box.PackStart(fbox, false, false, 0);
            }

            if (check != null)
            {
                ISolutionItemFeature f = feature;
                check.Toggled += delegate {
                    OnClickFeature(f, check, fbox, editor);
                };
            }
            else
            {
                fbox.Show();
            }
            return(editor);
        }
Ejemplo n.º 48
0
Archivo: Util.cs Proyecto: MrJoe/lat
        public HIGMessageDialog(Gtk.Window parent,
                                Gtk.DialogFlags flags,
                                Gtk.MessageType type,
                                Gtk.ButtonsType buttons,
                                string header,
                                string msg)
            : base()
        {
            HasSeparator = false;
            BorderWidth  = 5;
            Resizable    = false;
            Title        = "";

            VBox.Spacing      = 12;
            ActionArea.Layout = Gtk.ButtonBoxStyle.End;

            accel_group = new Gtk.AccelGroup();
            AddAccelGroup(accel_group);

            Gtk.HBox hbox = new Gtk.HBox(false, 12);
            hbox.BorderWidth = 5;
            hbox.Show();
            VBox.PackStart(hbox, false, false, 0);

            Gtk.Image image = null;

            switch (type)
            {
            case Gtk.MessageType.Error:
                image = new Gtk.Image(Gtk.Stock.DialogError,
                                      Gtk.IconSize.Dialog);
                break;

            case Gtk.MessageType.Question:
                image = new Gtk.Image(Gtk.Stock.DialogQuestion,
                                      Gtk.IconSize.Dialog);
                break;

            case Gtk.MessageType.Info:
                image = new Gtk.Image(Gtk.Stock.DialogInfo,
                                      Gtk.IconSize.Dialog);
                break;

            case Gtk.MessageType.Warning:
                image = new Gtk.Image(Gtk.Stock.DialogWarning,
                                      Gtk.IconSize.Dialog);
                break;
            }

            image.Show();
            hbox.PackStart(image, false, false, 0);

            Gtk.VBox label_vbox = new Gtk.VBox(false, 0);
            label_vbox.Show();
            hbox.PackStart(label_vbox, true, true, 0);

            string title = String.Format("<span weight='bold' size='larger'>{0}" +
                                         "</span>\n",
                                         header);

            Gtk.Label label;

            label           = new Gtk.Label(title);
            label.UseMarkup = true;
            label.Justify   = Gtk.Justification.Left;
            label.LineWrap  = true;
            label.SetAlignment(0.0f, 0.5f);
            label.Show();
            label_vbox.PackStart(label, false, false, 0);

            label           = new Gtk.Label(msg);
            label.UseMarkup = true;
            label.Justify   = Gtk.Justification.Left;
            label.LineWrap  = true;
            label.SetAlignment(0.0f, 0.5f);
            label.Show();
            label_vbox.PackStart(label, false, false, 0);

            switch (buttons)
            {
            case Gtk.ButtonsType.None:
                break;

            case Gtk.ButtonsType.Ok:
                AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
                break;

            case Gtk.ButtonsType.Close:
                AddButton(Gtk.Stock.Close, Gtk.ResponseType.Close, true);
                break;

            case Gtk.ButtonsType.Cancel:
                AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, true);
                break;

            case Gtk.ButtonsType.YesNo:
                AddButton(Gtk.Stock.No, Gtk.ResponseType.No, false);
                AddButton(Gtk.Stock.Yes, Gtk.ResponseType.Yes, true);
                break;

            case Gtk.ButtonsType.OkCancel:
                AddButton(Gtk.Stock.Cancel, Gtk.ResponseType.Cancel, false);
                AddButton(Gtk.Stock.Ok, Gtk.ResponseType.Ok, true);
                break;
            }

            if (parent != null)
            {
                TransientFor = parent;
            }

            if ((int)(flags & Gtk.DialogFlags.Modal) != 0)
            {
                Modal = true;
            }

            if ((int)(flags & Gtk.DialogFlags.DestroyWithParent) != 0)
            {
                DestroyWithParent = true;
            }
        }
Ejemplo n.º 49
0
    public static void Main()
    {
        app = new EventApp();

        ClutterRun.Init();
        Gtk.Application.Init();

        Gtk.Window window = new Gtk.Window(WindowType.Toplevel);
        window.Title        = "Gtk-Clutter Interaction Demo";
        window.Resizable    = true;
        window.BorderWidth  = 12;
        window.DeleteEvent += HandleDelete;
        app.window          = window;

        Gtk.VBox vbox = new Gtk.VBox(false, 12);
        window.Add(vbox);

        Gtk.Entry gtk_entry = new Gtk.Entry();
        app.gtk_entry      = gtk_entry;
        gtk_entry.Text     = "Enter some text";
        gtk_entry.Changed += delegate { app.clutter_entry.Text = app.gtk_entry.Text; };
        vbox.PackStart(gtk_entry, false, false, 0);

        Gtk.HBox hbox = new Gtk.HBox(false, 12);
        vbox.PackStart(hbox, true, true, 0);

        /* Clutter stage */
        Embed widget = new Embed();

        hbox.PackStart(widget, true, true, 0);
        app.stage       = widget.Stage as Stage;
        app.stage.Color = new Clutter.Color(125, 125, 125, 255);

        /* Main texture*/
        Texture texture = new Texture("redhand.png");

        app.hand = texture;
        app.stage.AddActor(texture);
        uint width, height;

        texture.GetSize(out width, out height);
        texture.SetPosition((int)((app.stage.Width / 2) - (width / 2)), (int)((app.stage.Height / 2) - (height / 2)));

        /* Clutter entry */
        app.clutter_entry = new Clutter.Entry("Sans 10", "", new Clutter.Color(255, 255, 255, 255));
        app.stage.AddActor(app.clutter_entry);
        app.clutter_entry.SetPosition(0, 0);
        app.clutter_entry.SetSize(500, 20);

        /* Adjustment widgets */
        vbox = new Gtk.VBox(false, 6);
        hbox.PackStart(vbox, false, false, 0);

        Gtk.VBox box = new Gtk.VBox(true, 6);
        vbox.PackStart(box, false, true, 0);

        Gtk.Label x_label = new Gtk.Label("Rotate x-axis");
        box.PackStart(x_label, true, true, 0);
        Gtk.SpinButton x_button = new Gtk.SpinButton(0, 360, 1);
        box.PackStart(x_button, true, true, 0);
        x_button.ValueChanged += delegate { app.hand.SetRotation(RotateAxis.XAxis,
                                                                 (float)app.x_button.Value,
                                                                 (int)app.hand.Height, 0, 0); };
        app.x_button = x_button;

        Gtk.Label y_label = new Gtk.Label("Rotate y-axis");
        box.PackStart(y_label, true, true, 0);
        Gtk.SpinButton y_button = new Gtk.SpinButton(0, 360, 1);
        box.PackStart(y_button, true, true, 0);
        y_button.ValueChanged += delegate { app.hand.SetRotation(RotateAxis.YAxis,
                                                                 (float)app.y_button.Value,
                                                                 0, (int)app.hand.Width / 2, 0); };
        app.y_button = y_button;

        Gtk.Label z_label = new Gtk.Label("Rotate z-axis");
        box.PackStart(z_label, true, true, 0);
        Gtk.SpinButton z_button = new Gtk.SpinButton(0, 360, 1);
        box.PackStart(z_button, true, true, 0);
        z_button.ValueChanged += delegate { app.hand.SetRotation(RotateAxis.ZAxis,
                                                                 (float)app.z_button.Value,
                                                                 (int)app.hand.Width / 2, (int)app.hand.Height / 2, 0); };
        app.z_button = z_button;

        Gtk.Label op_label = new Gtk.Label("Adjust opacity");
        box.PackStart(op_label, true, true, 0);
        Gtk.SpinButton op_button = new Gtk.SpinButton(0, 255, 1);
        op_button.Value = 255;
        box.PackStart(op_button, true, true, 0);
        op_button.ValueChanged += delegate { app.hand.Opacity = (byte)app.op_button.Value; };
        app.op_button           = op_button;

        app.stage.ShowAll();
        app.window.SetDefaultSize(800, 600);
        app.window.ShowAll();

        Gtk.Application.Run();
    }
Ejemplo n.º 50
0
        public OptionsDialog(MonoDevelop.Components.Window parentWindow, object dataObject, string extensionPath, bool removeEmptySections)
        {
            buttonCancel = new Gtk.Button(Gtk.Stock.Cancel);
            AddActionWidget(this.buttonCancel, ResponseType.Cancel);

            buttonOk = new Gtk.Button(Gtk.Stock.Ok);
            this.ActionArea.PackStart(buttonOk);
            buttonOk.Clicked += OnButtonOkClicked;

            mainHBox = new HBox();
            tree     = new TreeView();
            var sw = new ScrolledWindow();

            sw.Add(tree);
            sw.HscrollbarPolicy = PolicyType.Never;
            sw.VscrollbarPolicy = PolicyType.Automatic;
            sw.ShadowType       = ShadowType.None;

            var fboxTree = new HeaderBox();

            fboxTree.SetMargins(0, 1, 0, 1);
            fboxTree.SetPadding(0, 0, 0, 0);
            fboxTree.BackgroundColor = new Gdk.Color(255, 255, 255);
            fboxTree.Add(sw);
            mainHBox.PackStart(fboxTree, false, false, 0);

            Realized += delegate {
                fboxTree.BackgroundColor = tree.Style.Base(Gtk.StateType.Normal);
            };

            var vbox = new VBox();

            mainHBox.PackStart(vbox, true, true, 0);
            var headerBox = new HBox(false, 6);

            labelTitle        = new Label();
            labelTitle.Xalign = 0;
            textHeader        = new Alignment(0, 0, 1, 1);
            textHeader.Add(labelTitle);
            textHeader.BorderWidth = 12;
            headerBox.PackStart(textHeader, true, true, 0);

            imageHeader = new OptionsDialogHeader();
            imageHeader.Hide();
            headerBox.PackStart(imageHeader.ToGtkWidget());

            var fboxHeader = new HeaderBox();

            fboxHeader.SetMargins(0, 1, 0, 0);
            fboxHeader.Add(headerBox);
//			fbox.GradientBackround = true;
//			fbox.BackgroundColor = new Gdk.Color (255, 255, 255);
            Realized += delegate {
                var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                c.Light += 0.09;
                fboxHeader.BackgroundColor = c.ToGdkColor();
            };
            StyleSet += delegate {
                if (IsRealized)
                {
                    var c = Style.Background(Gtk.StateType.Normal).ToXwtColor();
                    c.Light += 0.09;
                    fboxHeader.BackgroundColor = c.ToGdkColor();
                }
            };
            vbox.PackStart(fboxHeader, false, false, 0);

            pageFrame = new HBox();
            var fbox = new HeaderBox();

            fbox.SetMargins(0, 1, 0, 0);
            fbox.ShowTopShadow = true;
            fbox.Add(pageFrame);
            vbox.PackStart(fbox, true, true, 0);

            this.VBox.PackStart(mainHBox, true, true, 0);

            this.removeEmptySections = removeEmptySections;
            extensionContext         = AddinManager.CreateExtensionContext();

            this.mainDataObject = dataObject;
            this.extensionPath  = extensionPath;

            if (parentWindow != null)
            {
                TransientFor = parentWindow;
            }

            ImageService.EnsureStockIconIsLoaded(emptyCategoryIcon);

            store               = new TreeStore(typeof(OptionsDialogSection));
            tree.Model          = store;
            tree.HeadersVisible = false;

            // Column 0 is used to add some padding at the left of the expander
            TreeViewColumn col0 = new TreeViewColumn();

            col0.MinWidth = 6;
            tree.AppendColumn(col0);

            TreeViewColumn col = new TreeViewColumn();
            var            crp = new CellRendererImage();

            col.PackStart(crp, false);
            col.SetCellDataFunc(crp, PixbufCellDataFunc);
            var crt = new CellRendererText();

            col.PackStart(crt, true);
            col.SetCellDataFunc(crt, TextCellDataFunc);
            tree.AppendColumn(col);

            tree.ExpanderColumn = col;

            tree.Selection.Changed += OnSelectionChanged;

            Child.ShowAll();

            InitializeContext(extensionContext);

            FillTree();
            ExpandCategories();
            RestoreLastPanel();
            this.DefaultResponse = Gtk.ResponseType.Ok;

            buttonOk.CanDefault = true;
            buttonOk.GrabDefault();

            DefaultWidth  = 960;
            DefaultHeight = 680;
        }
Ejemplo n.º 51
0
        public QueryWidget(PhotoQuery query, Db db) : base(new HBox())
        {
            box             = Child as HBox;
            box.Spacing     = 6;
            box.BorderWidth = 2;

            this.query     = query;
            query.Changed += HandleChanged;

            label = new Gtk.Label(Catalog.GetString("Find: "));
            label.Show();
            label.Ypad = 9;
            box.PackStart(label, false, false, 0);

            untagged         = new Gtk.Label(Catalog.GetString("Untagged photos"));
            untagged.Visible = false;
            box.PackStart(untagged, false, false, 0);

            comma1_label         = new Gtk.Label(", ");
            comma1_label.Visible = false;
            box.PackStart(comma1_label, false, false, 0);

            rated         = new Gtk.Label(Catalog.GetString("Rated photos"));
            rated.Visible = false;
            box.PackStart(rated, false, false, 0);

            comma2_label         = new Gtk.Label(", ");
            comma2_label.Visible = false;
            box.PackStart(comma2_label, false, false, 0);

            // Note for translators: 'Import roll' is no command, it means 'Roll that has been imported'
            rollfilter         = new Gtk.Label(Catalog.GetString("Import roll"));
            rollfilter.Visible = false;
            box.PackStart(rollfilter, false, false, 0);

            folder_query_widget         = new FolderQueryWidget(query);
            folder_query_widget.Visible = false;
            box.PackStart(folder_query_widget, false, false, 0);

            logic_widget = new LogicWidget(query, db.Tags);
            logic_widget.Show();
            box.PackStart(logic_widget, true, true, 0);

            warning_box = new Gtk.HBox();
            warning_box.PackStart(new Gtk.Label(System.String.Empty));

            Gtk.Image warning_image = new Gtk.Image("gtk-info", Gtk.IconSize.Button);
            warning_image.Show();
            warning_box.PackStart(warning_image, false, false, 0);

            clear_button = new Gtk.Button();
            clear_button.Add(new Gtk.Image("gtk-close", Gtk.IconSize.Button));
            clear_button.Clicked    += HandleClearButtonClicked;
            clear_button.Relief      = Gtk.ReliefStyle.None;
            clear_button.TooltipText = Catalog.GetString("Clear search");
            box.PackEnd(clear_button, false, false, 0);

            refresh_button = new Gtk.Button();
            refresh_button.Add(new Gtk.Image("gtk-refresh", Gtk.IconSize.Button));
            refresh_button.Clicked    += HandleRefreshButtonClicked;
            refresh_button.Relief      = Gtk.ReliefStyle.None;
            refresh_button.TooltipText = Catalog.GetString("Refresh search");
            box.PackEnd(refresh_button, false, false, 0);

            Gtk.Label warning = new Gtk.Label(Catalog.GetString("No matching photos found"));
            warning_box.PackStart(warning, false, false, 0);
            warning_box.ShowAll();
            warning_box.Spacing = 6;
            warning_box.Visible = false;

            box.PackEnd(warning_box, false, false, 0);

            warning_box.Visible = false;
        }
Ejemplo n.º 52
0
        public LogWidget(VersionControlDocumentInfo info)
        {
            this.Build();
            this.info = info;
            if (info.Document != null)
            {
                this.preselectFile = info.Item.Path;
            }

            revertButton             = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert changes from this revision"));
            revertButton.IsImportant = true;
//			revertButton.Sensitive = false;
            revertButton.Clicked += new EventHandler(RevertRevisionClicked);
            CommandBar.Insert(revertButton, -1);

            revertToButton             = new Gtk.ToolButton(new Gtk.Image("vc-revert-command", Gtk.IconSize.Menu), GettextCatalog.GetString("Revert to this revision"));
            revertToButton.IsImportant = true;
//			revertToButton.Sensitive = false;
            revertToButton.Clicked += new EventHandler(RevertToRevisionClicked);
            CommandBar.Insert(revertToButton, -1);

            Gtk.ToolItem item = new Gtk.ToolItem();
            Gtk.HBox     a    = new Gtk.HBox();
            item.Add(a);
            searchEntry = new SearchEntry();
            searchEntry.WidthRequest             = 200;
            searchEntry.ForceFilterButtonVisible = true;
            searchEntry.EmptyMessage             = GettextCatalog.GetString("Search");
            searchEntry.Changed += HandleSearchEntryFilterChanged;
            searchEntry.Ready    = true;
            searchEntry.Show();
            a.PackEnd(searchEntry, false, false, 0);
            CommandBar.Insert(item, -1);
            ((Gtk.Toolbar.ToolbarChild)CommandBar[item]).Expand = true;

            CommandBar.ShowAll();

            messageRenderer.Ellipsize = Pango.EllipsizeMode.End;
            TreeViewColumn colRevMessage = new TreeViewColumn();

            colRevMessage.Title = GettextCatalog.GetString("Message");
            var graphRenderer = new RevisionGraphCellRenderer();

            colRevMessage.PackStart(graphRenderer, false);
            colRevMessage.SetCellDataFunc(graphRenderer, GraphFunc);

            colRevMessage.PackStart(messageRenderer, true);
            colRevMessage.SetCellDataFunc(messageRenderer, MessageFunc);
            colRevMessage.Sizing = TreeViewColumnSizing.Autosize;

            treeviewLog.AppendColumn(colRevMessage);
            colRevMessage.MinWidth  = 350;
            colRevMessage.Resizable = true;


            TreeViewColumn colRevDate = new TreeViewColumn(GettextCatalog.GetString("Date"), textRenderer);

            colRevDate.SetCellDataFunc(textRenderer, DateFunc);
            colRevDate.Resizable = true;
            treeviewLog.AppendColumn(colRevDate);

            TreeViewColumn colRevAuthor = new TreeViewColumn();

            colRevAuthor.Title = GettextCatalog.GetString("Author");
            colRevAuthor.PackStart(pixRenderer, false);
            colRevAuthor.PackStart(textRenderer, true);
            colRevAuthor.SetCellDataFunc(textRenderer, AuthorFunc);
            colRevAuthor.SetCellDataFunc(pixRenderer, AuthorIconFunc);
            colRevAuthor.Resizable = true;
            treeviewLog.AppendColumn(colRevAuthor);

            TreeViewColumn colRevNum = new TreeViewColumn(GettextCatalog.GetString("Revision"), textRenderer);

            colRevNum.SetCellDataFunc(textRenderer, RevisionFunc);
            colRevNum.Resizable = true;
            treeviewLog.AppendColumn(colRevNum);

            treeviewLog.Model              = logstore;
            treeviewLog.Selection.Changed += TreeSelectionChanged;

            treeviewFiles = new FileTreeView();
            treeviewFiles.DiffLineActivated += HandleTreeviewFilesDiffLineActivated;
            scrolledwindowFiles.Child        = treeviewFiles;
            scrolledwindowFiles.ShowAll();

            changedpathstore = new TreeStore(typeof(Gdk.Pixbuf), typeof(string), // icon/file name
                                             typeof(Gdk.Pixbuf), typeof(string), // icon/operation
                                             typeof(string),                     // path
                                             typeof(string),                     // revision path (invisible)
                                             typeof(string[])                    // diff
                                             );

            TreeViewColumn colChangedFile = new TreeViewColumn();
            var            crp            = new CellRendererPixbuf();
            var            crt            = new CellRendererText();

            colChangedFile.Title = GettextCatalog.GetString("File");
            colChangedFile.PackStart(crp, false);
            colChangedFile.PackStart(crt, true);
            colChangedFile.AddAttribute(crp, "pixbuf", 2);
            colChangedFile.AddAttribute(crt, "text", 3);
            treeviewFiles.AppendColumn(colChangedFile);

            TreeViewColumn colOperation = new TreeViewColumn();

            colOperation.Title = GettextCatalog.GetString("Operation");
            colOperation.PackStart(crp, false);
            colOperation.PackStart(crt, true);
            colOperation.AddAttribute(crp, "pixbuf", 0);
            colOperation.AddAttribute(crt, "text", 1);
            treeviewFiles.AppendColumn(colOperation);

            TreeViewColumn colChangedPath = new TreeViewColumn();

            colChangedPath.Title = GettextCatalog.GetString("Path");

            diffRenderer.DrawLeft = true;
            colChangedPath.PackStart(diffRenderer, true);
            colChangedPath.SetCellDataFunc(diffRenderer, SetDiffCellData);
            treeviewFiles.AppendColumn(colChangedPath);
            treeviewFiles.Model          = changedpathstore;
            treeviewFiles.TestExpandRow += HandleTreeviewFilesTestExpandRow;
            treeviewFiles.Events        |= Gdk.EventMask.PointerMotionMask;

            textviewDetails.WrapMode = Gtk.WrapMode.Word;

            labelAuthor.Text   = "";
            labelDate.Text     = "";
            labelRevision.Text = "";
        }
Ejemplo n.º 53
0
        private void InitGui()
        {
            //genre button
            Gtk.Image square     = new Gtk.Image(null, "Wikipedia-logo-small.png");
            Gtk.HBox  genre_hbox = new HBox(false, 0);
            genre_hbox.Add(square);
            genre_hbox.Add(new Label(Catalog.GetString("Genre")));
            genre_button        = new Gtk.Button(genre_hbox);
            genre_button.Relief = ReliefStyle.None;

            // artist
            Gtk.HBox artist_hbox = new HBox(false, 0);
            artist_hbox.Add(new Gtk.Image(null, "Wikipedia-logo-small.png"));
            artist_hbox.Add(new Label(Catalog.GetString("Artist")));
            artist_button        = new Gtk.Button(artist_hbox);
            artist_button.Relief = ReliefStyle.None;

            //album button
            Gtk.HBox album_hbox = new HBox(false, 0);
            album_hbox.Add(new Gtk.Image(null, "Wikipedia-logo-small.png"));
            album_hbox.Add(new Label(Catalog.GetString("Album")));
            album_button        = new Gtk.Button(album_hbox);
            album_button.Relief = ReliefStyle.None;

            //lyrics button
            Gtk.HBox lyric_hbox = new HBox(false, 0);
            lyric_hbox.Add(new Gtk.Image(null, "lyrics.png"));
            lyric_hbox.Add(new Label(Catalog.GetString("Lyrics")));
            lyric_button        = new Gtk.Button(lyric_hbox);
            lyric_button.Relief = ReliefStyle.None;

            // Button bar
            Gtk.HButtonBox hb = new Gtk.HButtonBox();
            hb.Layout  = Gtk.ButtonBoxStyle.Start;
            hb.Spacing = 5;
            hb.Add(artist_button);
            hb.Add(album_button);
            hb.Add(genre_button);
            hb.Add(lyric_button);

            // hide/show button
            hide_show_button          = new Gtk.Button(new Gtk.Image(null, "minus.png"));
            hide_show_button.Relief   = ReliefStyle.None;
            hide_show_button.Clicked += new EventHandler(OnHideShowClicked);
            this.minimized            = false;

            //search label
            Gtk.Label search_l = new Gtk.Label();
            search_l.Markup = "<b>" + Catalog.GetString("Search") + ":</b>";

            // upper hbox
            Gtk.HBox toolbar = new Gtk.HBox(false, 5);
            toolbar.PackStart(new Gtk.Image(Stock.Info, IconSize.Menu), false, false, 5);
            toolbar.PackStart(search_l, false, false, 5);
            toolbar.PackStart(hb, true, true, 0);
            toolbar.PackStart(hide_show_button, false, false, 0);


            this.wb = new ContextBrowser();

            //main = new Gtk.VBox(false,5);
            this.PackStart(toolbar, false, false, 0);
            this.PackEnd(wb, true, true, 5);
            //this.Add(main);
            this.HeightRequest = 400;
            //hb.Show();
            //this.wb.Show();

            //this.main.Show();
            this.Show();
        }
Ejemplo n.º 54
0
        public override void Clicked()
        {
            Box       tmpBox, tmpBox2;
            Alignment tmpAlign;
            Box       vbox = new Gtk.VBox();

            vbox.Spacing = 3;
            Box hbox = new Gtk.HBox();

            hbox.Spacing = 3;

            Box dungeonVreContainer         = new Gtk.VBox();
            Box roomVreContainer            = new Gtk.VBox();
            ValueReferenceEditor dungeonVre = null;
            ValueReferenceEditor roomVre    = null;

            Alignment frame             = new Alignment(0, 0, 0, 0);
            var       dungeonSpinButton = new SpinButton(0, 15, 1);
            var       floorSpinButton   = new SpinButton(0, 15, 1);
            var       roomSpinButton    = new SpinButtonHexadecimal(0, 255, 1);

            roomSpinButton.Digits = 2;
            Minimap minimap = null;

            System.Action RoomChanged = () => {
                Dungeon dungeon = minimap.Map as Dungeon;
                Room    room    = minimap.GetRoom();

                roomSpinButton.Value = room.Index & 0xff;

                var vrs = new List <ValueReference>();
                vrs.Add(new StreamValueReference("Up", room.Index & 0xff, 0, 0, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Right", room.Index & 0xff, 1, 1, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Down", room.Index & 0xff, 2, 2, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Left", room.Index & 0xff, 3, 3, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Key", room.Index & 0xff, 4, 4, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Chest", room.Index & 0xff, 5, 5, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Boss", room.Index & 0xff, 6, 6, DataValueType.ByteBit));
                vrs.Add(new StreamValueReference("Dark", room.Index & 0xff, 7, 7, DataValueType.ByteBit));

                Stream stream = Project.GetBinaryFile("rooms/" + Project.GameString + "/group" + dungeon.Group + "DungeonProperties.bin");
                foreach (StreamValueReference r in vrs)
                {
                    r.SetStream(stream);
                }

                if (roomVre != null)
                {
                    roomVreContainer.Remove(roomVre);
                }

                var vrg = new ValueReferenceGroup(vrs);
                roomVre = new ValueReferenceEditor(Project, vrg, 4, "Minimap Data");

                roomVreContainer.Add(roomVre);
            };

            System.Action DungeonChanged = () => {
                Dungeon dungeon = Project.GetIndexedDataType <Dungeon>(dungeonSpinButton.ValueAsInt);

                floorSpinButton.Adjustment.Upper = dungeon.NumFloors - 1;
                if (floorSpinButton.ValueAsInt >= dungeon.NumFloors)
                {
                    floorSpinButton.Value = dungeon.NumFloors - 1;
                }

                var vrs = new List <ValueReference>();
                vrs.Add(new ValueReference("Group", 0, DataValueType.String, false));
                vrs.Add(new ValueReference("Wallmaster dest room", 0, DataValueType.Byte));
                vrs.Add(new ValueReference("Bottom floor layout", 0, DataValueType.Byte, false));
                vrs.Add(new ValueReference("# of floors", 0, DataValueType.Byte, false));
                vrs.Add(new ValueReference("Base floor name", 0, DataValueType.Byte));
                vrs.Add(new ValueReference("Floors unlocked with compass", 0, DataValueType.Byte));

                Data data = dungeon.DataStart;
                foreach (ValueReference r in vrs)
                {
                    r.SetData(data);
                    data = data.NextData;
                }

                // Remove last ValueReferenceEditor
                if (dungeonVre != null)
                {
                    dungeonVreContainer.Remove(dungeonVre);
                }

                var vrg = new ValueReferenceGroup(vrs);
                dungeonVre = new ValueReferenceEditor(Project, vrg, "Base Data");

                dungeonVre.AddDataModifiedHandler(() => {
                    floorSpinButton.Adjustment.Upper = dungeon.NumFloors;
                    minimap.GenerateImage();
                    RoomChanged();
                });

                // Replace the "group" option with a custom widget for finer
                // control.
                SpinButton groupSpinButton = new SpinButton(4, 5, 1);
                groupSpinButton.Value         = dungeon.Group;
                groupSpinButton.ValueChanged += (c, d) => {
                    vrg.SetValue("Group", ">wGroup" + groupSpinButton.ValueAsInt + "Flags");
                };
                dungeonVre.ReplaceWidget(0, groupSpinButton);
                dungeonVre.ShowAll();

                // Tooltips
                dungeonVre.SetTooltip(0, "Also known as the high byte of the room index.");
                dungeonVre.SetTooltip(1, "The low byte of the room index wallmasters will send you to.");
                dungeonVre.SetTooltip(2, "The index of the layout for the bottom floor. Subsequent floors will use subsequent indices.");
                dungeonVre.SetTooltip(4, "Determines what the game will call the bottom floor. For a value of:\n$00: The bottom floor is 'B3'.\n$01: The bottom floor is 'B2'.\n$02: The bottom floor is 'B1'.\n$03: The bottom floor is 'F1'.");
                dungeonVre.SetTooltip(5, "A bitset of floors that will appear on the map when the compass is obtained.\n\nEg. If this is $05, then floors 0 and 2 will be unlocked (bits 0 and 2 are set).");

                dungeonVreContainer.Add(dungeonVre);
                minimap.SetMap(dungeon);
                minimap.Floor = floorSpinButton.ValueAsInt;

                RoomChanged();
            };

            dungeonSpinButton.ValueChanged += (a, b) => { DungeonChanged(); };
            floorSpinButton.ValueChanged   += (a, b) => { DungeonChanged(); };

            frame.Add(vbox);

            tmpBox = new Gtk.HBox();
            tmpBox.Add(new Gtk.Label("Dungeon "));
            tmpBox.Add(dungeonSpinButton);
            tmpBox.Add(new Gtk.Label("Floor "));
            tmpBox.Add(floorSpinButton);
            tmpAlign = new Alignment(0, 0, 0, 0);
            tmpAlign.Add(tmpBox);

            vbox.Add(tmpAlign);
            vbox.Add(hbox);

            // Leftmost column

            tmpBox = new VBox();
            tmpBox.Add(dungeonVreContainer);

            var addFloorButton = new Button("Add Floor");

            addFloorButton.Image    = new Gtk.Image(Gtk.Stock.Add, Gtk.IconSize.Button);
            addFloorButton.Clicked += (a, b) => {
                Dungeon dungeon = minimap.Map as Dungeon;

                int newFloorIndex = dungeon.FirstLayoutIndex + dungeon.NumFloors;

                // Shift all subsequent layouts 64 bytes down in the data file
                Stream layoutFile = Project.GetBinaryFile("rooms/" + Project.GameString + "/dungeonLayouts.bin");
                layoutFile.SetLength(layoutFile.Length + 64);
                for (int i = (int)layoutFile.Length / 64 - 1; i > newFloorIndex; i--)
                {
                    var buf = new byte[64];
                    layoutFile.Position = (i - 1) * 64;
                    layoutFile.Read(buf, 0, 64);
                    layoutFile.Write(buf, 0, 64);
                }

                // Clear the new floor
                layoutFile.Position = newFloorIndex * 64;
                for (int j = 0; j < 64; j++)
                {
                    layoutFile.WriteByte(0);
                }

                // Shift each dungeon's "FirstLayoutIndex" to match the shifted layouts.
                for (int i = 0; i < Project.GetNumDungeons(); i++)
                {
                    Dungeon d2 = Project.GetIndexedDataType <Dungeon>(i);
                    if (d2.FirstLayoutIndex >= newFloorIndex)
                    {
                        d2.FirstLayoutIndex++;
                    }
                }

                dungeon.NumFloors     = dungeon.NumFloors + 1;
                floorSpinButton.Value = dungeon.NumFloors - 1;
                DungeonChanged();
            };
            tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0);
            tmpAlign.Add(addFloorButton);
            tmpBox.Add(tmpAlign);

            var removeFloorButton = new Button("Remove Top Floor");

            removeFloorButton.Image    = new Gtk.Image(Gtk.Stock.Remove, Gtk.IconSize.Button);
            removeFloorButton.Clicked += (a, b) => {
                Dungeon dungeon = minimap.Map as Dungeon;

                if (dungeon.NumFloors <= 1)
                {
                    return;
                }

                Gtk.MessageDialog d = new MessageDialog(null,
                                                        DialogFlags.DestroyWithParent,
                                                        MessageType.Warning,
                                                        ButtonsType.YesNo,
                                                        "Are you quite certain that you wish to delete the top floor of this dungeon?");
                var response = (ResponseType)d.Run();
                d.Destroy();

                if (response == Gtk.ResponseType.Yes)
                {
                    int deletedFloorIndex = dungeon.FirstLayoutIndex + dungeon.NumFloors - 1;

                    // Shift all subsequent layouts 64 bytes up in the data file
                    Stream layoutFile = Project.GetBinaryFile("rooms/" + Project.GameString + "/dungeonLayouts.bin");
                    for (int i = deletedFloorIndex; i < layoutFile.Length / 64 - 1; i++)
                    {
                        var buf = new byte[64];
                        layoutFile.Position = (i + 1) * 64;
                        layoutFile.Read(buf, 0, 64);
                        layoutFile.Position = i * 64;
                        layoutFile.Write(buf, 0, 64);
                    }

                    layoutFile.SetLength(layoutFile.Length - 64);

                    // Shift each dungeon's "FirstLayoutIndex" to match the shifted layouts.
                    for (int i = 0; i < Project.GetNumDungeons(); i++)
                    {
                        Dungeon d2 = Project.GetIndexedDataType <Dungeon>(i);
                        if (d2.FirstLayoutIndex > deletedFloorIndex)
                        {
                            d2.FirstLayoutIndex--;
                        }
                    }

                    dungeon.NumFloors = dungeon.NumFloors - 1;

                    DungeonChanged();
                }
            };
            tmpAlign = new Gtk.Alignment(0.5f, 0, 0, 0);
            tmpAlign.Add(removeFloorButton);
            tmpBox.Add(tmpAlign);

            hbox.Add(tmpBox);

            // Middle column (minimap)

            minimap = new Minimap();
            minimap.TileSelectedEvent += (sender) => {
                RoomChanged();
            };

            hbox.Add(minimap);

            // Rightmost column

            tmpAlign = new Alignment(0, 0, 0, 0);
            tmpAlign.Add(roomVreContainer);

            tmpBox2 = new HBox();
            tmpBox2.Add(new Gtk.Label("Room "));
            roomSpinButton.ValueChanged += (a, b) => {
                (minimap.Map as Dungeon).SetRoom(minimap.SelectedX, minimap.SelectedY,
                                                 minimap.Floor, roomSpinButton.ValueAsInt);
                minimap.GenerateImage();
                RoomChanged();
            };
            tmpBox2.Add(roomSpinButton);

            tmpBox = new VBox();
            tmpBox.Add(tmpBox2);
            tmpBox.Add(tmpAlign);

            hbox.Add(tmpBox);



            Window w = new Window(null);

            w.Add(frame);
            w.ShowAll();

            Map map = manager.GetActiveMap();

            if (map is Dungeon)
            {
                dungeonSpinButton.Value = map.Index;
            }

            DungeonChanged();
        }
Ejemplo n.º 55
0
        public TaskGroup(string groupName, DateTime rangeStart,
                         DateTime rangeEnd, Gtk.TreeModel tasks)
        {
            hideWhenEmpty = true;

            // TODO: Add a date time event watcher so that when we rollover to
            // a new day, we can update the rangeStart and rangeEnd times.  The
            // ranges will be used to determine whether tasks fit into certain
            // groups in the main TaskWindow.  Reference Tomboy's NoteOfTheDay
            // add-in for code that reacts on day changes.

            filteredTasks = CreateModel(rangeStart, rangeEnd, tasks);

            filteredTasks.ShowCompletedTasks =
                Application.Preferences.GetBool(
                    Preferences.ShowCompletedTasksKey);
            Application.Preferences.SettingChanged += OnSettingChanged;

            // TODO: Add something to watch events so that the group will
            // automatically refilter and display/hide itself accordingly.

            //
            // Build the UI
            //

            //
            // Group Header
            //
//			Gtk.EventBox eb = new Gtk.EventBox();
//			eb.Show();
//			eb.BorderWidth = 0;
//			eb.ModifyBg(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
//			eb.ModifyBase(Gtk.StateType.Normal, new Gdk.Color(211,215,199));
            Gtk.HBox headerHBox = new Gtk.HBox(false, 0);

            header              = new Gtk.Label();
            header.UseMarkup    = true;
            header.UseUnderline = false;
            header.Markup       = GetHeaderMarkup(groupName);
            header.Xalign       = 0;

            header.Show();

//			eb.Add(header);
//			PackStart (eb, false, false, 0);
            headerHBox.PackStart(header, false, false, 0);

            // spacer
            Gtk.Label spacerLabel = new Gtk.Label(string.Empty);
            spacerLabel.Show();
            headerHBox.PackStart(spacerLabel, true, true, 0);

            extraWidgetHBox = new Gtk.HBox(false, 0);
            extraWidgetHBox.Show();
            headerHBox.PackStart(extraWidgetHBox, false, false, 0);
            headerHBox.Show();
            PackStart(headerHBox, false, false, 5);

            //
            // Group TreeView
            //
            treeView = new TaskTreeView(filteredTasks);
            treeView.Show();
            PackStart(treeView, true, true, 0);

            treeView.NumberOfTasksChanged += OnNumberOfTasksChanged;
            treeView.RowActivated         += OnRowActivated;
            treeView.ButtonPressEvent     += OnButtonPressed;
        }
Ejemplo n.º 56
0
            public WidgetBuilderOptionPanelWidget(Project project) : base(false, 6)
            {
                this.project = project as DotNetProject;

                Gtk.HBox  box = new Gtk.HBox(false, 3);
                Gtk.Label lbl = new Gtk.Label(GettextCatalog.GetString("Target Gtk# version:"));
                box.PackStart(lbl, false, false, 0);
                comboVersions = ComboBox.NewText();
                ReferenceManager refmgr = new ReferenceManager(project as DotNetProject);

                foreach (string v in refmgr.SupportedGtkVersions)
                {
                    comboVersions.AppendText(v);
                }
                comboVersions.Active = refmgr.SupportedGtkVersions.IndexOf(refmgr.GtkPackageVersion);
                refmgr.Dispose();
                box.PackStart(comboVersions, false, false, 0);
                box.ShowAll();
                PackStart(box, false, false, 0);

                HSeparator sep = new HSeparator();

                sep.Show();
                PackStart(sep, false, false, 0);

                if (!GtkDesignInfo.HasDesignedObjects(project))
                {
                    return;
                }

                GtkDesignInfo designInfo = GtkDesignInfo.FromProject(project);

                checkGettext        = new CheckButton(GettextCatalog.GetString("Enable gettext support"));
                checkGettext.Active = designInfo.GenerateGettext;
                checkGettext.Show();
                PackStart(checkGettext, false, false, 0);
                box = new Gtk.HBox(false, 3);
                box.PackStart(new Label(GettextCatalog.GetString("Gettext class:")), false, false, 0);
                entryGettext           = new Gtk.Entry();
                entryGettext.Text      = designInfo.GettextClass;
                entryGettext.Sensitive = checkGettext.Active;
                box.PackStart(entryGettext, false, false, 0);
                box.ShowAll();
                PackStart(box, false, false, 0);

                sep = new HSeparator();
                sep.Show();
                PackStart(sep, false, false, 0);

                box = new Gtk.HBox(false, 3);
                box.PackStart(new Label(GettextCatalog.GetString("Stetic folder name :")), false, false, 0);
                entryFolderName           = new Gtk.Entry();
                entryFolderName.Text      = designInfo.SteticFolderName;
                entryFolderName.Sensitive = false;
                box.PackStart(entryFolderName, false, false, 0);
                box.ShowAll();
                PackStart(box, false, false, 0);

                checkHideFiles        = new CheckButton(GettextCatalog.GetString("Hide designer files"));
                checkHideFiles.Active = designInfo.HideGtkxFiles;
                checkHideFiles.Show();
                PackStart(checkHideFiles, false, false, 0);
            }
Ejemplo n.º 57
0
        // TODO: pass in a label which it will update with the name from the combobox?
        public ComboBoxFromConstants(bool showHelp = true, bool vertical = false, bool showSpin = true)
        {
            this.Name = "LynnaLab.ComboBoxFromConstants";

            Gtk.Box box2 = new Gtk.HBox();
            box2.Spacing = 6;

            // Container child LynnaLab.ComboBoxFromConstants.Gtk.Container+ContainerChild
            if (vertical)
            {
                this.box1 = new Gtk.VBox();
            }
            else
            {
                this.box1 = new Gtk.HBox();
            }
            // Container child box1.Gtk.Box+BoxChild
            this.spinButton                          = new LynnaLab.SpinButtonHexadecimal();
            this.spinButton.CanFocus                 = true;
            this.spinButton.Name                     = "spinButton";
            this.spinButton.Adjustment.Upper         = 255D;
            this.spinButton.Adjustment.PageIncrement = 16D;
            this.spinButton.Adjustment.StepIncrement = 1D;
            this.spinButton.ClimbRate                = 1D;
            this.spinButton.Digits                   = 2;
            this.spinButton.Numeric                  = true;
            if (showSpin)
            {
                box2.Add(spinButton);
                box2.SetChildPacking(spinButton, expand: false, fill: false, padding: 0, pack_type: Gtk.PackType.Start);
                box1.Add(box2);
            }

            // Container child box1.Gtk.Box+BoxChild
            this.combobox1      = new Gtk.ComboBoxText();
            this.combobox1.Name = "combobox1";
            this.box1.Add(this.combobox1);
            box1.SetChildPacking(this.combobox1, false, false, 0, Gtk.PackType.Start);

            this.spinButton.ValueChanged += new System.EventHandler(this.OnSpinButtonValueChanged);
            this.combobox1.Changed       += new System.EventHandler(this.OnCombobox1Changed);

            if (showHelp)
            {
                // When clicking the "help" button, create a popup with documentation for
                // possible values. (It checks for a "@values" field in the documentation.)
                Gtk.Button helpButton = new Gtk.Button("?");
                helpButton.CanFocus = false;
                helpButton.Clicked += delegate(object sender, EventArgs e) {
                    if (DefaultDocumentation == null)
                    {
                        return;
                    }

                    DocumentationDialog d = new DocumentationDialog(DefaultDocumentation);
                    d.Run();
                    d.Dispose();
                };

                box2.PackStart(helpButton, false, false, 0);
            }

            Gtk.Frame frame = new Gtk.Frame();
            frame.Add(box1);
            this.Add(frame);
        }
Ejemplo n.º 58
0
        private void PushButton(object sender, EventArgs e)
        {
            Gtk.CheckButton check  = new Gtk.CheckButton("Down");
            Gtk.Entry       input  = new Gtk.Entry(15);
            Gtk.HBox        divide = new Gtk.HBox(false, 0);
            Gtk.Button      but    = new Gtk.Button("OK");

            input.Activated += delegate {
                but.Click();
            };

            divide.PackStart(input);
            divide.Add(check);
            divide.PackEnd(but);

            Gtk.Window w = new Gtk.Window(Gtk.WindowType.Popup);
            w.SetPosition(WindowPosition.Mouse);

            w.Add(divide);

            w.BorderWidth = 0;
            w.Modal       = true;
            w.CanFocus    = true;
            w.ShowAll();

            but.Clicked += delegate {
                if (input.Text == "")
                {
                    return;
                }
                int      i, j;
                string[] name = ((Gtk.Button)sender).Name.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
                i = int.Parse(name [1]);
                j = int.Parse(name [2]);

                w.HideAll();


                if (this.game.GetActualPlayer().DoMove(
                        new Lexicon.Move(new System.Drawing.Point(i - 1, j - 1), input.Text.ToUpperInvariant(), check.Active))
                    )
                {
                    w.Destroy();
                    if (!Scrabble.Game.InitialConfig.client)
                    {
                        this.game.changePlayer();
                    }
                }
            };

            w.KeyPressEvent += delegate(object o, KeyPressEventArgs args) {
                switch (args.Event.Key)
                {
                case Gdk.Key.Escape:
                    w.HideAll();
                    w.Dispose();
                    w.Destroy();
                    break;
                }
            };
        }
Ejemplo n.º 59
0
        void doDialog()
        {
#if GTK_SHARP_2_6
            bool rename = combo.Active == values.Count + 1;
#else
            bool rename = combo.Active == values.Count;
#endif
            Gtk.Dialog dialog = new Gtk.Dialog(
                rename ? Catalog.GetString("Rename Group") : Catalog.GetString("New Group"),
                combo.Toplevel as Gtk.Window,
                Gtk.DialogFlags.Modal | Gtk.DialogFlags.NoSeparator,
                Gtk.Stock.Cancel, Gtk.ResponseType.Cancel,
                Gtk.Stock.Ok, Gtk.ResponseType.Ok);
            dialog.DefaultResponse  = Gtk.ResponseType.Ok;
            dialog.HasSeparator     = false;
            dialog.BorderWidth      = 12;
            dialog.VBox.Spacing     = 18;
            dialog.VBox.BorderWidth = 0;

            Gtk.HBox  hbox  = new Gtk.HBox(false, 12);
            Gtk.Label label = new Gtk.Label(rename ? Catalog.GetString("_New name:") : Catalog.GetString("_Name:"));
            Gtk.Entry entry = new Gtk.Entry();
            label.MnemonicWidget = entry;
            hbox.PackStart(label, false, false, 0);
            entry.ActivatesDefault = true;
            if (rename)
            {
                entry.Text = group;
            }
            hbox.PackStart(entry, true, true, 0);
            dialog.VBox.PackStart(hbox, false, false, 0);

            dialog.ShowAll();
            // Have to set this *after* ShowAll
            dialog.ActionArea.BorderWidth = 0;
            dialog.TransientFor           = this.Toplevel as Gtk.Window;
            Gtk.ResponseType response = (Gtk.ResponseType)dialog.Run();
            if (response == Gtk.ResponseType.Cancel || entry.Text.Length == 0)
            {
                dialog.Destroy();
                Value = group;                 // reset combo.Active
                return;
            }

            string oldname = group;
            group = entry.Text;
            dialog.Destroy();

            // FIXME: check that the new name doesn't already exist

            // This will trigger a GroupsChanged, which will eventually
            // update combo.Active
            if (rename)
            {
                manager.Rename(oldname, group);
            }
            else
            {
                manager.Add(group);
            }
        }
Ejemplo n.º 60
0
            public SubTileEditor(TilesetEditor tilesetEditor) : base(0, 0, 0, 0)
            {
                this.tilesetEditor = tilesetEditor;

                Gtk.Box tmpBox;

                Gtk.VBox vbox = new VBox(false, 2);
                vbox.Spacing = 10;

                // Top row: 2 images of the tile, one for selecting, one to show
                // collisions

                subTileViewer = new SubTileViewer();

                subTileViewer.SubTileChangedEvent += delegate() {
                    PullEverything();
                };

                subTileCollisionEditor = new SubTileCollisionEditor();
                subTileCollisionEditor.CollisionsChangedHandler += () => {
                    PullEverything();
                };

                Alignment hAlign = new Alignment(0.5f, 0, 0, 0);

                Gtk.HBox hbox = new HBox(false, 2);
                hbox.Add(subTileViewer);
                hbox.Add(subTileCollisionEditor);
                hAlign.Add(hbox);

                vbox.Add(hAlign);

                // Next row: collision value

                collisionSpinButton               = new SpinButtonHexadecimal(0, 255);
                collisionSpinButton.Digits        = 2;
                collisionSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                    Tileset.SetTileCollision(TileIndex, (byte)collisionSpinButton.ValueAsInt);
                    subTileCollisionEditor.QueueDraw();
                };

                Gtk.Label collisionLabel = new Gtk.Label("Collisions");

                tmpBox = new Gtk.HBox(false, 2);
                tmpBox.Add(collisionLabel);
                tmpBox.Add(collisionSpinButton);
                vbox.Add(tmpBox);

                // Next rows: subtile properties

                var table = new Table(2, 2, false);

                table.ColumnSpacing = 6;
                table.RowSpacing    = 6;

                subTileSpinButton = new SpinButtonHexadecimal(0, 255);
                subTileSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                paletteSpinButton = new SpinButton(0, 7, 1);
                paletteSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                flipXCheckButton          = new Gtk.CheckButton();
                flipXCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                flipYCheckButton          = new Gtk.CheckButton();
                flipYCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                priorityCheckButton          = new Gtk.CheckButton();
                priorityCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                bankCheckButton          = new Gtk.CheckButton();
                bankCheckButton.Toggled += delegate(object sender, EventArgs e) {
                    PushFlags();
                };
                bankCheckButton.Sensitive = false; // On second thought, nobody actually needs this

                Gtk.Label subTileLabel  = new Gtk.Label("Subtile Index");
                Gtk.Label paletteLabel  = new Gtk.Label("Palette");
                Gtk.Label flipXLabel    = new Gtk.Label("Flip X");
                Gtk.Label flipYLabel    = new Gtk.Label("Flip Y");
                Gtk.Label priorityLabel = new Gtk.Label("Priority");
                Gtk.Label bankLabel     = new Gtk.Label("Bank (0/1)");

                paletteLabel.TooltipText      = "Palette index (0-7)";
                paletteSpinButton.TooltipText = "Palette index (0-7)";

                priorityLabel.TooltipText       = "Check to make colors 1-3 appear above sprites";
                priorityCheckButton.TooltipText = "Check to make colors 1-3 appear above sprites";

                bankLabel.TooltipText       = "This should always be checked.";
                bankCheckButton.TooltipText = "This should always be checked.";

                uint y = 0;

                table.Attach(subTileLabel, 0, 1, y, y + 1);
                table.Attach(subTileSpinButton, 1, 2, y, y + 1);
                y++;
                table.Attach(paletteLabel, 0, 1, y, y + 1);
                table.Attach(paletteSpinButton, 1, 2, y, y + 1);
                y++;
                table.Attach(flipXLabel, 0, 1, y, y + 1);
                table.Attach(flipXCheckButton, 1, 2, y, y + 1);
                y++;
                table.Attach(flipYLabel, 0, 1, y, y + 1);
                table.Attach(flipYCheckButton, 1, 2, y, y + 1);
                y++;
                table.Attach(priorityLabel, 0, 1, y, y + 1);
                table.Attach(priorityCheckButton, 1, 2, y, y + 1);
                y++;
                table.Attach(bankLabel, 0, 1, y, y + 1);
                table.Attach(bankCheckButton, 1, 2, y, y + 1);
                y++;

                vbox.Add(table);
                this.Add(vbox);

                ShowAll();

                PullEverything();
            }