Пример #1
0
            public ICSShell(ICSClient client)
                : base()
            {
                this.client = client;
                max_chars = 16 * 1024;
                textView = new TextView ();
                textView.ModifyFont (Pango.FontDescription.
                             FromString
                             ("Monospace 9"));
                client.LineReceivedEvent += OnLineReceived;

                commandEntry = new Entry ();
                sendButton =
                    new Button (Catalog.
                            GetString ("Send"));

                ScrolledWindow win = new ScrolledWindow ();
                  win.HscrollbarPolicy =
                    win.VscrollbarPolicy =
                    PolicyType.Automatic;
                  win.Add (textView);

                  PackStart (win, true, true, 4);
                HBox box = new HBox ();
                  box.PackStart (commandEntry, true, true, 4);
                  box.PackStart (sendButton, false, false, 4);
                  PackStart (box, false, true, 4);

                  textView.Editable = false;

                  commandEntry.Activated += OnCommand;
                  sendButton.Clicked += OnCommand;
                  ShowAll ();
            }
            public RelayTournamentsView(ICSClient c)
            {
                client = c;
                tournamentIter = TreeIter.Zero;
                store = new TreeStore (typeof (int),
                               typeof (string),
                               typeof (string));
                  create_tree ();
                  refreshButton = new Button (Stock.Refresh);
                  refreshButton.Clicked += OnClicked;
                  infoLabel = new Label ();
                  infoLabel.UseMarkup = true;
                  infoLabel.Xalign = 0;
                  infoLabel.Xpad = 4;
                //infoLabel.Yalign = 0;
                //infoLabel.Ypad = 4;
                HBox box = new HBox ();
                  box.PackStart (infoLabel, true, true, 4);
                  box.PackStart (refreshButton, false, false,
                         4);
                  PackStart (box, false, true, 4);

                ScrolledWindow scroll = new ScrolledWindow ();
                  scroll.HscrollbarPolicy =
                    scroll.VscrollbarPolicy =
                    PolicyType.Automatic;
                  scroll.Add (tree);
                  PackStart (scroll, true, true, 4);
                  client.AuthEvent += OnAuth;
                  ShowAll ();
            }
            public NotificationWidget()
                : base()
            {
                HBox box = new HBox ();
                  label = new Label ();
                  label.Xalign = 0;
                  closeButton = new Button ();
                  closeButton.Image =
                    new Image (Stock.Close,
                           IconSize.Button);
                  closeButton.Clicked += on_close;
                  acceptButton = new Button (Stock.Ok);
                  acceptButton.Image =
                    new Image (Stock.Ok, IconSize.Button);
                  acceptButton.Clicked += on_accept;
                  ModifyBg (StateType.Normal,
                        new Gdk.Color (0xff, 0xff, 0xc0));

                  box.PackStart (label, true, true, 5);
                  box.PackStart (acceptButton, false, false,
                         5);
                  box.PackStart (closeButton, false, false,
                         5);
                  label.Show ();
                  closeButton.Show ();

                // This box will add some vertical padding
                VBox b = new VBox ();
                  b.PackStart (box, false, true, 5);

                  Add (b);
            }
Пример #4
0
            public ICSShell(ICSClient client)
                : base()
            {
                this.client = client;
                textView = new ShellTextView (client);

                commandEntry = new Entry ();
                sendButton =
                    new Button (Catalog.
                            GetString ("Send"));

                ScrolledWindow win = new ScrolledWindow ();
                  win.HscrollbarPolicy =
                    win.VscrollbarPolicy =
                    PolicyType.Automatic;
                  win.Add (textView);

                  PackStart (win, true, true, 4);
                HBox box = new HBox ();
                  box.PackStart (commandEntry, true, true, 4);
                  box.PackStart (sendButton, false, false, 4);
                  PackStart (box, false, true, 4);

                  textView.Editable = false;

                  commandEntry.Activated += OnCommand;
                  sendButton.Clicked += OnCommand;
                  ShowAll ();
            }
            public GameAdvertisementGraph(ICSClient c)
            {
                graph = new Graph ();
                categories = new Hashtable ();
                categories["blitz"] = 1;
                categories["standard"] = 1;
                categories["lightning"] = 1;
                categories["untimed"] = 1;

                graph.GameFocusedEvent += OnGameFocused;
                graph.GameClickedEvent += OnGameClicked;

                infoLabel = new Label ();
                infoLabel.Xalign = 0;
                infoLabel.Xpad = 4;
                this.client = c;

                client.GameAdvertisementAddEvent +=
                    OnGameAdvertisementAddEvent;
                client.GameAdvertisementRemoveEvent +=
                    OnGameAdvertisementRemoveEvent;
                client.GameAdvertisementsClearedEvent +=
                    OnGameAdvertisementsCleared;
                SetSizeRequest (600, 400);

                image = new Gtk.Image ();
                PackStart (graph, true, true, 4);

                HBox box = new HBox ();
                  box.PackStart (image, false, false, 4);
                  box.PackStart (infoLabel, true, true, 4);

                  PackStart (box, false, true, 4);
                  ShowAll ();
            }
Пример #6
0
		public Command Run (WindowFrame transientFor, MessageDescription message)
		{
			this.icon = GetIcon (message.Icon);
			if (ConvertButtons (message.Buttons, out buttons)) {
				// Use a system message box
				if (message.SecondaryText == null)
					message.SecondaryText = String.Empty;
				else {
					message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
					message.SecondaryText = String.Empty;
				}
				var wb = (WindowFrameBackend)Toolkit.GetBackend (transientFor);
				if (wb != null) {
					this.dialogResult = MessageBox.Show (wb.Window, message.Text, message.SecondaryText,
														this.buttons, this.icon, this.defaultResult, this.options);
				}
				else {
					this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
														this.icon, this.defaultResult, this.options);
				}
				return ConvertResultToCommand (this.dialogResult);
			}
			else {
				// Custom message box required
				Dialog dlg = new Dialog ();
				dlg.Resizable = false;
				dlg.Padding = 0;
				HBox mainBox = new HBox { Margin = 25 };

				if (message.Icon != null) {
					var image = new ImageView (message.Icon.WithSize (32,32));
					mainBox.PackStart (image, vpos: WidgetPlacement.Start);
				}
				VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
				mainBox.PackStart (box, true);
				var text = new Label {
					Text = message.Text ?? ""
				};
				Label stext = null;
				box.PackStart (text);
				if (!string.IsNullOrEmpty (message.SecondaryText)) {
					stext = new Label {
						Text = message.SecondaryText
					};
					box.PackStart (stext);
				}
				dlg.Buttons.Add (message.Buttons.ToArray ());
				if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
					text.Wrap = WrapMode.Word;
					if (stext != null)
						stext.Wrap = WrapMode.Word;
					mainBox.WidthRequest = 480;
				}
				var s = mainBox.Surface.GetPreferredSize (true);

				dlg.Content = mainBox;
				return dlg.Run ();
			}
		}
Пример #7
0
		public override void InitializeBackend (object frontend, ApplicationContext context)
		{
			base.InitializeBackend (frontend, context);

			buttonBox = new HBox () {
				Spacing = 0,
				Margin = 0
			};
			buttonBoxView = ((ViewBackend)buttonBox.GetBackend ()).Widget;
			ContentView.AddSubview (buttonBoxView);
		}
Пример #8
0
	static void SetUpGui ()
	{
		Window w = new Window ("Sign Up");
		
		firstname_entry = new Entry ();
		lastname_entry = new Entry ();
		email_entry = new Entry ();
		
		VBox outerv = new VBox ();
		outerv.BorderWidth = 12;
		outerv.Spacing = 12;
		w.Add (outerv);
		
		Label l = new Label ("Enter your name and preferred address");
		l.Xalign = 0;
		//l.UseMarkup = true;
		outerv.PackStart (l, false, false, 0);
		
		HBox h = new HBox ();
		//h.Spacing = 6;
		outerv.PackStart (h);
		
		VBox v = new VBox ();
		//v.Spacing = 6;
		h.PackStart (v, false, false, 0);
		
		Button l2;
		l2 = new Button ("First Name:");
		//l.Xalign = 0;
		v.PackStart (l2, true, false, 0);
		//l.MnemonicWidget = firstname_entry;
		
		l2 = new Button ("Last Name:");
		//l.Xalign = 0;
		v.PackStart (l2, true, false, 0);
		//l.MnemonicWidget = firstname_entry;
		
		l2 = new Button ("Email Address:");
		//l.Xalign = 0;
		v.PackStart (l2, true, false, 0);
		//l.MnemonicWidget = firstname_entry;

		v = new VBox ();
		//v.Spacing = 6;
		h.PackStart (v, true, true, 0);
		
		v.PackStart (firstname_entry, true, true, 0);
		v.PackStart (lastname_entry, true, true, 0);
		v.PackStart (email_entry, true, true, 0);
		
		w.ShowAll ();
	}
Пример #9
0
        public override void InitializeBackend(object frontend, ApplicationContext context)
        {
            base.InitializeBackend (frontend, context);

            mainBox = new VBox () {
                Spacing = 0,
                Margin = 0
            };
            buttonBox = new HBox () {
                Spacing = 0,
                Margin = 0
            };
            mainBox.PackEnd (buttonBox);
            base.SetChild ((IWidgetBackend) Toolkit.GetBackend (mainBox));
        }
            public GamesListWidget()
                : base()
            {
                HBox hbox = new HBox ();
                hbox.PackStart (new
                        Label (Catalog.
                               GetString
                               ("Filter")), false,
                        false, 4);

                view = CreateIconView ();
                win = new ScrolledWindow ();
                win.HscrollbarPolicy = PolicyType.Automatic;
                win.VscrollbarPolicy = PolicyType.Automatic;
                win.Add (view);
                PackStart (win, true, true, 4);

                ShowAll ();
            }
            public GamesListWidget()
                : base()
            {
                HBox hbox = new HBox ();
                  hbox.PackStart (new
                          Label (Catalog.
                             GetString
                             ("Filter")), false,
                          false, 4);
                  searchEntry = new Entry ();
                  hbox.PackStart (searchEntry, true, true, 4);
                  tree = new TreeView ();
                  PackStart (hbox, false, true, 0);

                ScrolledWindow win = new ScrolledWindow ();
                  win.HscrollbarPolicy = PolicyType.Automatic;
                  win.VscrollbarPolicy = PolicyType.Automatic;
                  win.Add (tree);
                  PackStart (win, true, true, 4);

                  SetupTree ();
                  ShowAll ();
                  searchEntry.Activated += OnSearch;
            }
            public ObservableGamesWidget(GameObservationManager
						      observer)
            {
                obManager = observer;
                iters = new TreeIter[3, 4];
                gamesView = new TreeView ();
                infoLabel = new Label ();
                infoLabel.Xalign = 0;
                infoLabel.Xpad = 4;
                observer.ObservableGameEvent +=
                    OnObservableGameEvent;

                store = new TreeStore (typeof (string),	// used for filtering
                               typeof (int),	// gameid
                               typeof (string),	// markup
                               typeof (string),	//
                               typeof (string));

                  gamesView.HeadersVisible = true;
                  gamesView.HeadersClickable = true;

                  gamesView.AppendColumn (Catalog.
                              GetString ("Games"),
                              new
                              CellRendererText (),
                              "markup", 2);
                  gamesView.AppendColumn (Catalog.
                              GetString ("Time"),
                              new
                              CellRendererText (),
                              "markup", 3);
                  gamesView.AppendColumn (Catalog.
                              GetString
                              ("Category"),
                              new
                              CellRendererText (),
                              "markup", 4);

                ScrolledWindow win = new ScrolledWindow ();
                  win.HscrollbarPolicy =
                    win.VscrollbarPolicy =
                    PolicyType.Automatic;
                  win.Add (gamesView);

                  UpdateInfoLabel ();

                  filterEntry = new Entry ();
                  filterEntry.Changed += OnFilter;

                  filter = new TreeModelFilter (store, null);
                  filter.VisibleFunc = FilterFunc;
                  gamesView.Model = filter;

                  AddParentIters ();

                  infoLabel.UseMarkup = true;
                Button refreshButton =
                    new Button (Stock.Refresh);
                  refreshButton.Clicked +=
                    delegate (object o, EventArgs args)
                {
                    Clear ();
                    obManager.GetGames ();
                };
                Alignment align = new Alignment (0, 1, 0, 0);
                align.Add (refreshButton);

                HBox hbox = new HBox ();
                hbox.PackStart (infoLabel, true, true, 4);
                hbox.PackStart (align, false, false, 4);

                PackStart (hbox, false, true, 4);

                Label tipLabel = new Label ();
                tipLabel.Xalign = 0;
                tipLabel.Xpad = 4;
                tipLabel.Markup =
                    String.
                    Format ("<small><i>{0}</i></small>",
                        Catalog.
                        GetString
                        ("Press the refresh button to get an updated list of games.\nDouble click on a game to observe it."));
                PackStart (tipLabel, false, true, 4);
                PackStart (filterEntry, false, true, 4);
                PackStart (win, true, true, 4);

                gamesView.RowActivated += OnRowActivated;
                SetSizeRequest (600, 400);
                ShowAll ();
            }
Пример #13
0
	static void SetUpGui ()
	{
		Window w = new Window ("Eap Editor");
		
		appname_entry = new Entry ();
		geninfo_entry = new Entry ();
		comments_entry = new Entry ();
		exe_entry = new Entry ();
		winname_entry = new Entry ();
		winclass_entry = new Entry ();
		
		VBox outerv = new VBox ();
		outerv.BorderWidth = 12;
		outerv.Spacing = 12;
		w.Add (outerv);
		
		HBox h = new HBox ();
		outerv.PackStart (h, false, false, 0);
		
		Button b = new Button ("Select Icon");
		h.PackStart (b, true, false, 0);
		
		h = new HBox ();
		h.Spacing = 6;
		outerv.PackStart (h);
		
		VBox v = new VBox ();
		v.Spacing = 6;
		h.PackStart (v, false, false, 0);
		
		b = new Button ("App name:");
		v.PackStart (b, true, false, 0);
		
		b = new Button ("Generic Info:");
		v.PackStart (b, true, false, 0);
		
		b = new Button ("Comments:");
		v.PackStart (b, true, false, 0);

		b = new Button ("Executable:");
		v.PackStart (b, true, false, 0);
		
		b = new Button ("Window Name:");
		v.PackStart (b, true, false, 0);
		
		b = new Button ("Window Class:");
		v.PackStart (b, true, false, 0);
		
		b = new Button ("Startup notify:");
		v.PackStart (b, true, false, 0);
		
		b = new Button ("Wait Exit:");
		v.PackStart (b, true, false, 0);
		
		v = new VBox ();
		v.Spacing = 6;
		h.PackStart (v, true, true, 0);
		
		v.PackStart (appname_entry, true, true, 0);
		v.PackStart (geninfo_entry, true, true, 0);
		v.PackStart (comments_entry, true, true, 0);
		v.PackStart (exe_entry, true, true, 0);
		v.PackStart (winname_entry, true, true, 0);
		v.PackStart (winclass_entry, true, true, 0);
		//v.PackStart (new Entry(), true, true, 0);
		//v.PackStart (new Entry(), true, true, 0);
		
		CheckButton start_cbox = new CheckButton ();
		v.PackStart (start_cbox);
		
		CheckButton wait_cbox= new CheckButton ();
		v.PackStart (wait_cbox);		
		
		h = new HBox ();
		h.Spacing = 0;
		outerv.PackStart (h);
		
		v = new VBox ();		
		b = new Button ("Save");
		v.PackStart (b, true, false, 0);
		h.PackStart (v, true, false, 0);
		
		v = new VBox ();		
		b = new Button ("Cancel");
		v.PackStart (b, true, false, 0);
		h.PackStart (v, true, false, 0);
		
		w.ShowAll ();
	}
Пример #14
0
        protected override void OnClientInit(bool reinit)
        {
            if (SelectedFileFromModel.HasValue && SelectedFileFromModel.Value > 0)
            {
                HBox hBoxLoading = new HBox() { ID = string.Format("loadingControl_{0}", this.ID) };

                Ext.Net.Image imageLoading = new Ext.Net.Image() {
                    ImageUrl = "/Content/loading.gif",
                    StyleSpec = "padding-top:1px;"
                };

                hBoxLoading.Items.Add(imageLoading);

                Ext.Net.Label labelLoading = new Ext.Net.Label() {
                    StyleSpec = "padding-left:4px; padding-top:1px;",
                    Text = "Loading..."
                };

                hBoxLoading.Items.Add(labelLoading);

                this.Items.Add(hBoxLoading);

                base.Listeners.BeforeRender.Handler = string.Format(@"#{{uploadControl_{0}}}.hide(); #{{downloadControl_{0}}}.hide(); #{{{3}}}.setValue({1});
                                                                        Ext.net.DirectMethod.request({{
                                                                                url          : '{2}',
                                                                                cleanRequest : true,
                                                                                params       : {{
                                                                                    id : {1}
                                                                                }},
                                                                                success : function(result) {{
                                                                                    #{{loadingControl_{0}}}.hide();
                                                                                    #{{{3}}}.setValue(result.extraParams.FileID);
                                                                                    #{{buttonDownload_{0}}}.setText(result.extraParams.FileName);
                                                                                    Ext.net.ResourceMgr.registerIcon(result.extraParams.Icon);
                                                                                    #{{buttonDownload_{0}}}.setIconClass(result.extraParams.IconCls);
                                                                                    #{{downloadControl_{0}}}.doLayout(true, true);
                                                                                    #{{fileUpload_{0}}}.allowBlank = true;
                                                                                    #{{uploadControl_{0}}}.hide();
                                                                                    #{{downloadControl_{0}}}.show();
                                                                                }},
                                                                                failure : function (errorResponse) {{
                                                                                    #{{loadingControl_{0}}}.hide();
                                                                                    #{{{3}}}.setValue(null);
                                                                                    #{{uploadControl_{0}}}.show();
                                                                                    #{{downloadControl_{0}}}.hide();
                                                                                }}
                                                                        }});", this.ID, SelectedFileFromModel.Value, (GetFileByIDUrl ?? "/Files/GetFileByID/"), this.ID.Replace("_Form",""));
            }

            base.OnClientInit(reinit);
        }
Пример #15
0
	public static void Main(string [] args)
	{
		Application.Init();

		Window w = new Window("EFL# Demo App");
		
		VBox vbx = new VBox ();
		vbx.Spacing = 4;
		
		MenuBar mb = new MenuBar();
		
		vbx.PackStart (mb, false, false, 0);
		
		MenuItem item = new MenuItem ("File");
		Menu file_menu = new Menu ();
		item.Submenu = file_menu;
		
		MenuItem file_item = new MenuItem ("Open");
		file_item.Activated += FileOpenHandler;
		file_menu.Append (file_item);
		
		
		
		
		file_item = new MenuItem ("Close");
		file_menu.Append (file_item);
		Menu close_menu = new Menu ();
		file_item.Submenu = close_menu;
		MenuItem close_menu_item = new MenuItem ("Close This");
		close_menu.Append (close_menu_item);
		close_menu_item = new MenuItem ("Close All");
		close_menu.Append (close_menu_item);
		
		
		
		
		file_item = new MenuItem ("Save");
		file_menu.Append (file_item);
		
		file_item = new MenuItem ("Save As");
                file_menu.Append (file_item);
		
		file_item = new MenuItem ("Quit");
		file_item.Activated += FileQuitHandler;		
                file_menu.Append (file_item);
		
		mb.Append (item);
		
		item = new MenuItem ("Edit");
		Menu edit_menu = new Menu ();
		item.Submenu = edit_menu;
		mb.Append (item);
		
		item = new MenuItem ("About");
		Menu about_menu = new Menu ();		
		item.Submenu = about_menu;
		
		MenuItem about_item = new MenuItem ("Help");
		about_item.Activated += AboutHelpHandler;
		about_menu.Append (about_item);
		
		about_item = new MenuItem ("Authors");
		about_item.Activated += AboutAuthorsHandler;
		about_menu.Append (about_item);
		
		mb.Append (item);
				
		HBox bx = new HBox ();
		
		vbx.PackStart (bx);
		
		bx.Spacing = 0;
		Button l1 = new Button ("one");				
		Button l2 = new Button ("two");
		Button l3 = new Button ("three");
		Button l4 = new Button ("four");
		Button l5 = new Button ("five");		

		l5.Clicked +=  Button_Clicked;
		
		bx.PackStart(l1);
		bx.PackStart(l2);
		bx.PackStart(l3);
		bx.PackStart(l4);
		bx.PackStart(l5);
		
		HBox inbox = new HBox ();
		inbox.Spacing = 5;
		inbox.BorderWidth = 2;
		vbx.PackStart (inbox);
		Label input_label = new Label ("What is your name?");
		input_label.Xalign = 0;
		inbox.PackStart (input_label, false, false, 0);
		input = new Entry ();
		inbox.PackStart (input);
		
		HBox bbox = new HBox ();
		Button get_text = new Button ("Get Text");
		get_text.Clicked += Get_Text;
		bbox.PackStart (get_text, false, false, 0);
		vbx.PackStart (bbox, false, false, 0);
		
		w.Add(vbx);
		w.SetDefaultSize(300, 200);
		w.ShowAll();
		
		Application.Run();
	}
Пример #16
0
        public void SetLabel(Gtk.Widget page, Xwt.Drawing.Image icon, string label)
        {
            string labelNoSpaces = label != null?label.Replace(' ', '-') : null;

            this.label = label;
            this.page  = page;

            if (icon == null)
            {
                icon = ImageService.GetIcon("md-empty");
            }

            if (box == null)
            {
                box = new HBox();
                box.Accessible.SetShouldIgnore(true);
                box.Spacing = -2;

                tabIcon = new ImageView();
                tabIcon.Accessible.SetShouldIgnore(true);
                tabIcon.Show();
                box.PackStart(tabIcon, false, false, 3);

                labelWidget = new ExtendedLabel(label);
                // Ignore the label because the title tab already contains its name
                labelWidget.Accessible.SetShouldIgnore(true);
                labelWidget.UseMarkup = true;
                var alignLabel = new Alignment(0.0f, 0.5f, 1, 1);
                alignLabel.Accessible.SetShouldIgnore(true);
                alignLabel.BottomPadding = 0;
                alignLabel.RightPadding  = 15;
                alignLabel.Add(labelWidget);
                box.PackStart(alignLabel, false, false, 0);

                btnDock             = new ImageButton();
                btnDock.Image       = pixAutoHide;
                btnDock.TooltipText = GettextCatalog.GetString("Auto Hide");
                btnDock.CanFocus    = false;
                //			btnDock.WidthRequest = btnDock.HeightRequest = 17;
                btnDock.Clicked          += OnClickDock;
                btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
                btnDock.WidthRequest      = btnDock.SizeRequest().Width;
                UpdateDockButtonAccessibilityLabels();

                btnClose             = new ImageButton();
                btnClose.Image       = pixClose;
                btnClose.TooltipText = GettextCatalog.GetString("Close");
                btnClose.CanFocus    = false;
                //			btnClose.WidthRequest = btnClose.HeightRequest = 17;
                btnClose.WidthRequest = btnDock.SizeRequest().Width;
                btnClose.Clicked     += delegate {
                    item.Visible = false;
                };
                btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;

                al = new Alignment(0, 0.5f, 1, 1);
                al.Accessible.SetShouldIgnore(true);
                HBox btnBox = new HBox(false, 0);
                btnBox.Accessible.SetShouldIgnore(true);
                btnBox.PackStart(btnDock, false, false, 3);
                btnBox.PackStart(btnClose, false, false, 1);
                al.Add(btnBox);
                box.PackEnd(al, false, false, 3);

                Add(box);
            }

            tabIcon.Image = icon;

            string realLabel, realHelp;

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget.Parent.Show();
                labelWidget.Name = label;
                btnDock.Name     = string.Format("btnDock_{0}", labelNoSpaces ?? string.Empty);
                btnClose.Name    = string.Format("btnClose_{0}", labelNoSpaces ?? string.Empty);
                realLabel        = GettextCatalog.GetString("Close {0}", label);
                realHelp         = GettextCatalog.GetString("Close the {0} pad", label);
            }
            else
            {
                labelWidget.Parent.Hide();
                realLabel = GettextCatalog.GetString("Close pad");
                realHelp  = GettextCatalog.GetString("Close the pad");
            }

            btnClose.Accessible.SetLabel(realLabel);
            btnClose.Accessible.Description = realHelp;

            if (label != null)
            {
                Accessible.Name        = $"DockTab.{labelNoSpaces}";
                Accessible.Description = GettextCatalog.GetString("Switch to the {0} tab", label);
                Accessible.SetTitle(label);
                Accessible.SetLabel(label);
            }

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            minWidth = tabIcon.SizeRequest().Width + al.SizeRequest().Width + 10;

            UpdateBehavior();
            UpdateVisualStyle();
        }
Пример #17
0
	static void SetUpGui ()
	{
		Button b;
		
		Window w = new Window ("Eap Editor");
		//w.BorderWidth = 10;
		Table tableLayout = new Table(10, 2, false);
		//tableLayout.BorderWidth = 6;
		//tableLayout.ColumnSpacing = 6;
		//tableLayout.RowSpacing = 6;
		
		Image im = new Image ("data/icon.png");
//		b = new Button (im);
		tableLayout.Attach (im, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
								
		b = new Button ("App name:");
		tableLayout.Attach (b, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Expand, 0, 0);
		
		b = new Button ("Generic Info:");
		tableLayout.Attach (b, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Expand, 0, 0);
		
		b = new Button ("Comments:");
		tableLayout.Attach (b, 0, 1, 3, 4, AttachOptions.Fill, AttachOptions.Expand, 0, 0);		

		b = new Button ("Executable:");
                tableLayout.Attach (b, 0, 1, 4, 5, AttachOptions.Fill, AttachOptions.Expand, 0, 0);		
		
		b = new Button ("Window Name:");
                tableLayout.Attach (b, 0, 1, 5, 6, AttachOptions.Fill, AttachOptions.Expand, 0, 0);		
		
		b = new Button ("Window Class:");
                tableLayout.Attach (b, 0, 1, 6, 7, AttachOptions.Fill, AttachOptions.Expand, 0, 0);		
		
		b = new Button ("Startup notify:");
                tableLayout.Attach (b, 0, 1, 7, 8, AttachOptions.Fill, AttachOptions.Expand, 0, 0);		
		
		b = new Button ("Wait Exit:");
                tableLayout.Attach (b, 0, 1, 8, 9, AttachOptions.Fill, AttachOptions.Expand, 0, 0);
	
		b = new Button ("Select Icon");
		tableLayout.Attach (b, 1, 2, 0, 1, AttachOptions.Expand, AttachOptions.Expand, 0, 0);
				
		appname_entry = new Entry ();
                tableLayout.Attach (appname_entry, 1, 2, 1, 2);
		
		geninfo_entry = new Entry ();
                tableLayout.Attach (geninfo_entry, 1, 2, 2, 3);
		
		comments_entry = new Entry ();
                tableLayout.Attach (comments_entry, 1, 2, 3, 4);
		
		exe_entry = new Entry ();
                tableLayout.Attach (exe_entry, 1, 2, 4, 5);
		
		winname_entry = new Entry ();
                tableLayout.Attach (winname_entry, 1, 2, 5, 6);
		
		winclass_entry = new Entry ();
                tableLayout.Attach (winclass_entry, 1, 2, 6, 7);
		
		CheckButton start_cbox = new CheckButton ();
		start_cbox.Toggled += toggle_start_cbox;
                tableLayout.Attach (start_cbox, 1, 2, 7, 8);
		
		CheckButton wait_cbox= new CheckButton ();
		wait_cbox.Toggled += toggle_wait_cbox;
                tableLayout.Attach (wait_cbox, 1, 2, 8, 9);	
		
		HBox h = new HBox ();
		h.Spacing = 0;
		tableLayout.Attach (h, 0, 2, 9, 10);
		
		VBox v = new VBox ();		
		b = new Button ("Save");
		v.PackStart (b, true, false, 0);
		h.PackStart (v, true, false, 0);
		
		v = new VBox ();		
		b = new Button ("Cancel");
		v.PackStart (b, true, false, 0);
		h.PackStart (v, true, false, 0);
		
		w.Add (tableLayout);
		w.ShowAll ();
	}
Пример #18
0
        protected void OnBtnAddClicked(object sender, System.EventArgs e)
        {
            // create combobox selection by aggregating clubs
            List <string> clubs    = new List <string>();
            List <string> debaters = new List <string>();

            foreach (Debater d in Tournament.I.Debaters)
            {
                if (!clubs.Contains("@" + d.Club.Name))
                {
                    clubs.Add("@" + d.Club.Name);
                }
                debaters.Add(d.Name.ToString());
            }
            clubs.Sort();
            debaters.Sort();

            //AppendCombobox(clubs);
            //AppendCombobox(debaters);


            ListStore store = new ListStore(typeof(string));

            foreach (string c in clubs)
            {
                store.AppendValues(c);
            }
            foreach (string d in debaters)
            {
                store.AppendValues(d);
            }

            ComboBoxEntry cb = new ComboBoxEntry(store, 0);

            cb.Entry.Completion                  = new EntryCompletion();
            cb.Entry.Completion.Model            = store;
            cb.Entry.Completion.TextColumn       = 0;
            cb.Entry.Completion.InlineCompletion = true;
            HBox hbox = new HBox();
            // btnOk
            Button btnOk = new Button();
            Image  im    = new Image();

            im.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-apply", IconSize.Menu);
            btnOk.Add(im);
            btnOk.Clicked += delegate {
                try {
                    pattern.ParsePattern(pattern + "; " + cb.ActiveText);
                }
                catch (Exception ex) {
                    MiscHelpers.ShowMessage(this,
                                            "Could not add pattern: " + ex.Message,
                                            MessageType.Error);
                    return;
                }
                UpdateGui();
            };
            hbox.PackStart(btnOk, false, false, 0);
            // btnCancel
            Button btnCancel = new Button();

            im        = new Image();
            im.Pixbuf = Stetic.IconLoader.LoadIcon(this, "gtk-cancel", IconSize.Menu);
            btnCancel.Add(im);
            btnCancel.Clicked += delegate {
                UpdateGui();
            };
            hbox.PackStart(btnCancel, false, false, 0);
            // cb as last element
            hbox.PackStart(cb, false, false, 0);
            hbox.ShowAll();
            vbox.PackStart(hbox, false, false, 0);
            alAdd.Hide();
            GtkScrolledWindow.Vadjustment.Value = GtkScrolledWindow.Vadjustment.Upper;
        }
Пример #19
0
        public void SetLabel(Gtk.Widget page, Xwt.Drawing.Image icon, string label)
        {
            this.label = label;
            this.page  = page;
            if (Child != null)
            {
                Gtk.Widget oc = Child;
                Remove(oc);
                oc.Destroy();
            }

            Gtk.HBox box = new HBox();
            box.Spacing = 2;

            if (icon != null)
            {
                tabIcon = new Xwt.ImageView(icon).ToGtkWidget();
                tabIcon.Show();
                box.PackStart(tabIcon, false, false, 0);
            }
            else
            {
                tabIcon = null;
            }

            if (!string.IsNullOrEmpty(label))
            {
                labelWidget = new ExtendedLabel(label);
                labelWidget.DropShadowVisible = true;
                labelWidget.UseMarkup         = true;
                box.PackStart(labelWidget, true, true, 0);
            }
            else
            {
                labelWidget = null;
            }

            btnDock             = new ImageButton();
            btnDock.Image       = pixAutoHide;
            btnDock.TooltipText = GettextCatalog.GetString("Auto Hide");
            btnDock.CanFocus    = false;
//			btnDock.WidthRequest = btnDock.HeightRequest = 17;
            btnDock.Clicked          += OnClickDock;
            btnDock.ButtonPressEvent += (o, args) => args.RetVal = true;
            btnDock.WidthRequest      = btnDock.SizeRequest().Width;

            btnClose             = new ImageButton();
            btnClose.Image       = pixClose;
            btnClose.TooltipText = GettextCatalog.GetString("Close");
            btnClose.CanFocus    = false;
//			btnClose.WidthRequest = btnClose.HeightRequest = 17;
            btnClose.WidthRequest = btnDock.SizeRequest().Width;
            btnClose.Clicked     += delegate {
                item.Visible = false;
            };
            btnClose.ButtonPressEvent += (o, args) => args.RetVal = true;

            Gtk.Alignment al     = new Alignment(0, 0, 1, 1);
            HBox          btnBox = new HBox(false, 3);

            btnBox.PackStart(btnDock, false, false, 0);
            btnBox.PackStart(btnClose, false, false, 0);
            al.Add(btnBox);
            al.LeftPadding = 3;
            al.TopPadding  = 1;
            box.PackEnd(al, false, false, 0);

            Add(box);

            // Get the required size before setting the ellipsize property, since ellipsized labels
            // have a width request of 0
            box.ShowAll();
            Show();

            UpdateBehavior();
            UpdateVisualStyle();
        }
Пример #20
0
        public MultiPropertyDialog(int x, int y, int width, int height, int tabWidth = 160) : base(WindowType.Toplevel)
        {
            var buttonsHBox = new HBox(false, 0);

            var suffix    = GLTheme.DialogScaling >= 2.0f ? "@2x" : "";
            var buttonYes = new FlatButton(Gdk.Pixbuf.LoadFromResource($"FamiStudio.Resources.Yes{suffix}.png"));
            var buttonNo  = new FlatButton(Gdk.Pixbuf.LoadFromResource($"FamiStudio.Resources.No{suffix}.png"));

            buttonYes.Show();
            buttonYes.ButtonPressEvent += ButtonYes_ButtonPressEvent;
            buttonNo.Show();
            buttonNo.ButtonPressEvent += ButtonNo_ButtonPressEvent;

            buttonsHBox.PackStart(buttonYes, false, false, 0);
            buttonsHBox.PackStart(buttonNo, false, false, 0);
            buttonsHBox.HeightRequest = 40;
            buttonsHBox.Show();

            var buttonsAlign = new Alignment(1.0f, 0.5f, 0.0f, 0.0f);

            buttonsAlign.TopPadding = 5;
            buttonsAlign.Show();
            buttonsAlign.Add(buttonsHBox);

            var vbox = new VBox();

            buttonsVBox = new VBox();
            buttonsVBox.Show();
            buttonsVBox.WidthRequest = tabWidth;

            var buttonsVBoxPadding = new Alignment(0.0f, 0.0f, 0.0f, 0.0f);

            buttonsVBoxPadding.RightPadding = 5;
            buttonsVBoxPadding.Show();
            buttonsVBoxPadding.Add(buttonsVBox);

            propsVBox = new VBox();
            propsVBox.Show();
            propsVBox.HeightRequest = 210;

            mainHbox = new HBox();
            mainHbox.Show();
            mainHbox.PackStart(buttonsVBoxPadding, false, false, 0);
            mainHbox.PackStart(propsVBox, true, true, 0);

            vbox.Show();
            vbox.PackStart(mainHbox);
            vbox.PackStart(buttonsAlign, false, false, 0);

            Add(vbox);

            WidthRequest  = width;
            HeightRequest = height;

            BorderWidth     = 5;
            Resizable       = false;
            Decorated       = false;
            KeepAbove       = true;
            Modal           = true;
            SkipTaskbarHint = true;
#if FAMISTUDIO_LINUX
            TransientFor = FamiStudioForm.Instance;
            SetPosition(WindowPosition.CenterOnParent);
#else
            Move(x, y);
#endif
        }
Пример #21
0
        private void InitUI()
        {
            try
            {
                //Tab1
                VBox vboxTab1 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //Ord
                Entry       entryOrd = new Entry();
                BOWidgetBox boxLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_order"), entryOrd);
                vboxTab1.PackStart(boxLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true));

                //Code
                Entry       entryCode = new Entry();
                BOWidgetBox boxCode   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), entryCode);
                vboxTab1.PackStart(boxCode, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true));

                //Designation
                Entry       entryDesignation = new Entry();
                BOWidgetBox boxDesignation   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_designation"), entryDesignation);
                vboxTab1.PackStart(boxDesignation, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumericExtended, true));

                //FileTemplate
                FileChooserButton fileChooserFileTemplate = new FileChooserButton(string.Empty, FileChooserAction.Open)
                {
                    HeightRequest = 23
                };
                Image fileChooserImagePreviewFileTemplate = new Image()
                {
                    WidthRequest = _sizefileChooserPreview.Width, HeightRequest = _sizefileChooserPreview.Height
                };
                Frame fileChooserFrameImagePreviewFileTemplate = new Frame();
                fileChooserFrameImagePreviewFileTemplate.ShadowType = ShadowType.None;
                fileChooserFrameImagePreviewFileTemplate.Add(fileChooserImagePreviewFileTemplate);
                fileChooserFileTemplate.SetFilename(((sys_configurationprinterstemplates)DataSourceRow).FileTemplate);
                fileChooserFileTemplate.Filter            = Utils.GetFileFilterTemplates();
                fileChooserFileTemplate.SelectionChanged += (sender, eventArgs) => fileChooserImagePreviewFileTemplate.Pixbuf = Utils.ResizeAndCropFileToPixBuf((sender as FileChooserButton).Filename, new System.Drawing.Size(fileChooserImagePreviewFileTemplate.WidthRequest, fileChooserImagePreviewFileTemplate.HeightRequest));
                BOWidgetBox boxfileChooserFileTemplate = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_file"), fileChooserFileTemplate);
                HBox        hboxfileChooserAndimagePreviewFileTemplate = new HBox(false, _boxSpacing);
                hboxfileChooserAndimagePreviewFileTemplate.PackStart(boxfileChooserFileTemplate, true, true, 0);
                hboxfileChooserAndimagePreviewFileTemplate.PackStart(fileChooserFrameImagePreviewFileTemplate, false, false, 0);
                vboxTab1.PackStart(hboxfileChooserAndimagePreviewFileTemplate, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxfileChooserFileTemplate, _dataSourceRow, "FileTemplate", string.Empty, false));

                //FinancialTemplate
                CheckButton checkButtonFinancialTemplate = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_financialtemplate"));
                vboxTab1.PackStart(checkButtonFinancialTemplate, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonFinancialTemplate, _dataSourceRow, "FinancialTemplate"));

                //Disabled
                CheckButton checkButtonDisabled = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_disabled"));
                if (_dialogMode == DialogMode.Insert)
                {
                    checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled;
                }
                vboxTab1.PackStart(checkButtonDisabled, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled"));

                //Append Tab
                _notebook.AppendPage(vboxTab1, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_detail")));
            }
            catch (System.Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Пример #22
0
        private void ConfirmLoadAssembly(string [] selection)
        {
            Gtk.Entry     e_sPlugin          = null;
            string        l_sChoosenPlayer   = "";
            MessageDialog confirmationDialog = null;

            foreach (string s in selection)
            {
                confirmationDialog = new MessageDialog(this.Window,
                                                       DialogFlags.Modal |
                                                       DialogFlags.DestroyWithParent,
                                                       MessageType.Question,
                                                       ButtonsType.YesNo,
                                                       "What extension " + Path.GetFileName(s) + " should handle ?");
                VBox vbox = confirmationDialog.VBox;
                HBox hbox = new HBox(false, 4);
                vbox.PackStart(hbox, true, true, 0);

                e_sPlugin = new Gtk.Entry(".foobar");
                hbox.PackStart(e_sPlugin, false, false, 0);

                confirmationDialog.ShowAll();
                int res = confirmationDialog.Run();
                confirmationDialog.Hide();
                confirmationDialog.Dispose();

                if (res == (int)ResponseType.Yes)
                {
                    try
                    {
                        FileSelection fs = new FileSelection("Select your favorite player");
                        fs.HideFileopButtons();
                        CConfig config = CConfig.Instance;
                        fs.Complete((string)config["Interface/currentPath"]);
                        fs.Resizable = true;
                        fs.Modal     = true;
                        int r = fs.Run();
                        fs.Hide();
                        fs.Dispose();
                        if (r == (int)ResponseType.Ok)
                        {
                            l_sChoosenPlayer = fs.Selections[0];
                            plugins.LoadAssembly((string)((Gtk.Entry)e_sPlugin).Text, s);
                            try
                            {
                                CPluginManager.SetStatic(plugins.GetOwningType((string)((Gtk.Entry)e_sPlugin).Text), "Player", l_sChoosenPlayer);
                            }
                            catch (Exception e) { Console.WriteLine("Player not found"); }
                            PopulatePluginList();
                            ((Gtk.Button)m_xXML["applyButton"]).Sensitive = true;
                        }
                        else
                        {
                            throw new Exception("Loading aborted by user.");
                        }
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Plugin error: " + e.Message);
                    }
                }
            }
        }
Пример #23
0
        public void It_should_render_text_with_different_line_heights()
        {
            var renderer = new PdfRenderer();
            var content  = new HBox {
                Width = SizeUnit.Unlimited
            };

            content.AddComponent(new Panel
            {
                Width           = 100,
                Height          = SizeUnit.Unlimited,
                BackgroundColor = Color.Yellow,
                Margin          = new Spacer(1),
                Inner           = new Label
                {
                    TextColor  = Color.Red,
                    Font       = new FontInfo(TestFontFamily.Serif, 10, FontInfoStyle.Underline | FontInfoStyle.Italic),
                    Text       = "Hello my friend!\nIt's nice to see you!\n\nWhat is a nice and sunny day, is not it?",
                    LineHeight = 1.2f
                }
            });

            content.AddComponent(new Panel
            {
                Width           = 100,
                Height          = SizeUnit.Unlimited,
                BackgroundColor = Color.Yellow,
                Margin          = new Spacer(1),
                Inner           = new Label
                {
                    TextColor  = Color.Red,
                    Font       = new FontInfo(TestFontFamily.Serif, 10, FontInfoStyle.Underline | FontInfoStyle.Italic),
                    Text       = "Hello my friend!\nIt's nice to see you!\n\nWhat is a nice and sunny day, is not it?",
                    LineHeight = 2f
                }
            });

            content.AddComponent(new Panel
            {
                Width           = 100,
                Height          = SizeUnit.Unlimited,
                BackgroundColor = Color.Yellow,
                Margin          = new Spacer(1),
                Inner           = new Label
                {
                    TextColor  = Color.Red,
                    Font       = new FontInfo(TestFontFamily.Serif, 10, FontInfoStyle.Underline | FontInfoStyle.Italic),
                    Text       = "Hello my friend!\nIt's nice to see you!\n\nWhat is a nice and sunny day, is not it?",
                    LineHeight = 0.8f
                }
            });

            var form = new Form(content);

            var doc  = new PdfDocument();
            var page = doc.AddPage();

            page.Width  = 300;
            page.Height = 400;
            renderer.Render(form, page);
            PdfImageComparer.ComparePdfs("text_box_line_height", doc);
        }
Пример #24
0
        public void It_should_render_text_with_alignments()
        {
            var renderer = new PdfRenderer();

            var labelBox = new HBox {
                Width = SizeUnit.Unlimited
            };

            foreach (var align in new[] { TextAlignment.Left, TextAlignment.Right, TextAlignment.Center, TextAlignment.Justify })
            {
                labelBox.AddComponent(new Panel
                {
                    Width           = 100,
                    Height          = SizeUnit.Unlimited,
                    BackgroundColor = Color.Yellow,
                    Margin          = new Spacer(1),
                    Border          = new Border(1, Color.Black),
                    Padding         = new Spacer(2),
                    Inner           = new Label
                    {
                        Width         = SizeUnit.Unlimited,
                        TextColor     = Color.Red,
                        TextAlignment = align,
                        Font          = new FontInfo(TestFontFamily.Serif, 10, FontInfoStyle.Underline | FontInfoStyle.Italic),
                        Text          = "Hello my friend!\nIt's nice to see you!\n\nWhat is a nice and sunny day, is not it?"
                    }
                });
            }

            var areaBox = new HBox {
                Width = SizeUnit.Unlimited
            };

            foreach (var align in new[] { TextAlignment.Left, TextAlignment.Right, TextAlignment.Center, TextAlignment.Justify })
            {
                var textBox = new TextBox
                {
                    Width         = SizeUnit.Unlimited,
                    TextAlignment = align
                };
                textBox.AddComponent(new Label
                {
                    TextColor = Color.Red,
                    Text      = "Hi Bob!",
                    Font      = new FontInfo(TestFontFamily.Serif, 10, FontInfoStyle.Underline | FontInfoStyle.Italic)
                });

                textBox.AddComponent(new Link
                {
                    TextColor = Color.Black,
                    Text      = "Check out this: ",
                    Font      = new FontInfo(TestFontFamily.Serif, 12, FontInfoStyle.Regular)
                });
                textBox.AddComponent(new Link
                {
                    TextColor = Color.Purple,
                    Text      = "great link!!!",
                    Font      = new FontInfo(TestFontFamily.Serif, 8, FontInfoStyle.Underline),
                    Uri       = "http://google.com"
                });
                areaBox.AddComponent(new Panel
                {
                    Width           = 100,
                    Height          = SizeUnit.Unlimited,
                    BackgroundColor = Color.Green,
                    Margin          = new Spacer(1),
                    Border          = new Border(1, Color.Black),
                    Padding         = new Spacer(2),
                    Inner           = textBox
                });
            }

            var content = new VBox {
                Width = SizeUnit.Unlimited
            };

            content.AddComponent(labelBox);
            content.AddComponent(areaBox);

            var form = new Form(content);

            var doc  = new PdfDocument();
            var page = doc.AddPage();

            page.Width  = 400;
            page.Height = 400;
            renderer.Render(form, page);
            PdfImageComparer.ComparePdfs("text_box_align", doc);
        }
Пример #25
0
        public void It_should_render_text()
        {
            var renderer = new PdfRenderer();
            var content  = new HBox {
                Width = SizeUnit.Unlimited
            };

            content.AddComponent(new Panel
            {
                Width           = 100,
                Height          = SizeUnit.Unlimited,
                BackgroundColor = Color.Yellow,
                Margin          = new Spacer(1),
                Border          = new Border(1, Color.Black),
                Padding         = new Spacer(2),
                Inner           = new Label
                {
                    TextColor = Color.Red,
                    Font      = new FontInfo(TestFontFamily.Serif, 10, FontInfoStyle.Underline | FontInfoStyle.Italic),
                    Text      = "Hello my friend!\nIt's nice to see you!\n\nWhat is a nice and sunny day, is not it?"
                }
            });

            content.AddComponent(new Panel
            {
                Width           = 100,
                Height          = SizeUnit.Unlimited,
                BackgroundColor = Color.DarkSeaGreen,
                Margin          = new Spacer(1),
                Border          = new Border(1, Color.Black),
                Padding         = new Spacer(2),
                Inner           = new Link
                {
                    TextColor = Color.Blue,
                    Font      = new FontInfo(TestFontFamily.Serif, 14, FontInfoStyle.Bold),
                    Text      = "How are you doing today?",
                    Uri       = "http://google.com"
                }
            });

            var textBox = new TextBox();

            textBox.AddComponent(new Label {
                Text = "Hello!\n", TextColor = Color.Green, Font = new FontInfo(TestFontFamily.Monospace, 20, FontInfoStyle.Underline)
            });
            textBox.AddComponent(new Label {
                Text = "Hi Bob, nice to see you after", TextColor = Color.Black, Font = new FontInfo(TestFontFamily.SansSerif, 10)
            });
            textBox.AddComponent(new Label {
                Text = "20", TextColor = Color.Red, Font = new FontInfo(TestFontFamily.SansSerif, 10, FontInfoStyle.Bold)
            });
            textBox.AddComponent(new Label {
                Text = "years!\n", TextColor = Color.Black, Font = new FontInfo(TestFontFamily.SansSerif, 10)
            });
            textBox.AddComponent(new Label {
                Text = "I'm sure you'd love to see my new", TextColor = Color.Black, Font = new FontInfo(TestFontFamily.SansSerif, 10)
            });
            textBox.AddComponent(new Link {
                Text = "web", TextColor = Color.Blue, Font = new FontInfo(TestFontFamily.SansSerif, 12, FontInfoStyle.Italic), Uri = "http://google.com"
            });
            textBox.AddComponent(new Link {
                Text = "site", TextColor = Color.Green, TextContinuation = true, Font = new FontInfo(TestFontFamily.SansSerif, 12, FontInfoStyle.Italic), Uri = "http://google.com"
            });
            content.AddComponent(new Panel
            {
                Width           = SizeUnit.Unlimited,
                Height          = SizeUnit.Unlimited,
                BackgroundColor = Color.LightYellow,
                Margin          = new Spacer(1),
                Border          = new Border(1, Color.Black),
                Padding         = new Spacer(2),
                Inner           = textBox
            });

            var form = new Form(content);

            var doc  = new PdfDocument();
            var page = doc.AddPage();

            page.Width  = 320;
            page.Height = 400;
            renderer.Render(form, page);
            PdfImageComparer.ComparePdfs("text_box", doc);
        }
Пример #26
0
        public void Run(object o, EventArgs e)
        {
            Console.WriteLine("EXECUTING ExiflowCreateVersion EXTENSION");

            Window win = new Window("window");

            dialog = new Dialog(dialog_name, win, Gtk.DialogFlags.DestroyWithParent);

            Frame frame_versions = new Frame("new version");
            HBox  hbox_versions  = new HBox();

            frame_versions.Child = hbox_versions;

            // RadioButtons left
            VBox vbox_versions_left = new VBox();

            hbox_versions.PackStart(vbox_versions_left, true, false, 0);
            // EntryBox right
            VBox vbox_versions_right = new VBox();

            hbox_versions.PackStart(vbox_versions_right, true, false, 0);
            vbox_versions_right.PackStart(new_version_entry, true, false, 0);
            vbox_versions_right.PackStart(overwrite_file_ok, true, false, 0);

            Frame frame_resulting_filename = new Frame("resulting filename");
            VBox  vbox_resulting_filename  = new VBox();

            frame_resulting_filename.Child = vbox_resulting_filename;
            vbox_resulting_filename.PackStart(new_filename_label, true, false, 0);
            vbox_resulting_filename.PackStart(overwrite_warning_label, true, false, 0);

            Frame frame_open_with = new Frame("open with");
            VBox  vbox_open_with  = new VBox();

            frame_open_with.Child = vbox_open_with;
            vbox_open_with.PackStart(new_filename_label, true, false, 0);


            new_version_entry.Changed += new EventHandler(on_new_version_entry_changed);
            overwrite_file_ok.Toggled += new EventHandler(on_overwrite_file_ok_toggled);

            gtk_cancel.UseStock = true;
            gtk_cancel.Clicked += CancelClicked;
            gtk_ok.UseStock     = true;
            gtk_ok.Clicked     += OkClicked;

            foreach (Photo p in App.Instance.Organizer.SelectedPhotos())
            {
                this.currentphoto = p;
                //Console.WriteLine ("MimeType: "+ Gnome.Vfs.MimeType.GetMimeTypeForUri (p.DefaultVersionUri.ToString ()));

                //uint default_id = p.DefaultVersionId;
                //Console.WriteLine ("DefaultVersionId: "+default_id);
                //string filename = GetNextIntelligentVersionFileNames (p)[0];

                string [] possiblefilenames = GetNextIntelligentVersionFileNames(p);
                new_version_entry.Text = GetVersionName(possiblefilenames[0].ToString());

                for (int i = 0; i < possiblefilenames.Length; i++)
                {
                    Gtk.RadioButton rb = new Gtk.RadioButton(versionrb, GetVersionName(possiblefilenames[i].ToString()));
                    rb.Clicked += new EventHandler(on_versionrb_changed);
                    vbox_versions_left.PackStart(rb, true, false, 0);
                }

                ComboBox owcb = GetComboBox();
                vbox_open_with.PackStart(owcb, false, true, 0);

                dialog.Modal        = false;
                dialog.TransientFor = null;
            }

            VBox vbox_main = new VBox();

            vbox_main.PackStart(frame_versions);
            vbox_main.PackStart(frame_resulting_filename);
            //vbox_main.PackStart (frame_open_with);

            HButtonBox hbb_ok_cancel = new HButtonBox();

            hbb_ok_cancel.PackStart(gtk_cancel, true, false, 0);
            hbb_ok_cancel.PackStart(gtk_ok, true, false, 0);

            dialog.VBox.PackStart(vbox_main, false, true, 0);
            dialog.ActionArea.PackStart(hbb_ok_cancel, false, true, 0);
            dialog.ShowAll();
        }
            private Widget GetRightPane()
            {
                VBox vbox = new VBox ();

                // labels
                moveNumberLabel = new Label ();
                nagCommentLabel = new Label ();
                nagCommentLabel.Xalign = 0;
                HBox hbox = new HBox ();
                hbox.PackStart (moveNumberLabel, false, false,
                        2);
                hbox.PackStart (nagCommentLabel, false, false,
                        2);

                vbox.PackStart (hbox, false, false, 2);

                // board
                chessGameDetailsBox = new VBox ();
                chessGameDetailsBox.PackStart (gameView,
                                   true, true, 4);

                vbox.PackStart (chessGameDetailsBox, true,
                        true, 2);

                // buttons
                playButton = new PlayPauseButton ();
                playButton.PlayNextEvent +=
                    on_play_next_event;

                firstButton = new Button ();
                firstButton.Clicked += on_first_clicked;
                firstButton.Image =
                    new Image (Stock.GotoFirst,
                           IconSize.Button);
                prevButton = new Button ();
                prevButton.Clicked += on_prev_clicked;
                prevButton.Image =
                    new Image (Stock.GoBack,
                           IconSize.Button);
                nextButton = new Button ();
                nextButton.Clicked += on_next_clicked;
                nextButton.Image =
                    new Image (Stock.GoForward,
                           IconSize.Button);
                lastButton = new Button ();
                lastButton.Clicked += on_last_clicked;
                lastButton.Image =
                    new Image (Stock.GotoLast,
                           IconSize.Button);

                HBox bbox = new HBox ();
                bbox.PackStart (firstButton, false, false, 1);
                bbox.PackStart (prevButton, false, false, 1);
                bbox.PackStart (playButton, false, false, 1);
                bbox.PackStart (nextButton, false, false, 1);
                bbox.PackStart (lastButton, false, false, 1);
                Alignment alignment =
                    new Alignment (0.5f, 1, 0, 0);
                alignment.Add (bbox);
                alignment.Show ();

                vbox.PackStart (alignment, false, false, 2);
                book.AppendPage (gamesListWidget,
                         new Label (Catalog.
                                GetString
                                ("Games")));
                book.AppendPage (vbox,
                         new Label (Catalog.
                                GetString
                                ("Current Game")));

                return book;
            }
Пример #28
0
        /// <summary>Initializes a new instance of the <see cref="SeriesView" /> class</summary>
        public SeriesView(ViewBase owner) : base(owner)
        {
            Builder builder = MasterView.BuilderFromResource("ApsimNG.Resources.Glade.SeriesView.glade");

            vbox1       = (VBox)builder.GetObject("vbox1");
            table1      = (Table)builder.GetObject("table1");
            label4      = (Label)builder.GetObject("label4");
            label5      = (Label)builder.GetObject("label5");
            _mainWidget = vbox1;

            graphView1 = new GraphView(this);
            vbox1.PackStart(graphView1.MainWidget, true, true, 0);

            checkpointDropDown    = new DropDownView(this);
            dataSourceDropDown    = new DropDownView(this);
            xDropDown             = new DropDownView(this);
            yDropDown             = new DropDownView(this);
            x2DropDown            = new DropDownView(this);
            y2DropDown            = new DropDownView(this);
            seriesDropDown        = new DropDownView(this);
            lineTypeDropDown      = new DropDownView(this);
            markerTypeDropDown    = new DropDownView(this);
            colourDropDown        = new ColourDropDownView(this);
            lineThicknessDropDown = new DropDownView(this);
            markerSizeDropDown    = new DropDownView(this);

            checkBoxView1             = new CheckBoxView(this);
            checkBoxView1.TextOfLabel = "on top?";
            checkBoxView2             = new CheckBoxView(this);
            checkBoxView2.TextOfLabel = "on right?";
            checkBoxView3             = new CheckBoxView(this);
            checkBoxView3.TextOfLabel = "cumulative?";
            checkBoxView4             = new CheckBoxView(this);
            checkBoxView4.TextOfLabel = "cumulative?";
            checkBoxView5             = new CheckBoxView(this);
            checkBoxView5.TextOfLabel = "Show in legend?";
            checkBoxView6             = new CheckBoxView(this);
            checkBoxView6.TextOfLabel = "Include series name in legend?";

            editView1 = new EditView(this);

            table1.Attach(checkpointDropDown.MainWidget, 1, 2, 0, 1, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(dataSourceDropDown.MainWidget, 1, 2, 1, 2, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(xDropDown.MainWidget, 1, 2, 2, 3, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(yDropDown.MainWidget, 1, 2, 3, 4, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(y2DropDown.MainWidget, 1, 2, 4, 5, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(x2DropDown.MainWidget, 1, 2, 5, 6, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(seriesDropDown.MainWidget, 1, 2, 6, 7, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(lineTypeDropDown.MainWidget, 1, 2, 7, 8, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(markerTypeDropDown.MainWidget, 1, 2, 8, 9, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(colourDropDown.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);

            Image    helpImage = new Image(null, "ApsimNG.Resources.help.png");
            EventBox ebHelp    = new EventBox();

            ebHelp.Add(helpImage);
            ebHelp.ButtonPressEvent += Help_ButtonPressEvent;
            HBox filterBox = new HBox();

            filterBox.PackStart(editView1.MainWidget, true, true, 0);
            filterBox.PackEnd(ebHelp, false, true, 0);

            //table1.Attach(editView1.MainWidget, 1, 2, 9, 10, AttachOptions.Fill, 0, 10, 2);
            table1.Attach(filterBox, 1, 2, 10, 11, AttachOptions.Fill, 0, 10, 2);

            table1.Attach(checkBoxView1.MainWidget, 2, 3, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView2.MainWidget, 2, 3, 3, 4, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView3.MainWidget, 3, 4, 2, 3, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView4.MainWidget, 3, 4, 3, 4, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(checkBoxView5.MainWidget, 2, 4, 9, 10, AttachOptions.Fill, 0, 0, 0);
            table1.Attach(checkBoxView6.MainWidget, 2, 4, 10, 11, AttachOptions.Fill, 0, 0, 0);

            table1.Attach(lineThicknessDropDown.MainWidget, 3, 4, 7, 8, AttachOptions.Fill, 0, 0, 5);
            table1.Attach(markerSizeDropDown.MainWidget, 3, 4, 8, 9, AttachOptions.Fill, 0, 0, 5);
            _mainWidget.Destroyed += _mainWidget_Destroyed;
        }
            public ObservingGamePage(ICSGameObserverWidget
						  widget,
						  MoveDetails details)
                : base()
            {
                this.win = widget;
                gameId = details.gameNumber;

                InitGameWidget (details);

                movesWidget = new ChessMovesWidget ();
                movesWidget.CursorChanged += OnCursorChanged;

                gameWidget.WhiteAtBottom =
                    !details.blackAtBottom;
                board.side = details.blackAtBottom;
                gameWidget.whiteClock.Configure (details.
                                 initial_time
                                 * 60,
                                 (uint)
                                 details.
                                 increment);
                gameWidget.blackClock.Configure (details.
                                 initial_time
                                 * 60,
                                 (uint)
                                 details.
                                 increment);

                white = details.white;
                black = details.black;
                gameWidget.White = white;
                gameWidget.Black = black;

                gameWidget.Show ();
                board.Show ();
                movesWidget.Show ();

                HBox box = new HBox ();
                Button closeButton;
                if (Config.WindowsBuild)
                    closeButton =
                        new Button (Stock.Close);
                else
                  {
                      closeButton = new Button ("");
                      closeButton.Image =
                          new Image (Stock.Close,
                                 IconSize.Menu);
                  }
                resultLabel = new Label ();
                resultLabel.Xalign = 0;
                box.PackStart (resultLabel, true, true, 2);
                box.PackStart (closeButton, false, false, 2);

                PackStart (box, false, true, 2);

                box = new HBox ();
                ScrolledWindow scroll = new ScrolledWindow ();
                scroll.HscrollbarPolicy = PolicyType.Never;
                scroll.VscrollbarPolicy =
                    PolicyType.Automatic;
                scroll.Add (movesWidget);

                VBox movesBox = new VBox ();
                movesBox.PackStart (scroll, true, true, 2);
                AddGameNavigationButtons (movesBox);

                box.PackStart (gameWidget, true, true, 2);
                box.PackStart (movesBox, false, true, 2);
                PackStart (box, true, true, 2);

                closeButton.Clicked += OnCloseButtonClicked;

                Update (details);
                ShowAll ();
            }
Пример #30
0
        public override void Initialize(NodeBuilder[] builders, TreePadOption[] options, string menuPath)
        {
            base.Initialize(builders, options, menuPath);

            UnitTestService.TestSuiteChanged += OnTestSuiteChanged;
            paned = new VPaned();

            VBox            vbox       = new VBox();
            DockItemToolbar topToolbar = Window.GetToolbar(DockPositionType.Top);

            var hbox = new HBox {
                Spacing = 6
            };

            hbox.PackStart(new ImageView(ImageService.GetIcon("md-execute-all", IconSize.Menu)), false, false, 0);
            hbox.PackStart(new Label(GettextCatalog.GetString("Run All")), false, false, 0);
            buttonRunAll = new Button(hbox);
            buttonRunAll.Accessible.Name        = "TestPad.RunAll";
            buttonRunAll.Accessible.Description = GettextCatalog.GetString("Start a test run and run all the tests");
            buttonRunAll.Clicked    += new EventHandler(OnRunAllClicked);
            buttonRunAll.Sensitive   = true;
            buttonRunAll.TooltipText = GettextCatalog.GetString("Run all tests");
            topToolbar.Add(buttonRunAll);

            buttonStop                 = new Button(new ImageView(Ide.Gui.Stock.Stop, IconSize.Menu));
            buttonStop.Clicked        += new EventHandler(OnStopClicked);
            buttonStop.Sensitive       = false;
            buttonStop.TooltipText     = GettextCatalog.GetString("Cancel running test");
            buttonStop.Accessible.Name = "TestPad.StopAll";
            buttonStop.Accessible.SetTitle(GettextCatalog.GetString(("Cancel")));
            buttonStop.Accessible.Description = GettextCatalog.GetString("Stops the current test run");
            topToolbar.Add(buttonStop);
            topToolbar.ShowAll();

            vbox.PackEnd(base.Control, true, true, 0);
            vbox.FocusChain = new Gtk.Widget [] { base.Control };

            paned.Pack1(vbox, true, true);

            detailsPad = new VBox();

            EventBox eb     = new EventBox();
            HBox     header = new HBox();

            eb.Add(header);

            detailLabel         = new HeaderLabel();
            detailLabel.Padding = 6;

            Button hb = new Button(new ImageView("gtk-close", IconSize.SmallToolbar));

            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnCloseDetails);
            header.PackEnd(hb, false, false, 0);

            hb          = new Button(new ImageView("gtk-go-back", IconSize.SmallToolbar));
            hb.Relief   = ReliefStyle.None;
            hb.Clicked += new EventHandler(OnGoBackTest);
            header.PackEnd(hb, false, false, 0);

            header.Add(detailLabel);
            Gdk.Color hcol = eb.Style.Background(StateType.Normal);
            hcol.Red   = (ushort)(((double)hcol.Red) * 0.9);
            hcol.Green = (ushort)(((double)hcol.Green) * 0.9);
            hcol.Blue  = (ushort)(((double)hcol.Blue) * 0.9);
            //	eb.ModifyBg (StateType.Normal, hcol);

            detailsPad.PackStart(eb, false, false, 0);

            VPaned panedDetails = new VPaned();

            panedDetails.BorderWidth = 3;
            VBox boxPaned1 = new VBox();

            chart = new TestChart();
            chart.SelectionChanged += new EventHandler(OnChartDateChanged);

            var chartWidget = chart.GetNativeWidget <Widget> ();

            chartWidget.ButtonPressEvent += OnChartButtonPress;
            chartWidget.HeightRequest     = 50;

            Toolbar toolbar = new Toolbar();

            toolbar.IconSize     = IconSize.SmallToolbar;
            toolbar.ToolbarStyle = ToolbarStyle.Icons;
            toolbar.ShowArrow    = false;
            ToolButton but = new ToolButton("gtk-zoom-in");

            but.Clicked += new EventHandler(OnZoomIn);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-zoom-out");
            but.Clicked += new EventHandler(OnZoomOut);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-back");
            but.Clicked += new EventHandler(OnChartBack);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-go-forward");
            but.Clicked += new EventHandler(OnChartForward);
            toolbar.Insert(but, -1);

            but          = new ToolButton("gtk-goto-last");
            but.Clicked += new EventHandler(OnChartLast);
            toolbar.Insert(but, -1);

            boxPaned1.PackStart(toolbar, false, false, 0);
            boxPaned1.PackStart(chart, true, true, 0);

            panedDetails.Pack1(boxPaned1, false, false);

            // Detailed test information --------

            infoBook = new ButtonNotebook();
            infoBook.PageLoadRequired += new EventHandler(OnPageLoadRequired);

            // Info - Group summary

            Frame          tf = new Frame();
            ScrolledWindow sw = new ScrolledWindow();

            detailsTree = new TreeView {
                Name = "testPadDetailsTree"
            };

            detailsTree.HeadersVisible = true;
            detailsTree.RulesHint      = true;
            detailsStore = new ListStore(typeof(object), typeof(string), typeof(string), typeof(string), typeof(string));
            SemanticModelAttribute modelAttr = new SemanticModelAttribute("store__UnitTest", "store__Name", "store__Passed",
                                                                          "store__ErrorsAndFailures", "store__Ignored");

            SCM.TypeDescriptor.AddAttributes(detailsStore, modelAttr);

            CellRendererText trtest = new CellRendererText();
            CellRendererText tr;

            TreeViewColumn col3 = new TreeViewColumn();

            col3.Expand = false;
//			col3.Alignment = 0.5f;
            col3.Widget = new ImageView(TestStatusIcon.Success);
            col3.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col3.PackStart(tr, false);
            col3.AddAttribute(tr, "markup", 2);
            detailsTree.AppendColumn(col3);

            TreeViewColumn col4 = new TreeViewColumn();

            col4.Expand = false;
//			col4.Alignment = 0.5f;
            col4.Widget = new ImageView(TestStatusIcon.Failure);
            col4.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col4.PackStart(tr, false);
            col4.AddAttribute(tr, "markup", 3);
            detailsTree.AppendColumn(col4);

            TreeViewColumn col5 = new TreeViewColumn();

            col5.Expand = false;
//			col5.Alignment = 0.5f;
            col5.Widget = new ImageView(TestStatusIcon.NotRun);
            col5.Widget.Show();
            tr = new CellRendererText();
//			tr.Xalign = 0.5f;
            col5.PackStart(tr, false);
            col5.AddAttribute(tr, "markup", 4);
            detailsTree.AppendColumn(col5);

            TreeViewColumn col1 = new TreeViewColumn();

//			col1.Resizable = true;
//			col1.Expand = true;
            col1.Title = "Test";
            col1.PackStart(trtest, true);
            col1.AddAttribute(trtest, "markup", 1);
            detailsTree.AppendColumn(col1);

            detailsTree.Model = detailsStore;

            sw.Add(detailsTree);
            tf.Add(sw);
            tf.ShowAll();

            TestSummaryPage = infoBook.AddPage(GettextCatalog.GetString("Summary"), tf);

            // Info - Regressions list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            regressionTree = new TreeView {
                Name = "testPadRegressionTree"
            };
            regressionTree.HeadersVisible = false;
            regressionTree.RulesHint      = true;
            regressionStore = new ListStore(typeof(object), typeof(string), typeof(Xwt.Drawing.Image));
            SemanticModelAttribute regressionModelAttr = new SemanticModelAttribute("store__UnitTest", "store__Name", "store__Icon");

            SCM.TypeDescriptor.AddAttributes(detailsStore, regressionModelAttr);

            CellRendererText trtest2 = new CellRendererText();
            var pr = new CellRendererImage();

            TreeViewColumn col = new TreeViewColumn();

            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            regressionTree.AppendColumn(col);
            regressionTree.Model = regressionStore;
            sw.Add(regressionTree);
            tf.ShowAll();

            TestRegressionsPage = infoBook.AddPage(GettextCatalog.GetString("Regressions"), tf);

            // Info - Failed tests list

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            failedTree = new TreeView();
            failedTree.HeadersVisible = false;
            failedTree.RulesHint      = true;
            failedStore = new ListStore(typeof(object), typeof(string), typeof(Xwt.Drawing.Image));
            SemanticModelAttribute failedModelAttr = new SemanticModelAttribute("store__UnitTest", "store__Name", "store__Icon");

            SCM.TypeDescriptor.AddAttributes(failedStore, failedModelAttr);

            trtest2 = new CellRendererText();
            pr      = new CellRendererImage();

            col = new TreeViewColumn();
            col.PackStart(pr, false);
            col.AddAttribute(pr, "image", 2);
            col.PackStart(trtest2, false);
            col.AddAttribute(trtest2, "markup", 1);
            failedTree.AppendColumn(col);
            failedTree.Model = failedStore;
            sw.Add(failedTree);
            tf.ShowAll();

            TestFailuresPage = infoBook.AddPage(GettextCatalog.GetString("Failed tests"), tf);

            // Info - results

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            resultView          = new TextView();
            resultView.Editable = false;
            sw.Add(resultView);
            tf.ShowAll();
            TestResultPage = infoBook.AddPage(GettextCatalog.GetString("Result"), tf);

            // Info - Output

            tf = new Frame();
            sw = new ScrolledWindow();
            tf.Add(sw);
            outputView          = new TextView();
            outputView.Editable = false;
            sw.Add(outputView);
            tf.ShowAll();
            TestOutputPage = infoBook.AddPage(GettextCatalog.GetString("Output"), tf);

            panedDetails.Pack2(infoBook, true, true);
            detailsPad.PackStart(panedDetails, true, true, 0);
            paned.Pack2(detailsPad, true, true);

            paned.ShowAll();

            infoBook.HidePage(TestResultPage);
            infoBook.HidePage(TestOutputPage);
            infoBook.HidePage(TestSummaryPage);
            infoBook.HidePage(TestRegressionsPage);
            infoBook.HidePage(TestFailuresPage);

            detailsPad.Sensitive = false;
            detailsPad.Hide();

            detailsTree.RowActivated    += new Gtk.RowActivatedHandler(OnTestActivated);
            regressionTree.RowActivated += new Gtk.RowActivatedHandler(OnRegressionTestActivated);
            failedTree.RowActivated     += new Gtk.RowActivatedHandler(OnFailedTestActivated);

            foreach (UnitTest t in UnitTestService.RootTests)
            {
                TreeView.AddChild(t);
            }

            base.TreeView.Tree.Name = "unitTestBrowserTree";
        }
Пример #31
0
        private void UpdateForArtist(string artist_name, LastfmData <SimilarArtist> similar_artists,
                                     LastfmData <ArtistTopAlbum> top_albums, LastfmData <ArtistTopTrack> top_tracks)
        {
            ThreadAssist.ProxyToMain(delegate {
                album_box.Title = String.Format(album_title_format, artist);
                track_box.Title = String.Format(track_title_format, artist);

                similar_artists_view.ClearWidgets();
                ClearBox(album_list);
                ClearBox(track_list);

                // Similar Artists
                var artists = similar_artists.Take(20);

                if (artists.Any())
                {
                    int artist_name_max_len = 2 * (int)artists.Select(a => a.Name.Length).Average();
                    foreach (var similar_artist in artists)
                    {
                        SimilarArtistTile tile = new SimilarArtistTile(similar_artist);

                        tile.PrimaryLabel.WidthChars = artist_name_max_len;
                        tile.PrimaryLabel.Ellipsize  = Pango.EllipsizeMode.End;

                        tile.ShowAll();
                        similar_artists_view.AddWidget(tile);
                    }

                    no_artists_pane.Hide();
                    similar_artists_view_sw.ShowAll();
                }
                else
                {
                    similar_artists_view_sw.Hide();
                    no_artists_pane.ShowAll();
                }

                for (int i = 0; i < Math.Min(5, top_albums.Count); i++)
                {
                    ArtistTopAlbum album = top_albums[i];
                    Button album_button  = new Button();
                    album_button.Relief  = ReliefStyle.None;

                    Label label = new Label();
                    label.OverrideColor(StateFlags.Normal, StyleContext.GetColor(StateFlags.Normal));
                    label.Ellipsize = Pango.EllipsizeMode.End;
                    label.Xalign    = 0;
                    label.Markup    = String.Format("{0}. {1}", i + 1, GLib.Markup.EscapeText(album.Name));
                    album_button.Add(label);

                    album_button.Clicked += delegate {
                        Banshee.Web.Browser.Open(album.Url);
                    };
                    album_list.PackStart(album_button, false, true, 0);
                }
                album_box.ShowAll();

                for (int i = 0; i < Math.Min(5, top_tracks.Count); i++)
                {
                    ArtistTopTrack track = top_tracks[i];
                    Button track_button  = new Button();
                    track_button.Relief  = ReliefStyle.None;

                    HBox box = new HBox();

                    Label label = new Label();
                    label.OverrideColor(StateFlags.Normal, StyleContext.GetColor(StateFlags.Normal));
                    label.Ellipsize = Pango.EllipsizeMode.End;
                    label.Xalign    = 0;
                    label.Markup    = String.Format("{0}. {1}", i + 1, GLib.Markup.EscapeText(track.Name));

                    /*if(node.SelectSingleNode("track_id") != null) {
                     *  box.PackEnd(new Image(now_playing_arrow), false, false, 0);
                     *  track_button.Clicked += delegate {
                     *      //PlayerEngineCore.OpenPlay(Globals.Library.GetTrack(
                     *          //Convert.ToInt32(node.SelectSingleNode("track_id").InnerText)));
                     *  };
                     * } else {*/
                    track_button.Clicked += delegate {
                        Banshee.Web.Browser.Open(track.Url);
                    };
                    //}

                    box.PackStart(label, true, true, 0);
                    track_button.Add(box);
                    track_list.PackStart(track_button, false, true, 0);
                }
                track_box.ShowAll();

                ready      = true;
                refreshing = false;
                context_page.SetState(Banshee.ContextPane.ContextState.Loaded);
            });
        }
Пример #32
0
        void ShowLoadSourceFile(StackFrame sf)
        {
            if (messageOverlayContent != null)
            {
                editor.RemoveOverlay(messageOverlayContent);
                messageOverlayContent = null;
            }
            messageOverlayContent = new HBox();

            var hbox = new HBox();

            hbox.Spacing = 8;
            var label = new Label(string.Format("{0} not found. Find source file at alternative location.", Path.GetFileName(sf.SourceLocation.FileName)));

            hbox.TooltipText = sf.SourceLocation.FileName;

            var color = (HslColor)editor.Options.GetColorStyle().NotificationText.Foreground;

            label.ModifyFg(StateType.Normal, color);

            int w, h;

            label.Layout.GetPixelSize(out w, out h);

            hbox.PackStart(label, true, true, 0);
            var openButton = new Button(Gtk.Stock.Open);

            openButton.WidthRequest = 60;
            hbox.PackEnd(openButton, false, false, 0);

            const int containerPadding = 8;

            messageOverlayContent.PackStart(hbox, true, true, containerPadding);
            editor.AddOverlay(messageOverlayContent, () => openButton.SizeRequest().Width + w + hbox.Spacing * 5 + containerPadding * 2);

            openButton.Clicked += delegate {
                var dlg = new OpenFileDialog(GettextCatalog.GetString("File to Open"), MonoDevelop.Components.FileChooserAction.Open)
                {
                    TransientFor         = IdeApp.Workbench.RootWindow,
                    ShowEncodingSelector = true,
                    ShowViewerSelector   = true
                };
                if (!dlg.Run())
                {
                    return;
                }
                var newFilePath = dlg.SelectedFile;
                try {
                    if (File.Exists(newFilePath))
                    {
                        if (SourceCodeLookup.CheckFileMd5(newFilePath, sf.SourceLocation.FileHash))
                        {
                            SourceCodeLookup.AddLoadedFile(newFilePath, sf.SourceLocation.FileName);
                            sf.UpdateSourceFile(newFilePath);
                            if (IdeApp.Workbench.OpenDocument(newFilePath, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger) != null)
                            {
                                this.WorkbenchWindow.CloseWindow(false);
                            }
                        }
                        else
                        {
                            MessageService.ShowWarning("File checksum doesn't match.");
                        }
                    }
                    else
                    {
                        MessageService.ShowWarning("File not found.");
                    }
                } catch (Exception) {
                    MessageService.ShowWarning("Error opening file");
                }
            };
        }
Пример #33
0
        public TextEntries()
        {
            TextEntry te1 = new TextEntry();

            PackStart(te1);
            te1.BackgroundColor = Xwt.Drawing.Colors.Red;

            Label la = new Label();

            PackStart(la);
            te1.Changed += delegate {
                la.Text = "Text: " + te1.Text;
            };

            HBox selBox = new HBox();

            Label las = new Label("Selection:");

            selBox.PackStart(las);
            Button selReplace = new Button("Replace");

            selReplace.Clicked += delegate {
                te1.SelectedText = "[TEST]";
            };
            selBox.PackEnd(selReplace);
            Button selAll = new Button("Select all");

            selAll.Clicked += delegate {
                te1.SelectionStart  = 0;
                te1.SelectionLength = te1.Text.Length;
            };
            selBox.PackEnd(selAll);
            Button selPlus = new Button("+");

            selPlus.Clicked += delegate {
                te1.SelectionLength++;
            };
            selBox.PackEnd(selPlus);
            Button selRight = new Button(">");

            selRight.Clicked += delegate {
                te1.SelectionStart++;
            };
            selBox.PackEnd(selRight);
            PackStart(selBox);

            te1.SelectionChanged += delegate {
                las.Text = "Selection: (" + te1.CursorPosition + " <-> " + te1.SelectionStart + " + " + te1.SelectionLength + ") " + te1.SelectedText;
            };

            PackStart(new Label("Entry with small font"));
            TextEntry te2 = new TextEntry();

            te2.Font = te2.Font.WithScaledSize(0.5);
            PackStart(te2);

            PackStart(new Label("Entry with placeholder text"));
            TextEntry te3 = new TextEntry();

            te3.PlaceholderText = "Placeholder text";
            PackStart(te3);

            PackStart(new Label("Entry with no frame"));
            TextEntry te4 = new TextEntry();

            te4.ShowFrame = false;
            PackStart(te4);

            PackStart(new Label("Entry with custom frame"));
            FrameBox teFrame = new FrameBox();

            teFrame.BorderColor = Xwt.Drawing.Colors.Red;
            teFrame.BorderWidth = 1;
            teFrame.Content     = new TextEntry()
            {
                ShowFrame = false
            };
            PackStart(teFrame);

            TextEntry te5 = new TextEntry();

            te5.Text          = "I should be centered!";
            te5.TextAlignment = Alignment.Center;
            PackStart(te5);

            TextEntry te6 = new TextEntry();

            te6.Text      = "I should have" + Environment.NewLine + "multiple lines!";
            te6.MultiLine = true;
            PackStart(te6);

            try {
                SearchTextEntry te7 = new SearchTextEntry();
                te7.PlaceholderText = "Type to search ...";
                PackStart(te7);

                SearchTextEntry te8 = new SearchTextEntry();
                te8.PlaceholderText = "I should have no frame";
                te8.ShowFrame       = false;
                PackStart(te8);
            } catch (InvalidOperationException ex) {
                Console.WriteLine(ex);
            }
        }
            private void AddGameNavigationButtons(VBox box)
            {
                firstButton = new Button ();
                firstButton.Clicked += OnClicked;
                firstButton.Image =
                    new Image (Stock.GotoFirst,
                           IconSize.Button);
                prevButton = new Button ();
                prevButton.Clicked += OnClicked;
                prevButton.Image =
                    new Image (Stock.GoBack,
                           IconSize.Button);
                nextButton = new Button ();
                nextButton.Clicked += OnClicked;
                nextButton.Image =
                    new Image (Stock.GoForward,
                           IconSize.Button);
                lastButton = new Button ();
                lastButton.Clicked += OnClicked;
                lastButton.Image =
                    new Image (Stock.GotoLast,
                           IconSize.Button);

                HBox hbox = new HBox ();
                hbox.PackStart (firstButton, false, false, 2);
                hbox.PackStart (prevButton, false, false, 2);
                hbox.PackStart (nextButton, false, false, 2);
                hbox.PackStart (lastButton, false, false, 2);

                Alignment align =
                    new Alignment (0.5f, 1, 1, 0);
                align.Add (hbox);
                box.PackStart (align, false, true, 2);
            }
Пример #35
0
    public static void Main()
    {
        Application.Init();

        //Create the Window
        Window myWin = new Window("Brave new world");

        myWin.Resize(200, 200);
        HBox myBox = new HBox(false, 10);

        myWin.Add(myBox);

        // Set up a button object.
        Button ping = new Button("Ping");
        Button pong = new Button("Pong");

        myBox.Add(ping);
        myBox.Add(pong);

        Action <object, EventArgs> deleg = (obj, args) => {
            Button button1 = (Button)obj;
            Console.WriteLine("Wooaw ! It is working ! {0} has been clicked !", button1.Label);

            Button button2;
            if (button1.Label == "Ping")
            {
                button2           = pong;
                button1.Sensitive = false;
                button2.Sensitive = true;
            }
            else
            {
                button2           = ping;
                button1.Sensitive = false;
                button2.Sensitive = true;
            }
        };

        ping.Clicked += new EventHandler(deleg);
        pong.Clicked += new EventHandler(deleg);

        /* Tester la fermeture du code revient à la modification des références des objets
         * et voir si ça fonctionne (les 2 lignes commentées ci-dessous permettent le test).
         *
         * Résultat : Malgré que le if, de l'event handler deleg, ne porte que sur le label
         *  du bouton cliqué, un changement de référence des boutons fait que les boutons
         *  "initiaux" restent bloqués dans un état (ici "non cliquable" à cause du jeu avec
         *  les propriétés Sensitive).
         *
         * Conséquence : Changer les références d'un objet en C# est par obligation accompagné
         *  de la réinitialisation de son environnement : ici réaffectation de son event handler
         *  et ajout dans la fenêtre.
         */
        //ping = new Button ("Ping");
        //pong = new Button("Pong");

        //Show Everything
        myWin.ShowAll();

        Application.Run();
    }
Пример #36
0
        private void CreateAbout()
        {
            Gdk.Color fgcolor = new Gdk.Color();
            Gdk.Color.Parse("red", ref fgcolor);
            Label version = new Label()
            {
                Markup = string.Format(
                    "<span font_size='small' fgcolor='#729fcf'>{0}</span>",
                    string.Format(
                        Properties_Resources.Version,
                        this.Controller.RunningVersion,
                        this.Controller.CreateTime.GetValueOrDefault().ToString("d"))),
                Xalign = 0
            };

            Label credits = new Label()
            {
                LineWrap     = true,
                LineWrapMode = Pango.WrapMode.Word,
                Markup       = "<span font_size='small' fgcolor='#729fcf'>" +
                               "Copyright © 2013–" + DateTime.Now.Year.ToString() + " GRAU DATA AG, Aegif and others.\n" +
                               "\n" + Properties_Resources.ApplicationName +
                               " is Open Source software. You are free to use, modify, " +
                               "and redistribute it under the GNU General Public License version 3 or later." +
                               "</span>",
                WidthRequest = 330,
                Wrap         = true,
                Xalign       = 0
            };

            LinkButton website_link = new LinkButton(this.Controller.WebsiteLinkAddress, Properties_Resources.Website);

            website_link.ModifyFg(StateType.Active, fgcolor);
            LinkButton credits_link        = new LinkButton(this.Controller.CreditsLinkAddress, Properties_Resources.Credits);
            LinkButton report_problem_link = new LinkButton(this.Controller.ReportProblemLinkAddress, Properties_Resources.ReportProblem);

            HBox layout_links = new HBox(false, 0);

            layout_links.PackStart(website_link, false, false, 0);
            layout_links.PackStart(credits_link, false, false, 0);
            layout_links.PackStart(report_problem_link, false, false, 0);

            VBox layout_vertical = new VBox(false, 0);

            layout_vertical.PackStart(new Label(string.Empty), false, false, 42);
            layout_vertical.PackStart(version, false, false, 0);
            layout_vertical.PackStart(credits, false, false, 9);
            layout_vertical.PackStart(new Label(string.Empty), false, false, 0);
            layout_vertical.PackStart(layout_links, false, false, 0);

            HBox layout_horizontal = new HBox(false, 0)
            {
                BorderWidth   = 0,
                HeightRequest = 260,
                WidthRequest  = 640
            };

            layout_horizontal.PackStart(new Label(string.Empty), false, false, 150);
            layout_horizontal.PackStart(layout_vertical, false, false, 0);

            this.Add(layout_horizontal);
        }
Пример #37
0
        protected override void Initialize(IPadWindow window)
        {
            this.window = window;

            DockItemToolbar toolbar = window.GetToolbar(DockPositionType.Top);

            buttonSuccess        = new ToggleButton();
            buttonSuccess.Label  = GettextCatalog.GetString("Successful Tests");
            buttonSuccess.Active = false;
            buttonSuccess.Image  = new ImageView(TestStatusIcon.Success);
            buttonSuccess.Image.Show();
            buttonSuccess.Toggled    += new EventHandler(OnShowSuccessfulToggled);
            buttonSuccess.TooltipText = GettextCatalog.GetString("Show Successful Tests");
            toolbar.Add(buttonSuccess);

            buttonInconclusive        = new ToggleButton();
            buttonInconclusive.Label  = GettextCatalog.GetString("Inconclusive Tests");
            buttonInconclusive.Active = true;
            buttonInconclusive.Image  = new ImageView(TestStatusIcon.Inconclusive);
            buttonInconclusive.Image.Show();
            buttonInconclusive.Toggled    += new EventHandler(OnShowInconclusiveToggled);
            buttonInconclusive.TooltipText = GettextCatalog.GetString("Show Inconclusive Tests");
            toolbar.Add(buttonInconclusive);

            buttonFailures        = new ToggleButton();
            buttonFailures.Label  = GettextCatalog.GetString("Failed Tests");
            buttonFailures.Active = true;
            buttonFailures.Image  = new ImageView(TestStatusIcon.Failure);
            buttonFailures.Image.Show();
            buttonFailures.Toggled    += new EventHandler(OnShowFailuresToggled);
            buttonFailures.TooltipText = GettextCatalog.GetString("Show Failed Tests");
            toolbar.Add(buttonFailures);

            buttonIgnored        = new ToggleButton();
            buttonIgnored.Label  = GettextCatalog.GetString("Ignored Tests");
            buttonIgnored.Active = true;
            buttonIgnored.Image  = new ImageView(TestStatusIcon.NotRun);
            buttonIgnored.Image.Show();
            buttonIgnored.Toggled    += new EventHandler(OnShowIgnoredToggled);
            buttonIgnored.TooltipText = GettextCatalog.GetString("Show Ignored Tests");
            toolbar.Add(buttonIgnored);

            buttonOutput        = new ToggleButton();
            buttonOutput.Label  = GettextCatalog.GetString("Output");
            buttonOutput.Active = false;
            buttonOutput.Image  = new ImageView(MonoDevelop.Ide.Gui.Stock.OutputIcon, IconSize.Menu);
            buttonOutput.Image.Show();
            buttonOutput.Toggled    += new EventHandler(OnShowOutputToggled);
            buttonOutput.TooltipText = GettextCatalog.GetString("Show Output");
            toolbar.Add(buttonOutput);

            toolbar.Add(new SeparatorToolItem());

            buttonRun       = new Button();
            buttonRun.Label = GettextCatalog.GetString("Rerun Tests");
            buttonRun.Image = new ImageView("md-execute-all", IconSize.Menu);
            buttonRun.Image.Show();
            buttonRun.Sensitive = false;
            toolbar.Add(buttonRun);

            buttonStop = new Button(new ImageView(Ide.Gui.Stock.Stop, Gtk.IconSize.Menu));
            toolbar.Add(buttonStop);
            toolbar.ShowAll();

            buttonStop.Clicked += new EventHandler(OnStopClicked);
            buttonRun.Clicked  += new EventHandler(OnRunClicked);

            // Run panel

            DockItemToolbar runPanel = window.GetToolbar(DockPositionType.Bottom);

            infoSep = new VSeparator();

            resultLabel.UseMarkup    = true;
            infoCurrent.Ellipsize    = Pango.EllipsizeMode.Start;
            infoCurrent.WidthRequest = 0;
            runPanel.Add(resultLabel);
            runPanel.Add(progressBar);
            runPanel.Add(infoCurrent, true, 10);

            labels = new HBox(false, 10);

            infoLabel.UseMarkup = true;

            labels.PackStart(infoLabel, true, false, 0);

            runPanel.Add(new Gtk.Label(), true);
            runPanel.Add(labels);
            runPanel.Add(infoSep, false, 10);

            progressBar.HeightRequest = infoLabel.SizeRequest().Height;
            runPanel.ShowAll();
            progressBar.Hide();
            infoSep.Hide();
            resultSummary = new UnitTestResult();
            UpdateCounters();
        }
Пример #38
0
        public Command Run(WindowFrame transientFor, MessageDescription message)
        {
            this.icon = GetIcon (message.Icon);
            if (ConvertButtons (message.Buttons, out buttons) && message.Options.Count == 0) {
                // Use a system message box
                if (message.SecondaryText == null)
                    message.SecondaryText = String.Empty;
                else {
                    message.Text = message.Text + "\r\n\r\n" + message.SecondaryText;
                    message.SecondaryText = String.Empty;
                }
                var parent =  Toolkit.CurrentEngine.GetNativeWindow(transientFor) as System.Windows.Window;
                if (parent != null) {
                    this.dialogResult = MessageBox.Show (parent, message.Text, message.SecondaryText,
                                                        this.buttons, this.icon, this.defaultResult, this.options);
                }
                else {
                    this.dialogResult = MessageBox.Show (message.Text, message.SecondaryText, this.buttons,
                                                        this.icon, this.defaultResult, this.options);
                }
                return ConvertResultToCommand (this.dialogResult);
            }
            else {
                // Custom message box required
                Dialog dlg = new Dialog ();
                dlg.Resizable = false;
                dlg.Padding = 0;
                HBox mainBox = new HBox { Margin = 25 };

                if (message.Icon != null) {
                    var image = new ImageView (message.Icon.WithSize (32,32));
                    mainBox.PackStart (image, vpos: WidgetPlacement.Start);
                }
                VBox box = new VBox () { Margin = 3, MarginLeft = 8, Spacing = 15 };
                mainBox.PackStart (box, true);
                var text = new Label {
                    Text = message.Text ?? ""
                };
                Label stext = null;
                box.PackStart (text);
                if (!string.IsNullOrEmpty (message.SecondaryText)) {
                    stext = new Label {
                        Text = message.SecondaryText
                    };
                    box.PackStart (stext);
                }
                foreach (var option in message.Options) {
                    var check = new CheckBox (option.Text);
                    check.Active = option.Value;
                    box.PackStart(check);
                    check.Toggled += (sender, e) => message.SetOptionValue(option.Id, check.Active);
                }
                dlg.Buttons.Add (message.Buttons.ToArray ());
                if (message.DefaultButton >= 0 && message.DefaultButton < message.Buttons.Count)
                    dlg.DefaultCommand = message.Buttons[message.DefaultButton];
                if (mainBox.Surface.GetPreferredSize (true).Width > 480) {
                    text.Wrap = WrapMode.Word;
                    if (stext != null)
                        stext.Wrap = WrapMode.Word;
                    mainBox.WidthRequest = 480;
                }
                var s = mainBox.Surface.GetPreferredSize (true);

                dlg.Content = mainBox;
                return dlg.Run ();
            }
        }
        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);
        }
Пример #40
0
        public FixSource() : base(Catalog.GetString("Metadata Fixer"), Catalog.GetString("Metadata Fixer"), -1)
        {
            TypeUniqueId = "fixes";

            var header_widget = new HBox()
            {
                Spacing = 6
            };

            header_widget.PackStart(new Label(Catalog.GetString("Problem Type:")), false, false, 0);

            var combo = new Banshee.Widgets.DictionaryComboBox <Solver> ();

            foreach (var solver in problem_model.Solvers)
            {
                if (solver.PreferencesSection != null)
                {
                    sections.Add(solver.PreferencesSection);
                }
                combo.Add(solver.Name, solver);
            }

            if (sections.Count > 0)
            {
                page = new SourcePage(this);
                foreach (var section in sections)
                {
                    page.Add(section);
                }
            }

            combo.Changed += (o, a) => {
                problem_model.Solver = combo.ActiveValue;
                SetStatus(problem_model.Solver.Description, false, false, "gtk-info");
            };
            combo.Active = 0;

            var apply_button = new Hyena.Widgets.ImageButton(Catalog.GetString("Apply Selected Fixes"), "gtk-apply");

            apply_button.Clicked   += (o, a) => problem_model.Fix();
            problem_model.Reloaded += (o, a) => apply_button.Sensitive = problem_model.SelectedCount > 0;

            header_widget.PackStart(combo, false, false, 0);
            header_widget.PackStart(apply_button, false, false, 0);
            header_widget.ShowAll();

            Properties.SetStringList("Icon.Name", "search", "gtk-search");
            Properties.SetString("ActiveSourceUIResource", "ActiveUI.xml");
            Properties.SetString("GtkActionPath", "/FixSourcePopup");
            Properties.Set <Gtk.Widget> ("Nereid.SourceContents.HeaderWidget", header_widget);
            Properties.Set <Banshee.Sources.Gui.ISourceContents> ("Nereid.SourceContents", new View(problem_model));
            Properties.SetString("UnmapSourceActionLabel", Catalog.GetString("Close"));
            Properties.SetString("UnmapSourceActionIconName", "gtk-close");

            var actions = new BansheeActionGroup("fix-source");

            actions.AddImportant(
                new ActionEntry("RefreshProblems", Stock.Refresh, Catalog.GetString("Refresh"), null, null, (o, a) => {
                problem_model.Refresh();
            })
                );
            actions.Register();

            problem_model.Reload();
        }
Пример #41
0
        protected override void AddFields()
        {
            HBox box   = new HBox();
            VBox left  = EditorUtilities.CreateVBox();
            VBox right = EditorUtilities.CreateVBox();

            box.PackStart(left, true, true, 0);
            box.PackStart(new VSeparator(), false, false, 12);
            box.PackStart(right, false, false, 0);
            box.ShowAll();

            PackStart(box, false, false, 0);

            // Left

            PageNavigationEntry title_entry = new PageNavigationEntry(Dialog);

            AddField(left, title_entry, null,
                     delegate { return(Catalog.GetString("Track _Title:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((PageNavigationEntry)widget).Text = track.TrackTitle; },
                     delegate(EditorTrackInfo track, Widget widget) { track.TrackTitle = ((PageNavigationEntry)widget).Text; },
                     FieldOptions.NoSync
                     );

            PageNavigationEntry track_artist_entry = new PageNavigationEntry(Dialog, "CoreArtists", "Name");

            FieldPage.FieldSlot track_artist_slot = AddField(left, track_artist_entry,
                                                             Catalog.GetString("Set all track artists to this value"),
                                                             delegate { return(Catalog.GetString("Track _Artist:")); },
                                                             delegate(EditorTrackInfo track, Widget widget) { ((PageNavigationEntry)widget).Text = track.ArtistName; },
                                                             delegate(EditorTrackInfo track, Widget widget) { track.ArtistName = ((PageNavigationEntry)widget).Text; }
                                                             );

            AlbumArtistEntry album_artist_entry = new AlbumArtistEntry(track_artist_slot.SyncButton,
                                                                       title_entry, track_artist_entry);

            AddField(left, null, album_artist_entry,
                     Catalog.GetString("Set all compilation album artists to these values"), null,
                     delegate(EditorTrackInfo track, Widget widget) {
                AlbumArtistEntry entry = widget as AlbumArtistEntry;
                entry.IsCompilation    = track.IsCompilation;
                entry.Text             = track.AlbumArtist;
            },
                     delegate(EditorTrackInfo track, Widget widget) {
                AlbumArtistEntry entry = widget as AlbumArtistEntry;
                track.IsCompilation    = entry.IsCompilation;
                track.AlbumArtist      = entry.Text;
            }
                     );

            track_artist_entry.Changed += delegate {
                if (!album_artist_entry.IsCompilation)
                {
                    album_artist_entry.Text = track_artist_entry.Text;
                }
            };

            AddField(left, new TextEntry("CoreAlbums", "Title"),
                     Catalog.GetString("Set all album titles to this value"),
                     delegate { return(Catalog.GetString("Albu_m Title:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((TextEntry)widget).Text = track.AlbumTitle; },
                     delegate(EditorTrackInfo track, Widget widget) { track.AlbumTitle = ((TextEntry)widget).Text; }
                     );

            AddField(left, new GenreEntry(),
                     Catalog.GetString("Set all genres to this value"),
                     delegate { return(Catalog.GetString("_Genre:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((GenreEntry)widget).Value = track.Genre; },
                     delegate(EditorTrackInfo track, Widget widget) { track.Genre = ((GenreEntry)widget).Value; }
                     );

            // Right

            AddField(right,
                     EditorUtilities.CreateLabel(""),
                     /* Translators: "of" is the word beteen a track/disc number and the total count. */
                     new RangeEntry(Catalog.GetString("of"), !MultipleTracks
                    ? null as RangeEntry.RangeOrderClosure
                    : delegate(RangeEntry entry) {
                for (int i = 0, n = Dialog.TrackCount; i < n; i++)
                {
                    EditorTrackInfo track = Dialog.LoadTrack(i);

                    if (Dialog.CurrentTrackIndex == i)
                    {
                        // In this case the writeClosure is invoked,
                        // which will take care of updating the TrackInfo
                        entry.From.Value = i + 1;
                        entry.To.Value   = n;
                    }
                    else
                    {
                        track.TrackNumber = i + 1;
                        track.TrackCount  = n;
                    }
                }
            },
                                    Catalog.GetString("Automatically set track number and count")
                                    ),
                     null,
                     delegate { return(Catalog.GetString("Track _Number:")); },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                entry.From.Value = track.TrackNumber;
                entry.To.Value   = track.TrackCount;
            },
                     // Write closure
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry  = (RangeEntry)widget;
                track.TrackNumber = (int)entry.From.Value;
                track.TrackCount  = (int)entry.To.Value;
            },
                     // Sync closure (doesn't modify TrackNumber)
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                track.TrackCount = (int)entry.To.Value;
            },
                     FieldOptions.NoShowSync
                     );

            AddField(right, new RangeEntry(Catalog.GetString("of")),
                     // Catalog.GetString ("Automatically set disc number and count"),
                     Catalog.GetString("Set all disc numbers and counts to these values"),
                     delegate { return(Catalog.GetString("_Disc Number:")); },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                entry.From.Value = track.DiscNumber;
                entry.To.Value   = track.DiscCount;
            },
                     delegate(EditorTrackInfo track, Widget widget) {
                RangeEntry entry = (RangeEntry)widget;
                track.DiscNumber = (int)entry.From.Value;
                track.DiscCount  = (int)entry.To.Value;
            },
                     FieldOptions.None
                     );

            Label year_label = EditorUtilities.CreateLabel(null);

            album_artist_entry.LabelWidget.SizeAllocated += delegate {
                year_label.HeightRequest = album_artist_entry.LabelWidget.Allocation.Height;
            };
            SpinButtonEntry year_entry = new SpinButtonEntry(0, 3000, 1);

            year_entry.Numeric = true;
            AddField(right, year_label, year_entry,
                     Catalog.GetString("Set all years to this value"),
                     delegate { return(Catalog.GetString("_Year:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((SpinButtonEntry)widget).Value = track.Year; },
                     delegate(EditorTrackInfo track, Widget widget) { track.Year = ((SpinButtonEntry)widget).ValueAsInt; },
                     FieldOptions.Shrink
                     );

            AddField(right, new RatingEntry(),
                     Catalog.GetString("Set all ratings to this value"),
                     delegate { return(Catalog.GetString("_Rating:")); },
                     delegate(EditorTrackInfo track, Widget widget) { ((RatingEntry)widget).Value = track.Rating; },
                     delegate(EditorTrackInfo track, Widget widget) { track.Rating = ((RatingEntry)widget).Value; },
                     FieldOptions.Shrink | FieldOptions.NoSync
                     );
        }
Пример #42
0
        public void LoadDefaultValues()
        {
            if (SetDefaultValues)
            {
                base.Border = false;
                base.FileUpload = true;

                Ext.Net.Hidden hiddenFileID = new Ext.Net.Hidden() { ID = this.ID, Value = "" };
                this.ID = this.ID + "_Form";

                #region Upload

                HBox hBoxUploadControl = new HBox() { ID = string.Format("uploadControl_{0}", this.ID) };

                // width set edilebilir olmalı
                Ext.Net.FileUploadField fileUpload = new Ext.Net.FileUploadField() {
                    ID = string.Format("fileUpload_{0}", this.ID),
                    Width = 206,
                    Icon = Ext.Net.Icon.Attach,
                    AllowBlank = this.AllowBlank
                };

                Ext.Net.Button buttonUpload = new Ext.Net.Button() { ID = string.Format("buttonUpload_{0}", this.ID), Text = "Upload", StyleSpec = "padding-left:3px;", Icon = Ext.Net.Icon.FolderGo };
                buttonUpload.DirectEvents.Click.Url = UploadUrl ?? "/Files/FileUpload/";
                buttonUpload.DirectEvents.Click.IsUpload = true;
                buttonUpload.DirectEvents.Click.CleanRequest = true;
                buttonUpload.DirectEvents.Click.Method = Ext.Net.HttpMethod.POST;
                buttonUpload.DirectEvents.Click.Before = (BeforeUploadHandler ?? string.Empty) + "if (!#{" + this.ID + "}.getForm().isValid()) { return false; } Ext.Msg.wait('Uploading your file...', 'Uploading');";
                buttonUpload.DirectEvents.Click.Failure = "Ext.MessageBox.hide(); if(result.errors && result.errors.length > 0) { #{" + fileUpload.ID + "}.markInvalid(result.errors[0].msg); }" + (UploadFailureHandler ?? string.Empty);
                buttonUpload.DirectEvents.Click.Success = string.Format(@"{6} #{{{0}}}.setValue(result.extraParams.FileID);
                                                            #{{{1}}}.setText(result.extraParams.FileName);
                                                            Ext.net.ResourceMgr.registerIcon(result.extraParams.Icon);
                                                            #{{{1}}}.setIconClass(result.extraParams.IconCls);
                                                            #{{downloadControl_{2}}}.doLayout(true, true);
                                                            Ext.MessageBox.hide();
                                                            #{{{3}}}.allowBlank = true;
                                                            #{{{3}}}.reset();
                                                            #{{{4}}}.hide();
                                                            #{{{5}}}.show(); ", hiddenFileID.ID, string.Format("buttonDownload_{0}", this.ID), this.ID, fileUpload.ID, hBoxUploadControl.ID, string.Format("downloadControl_{0}", this.ID), (UploadSuccessHandler ?? string.Empty));

                string allowedTypes = GetFileTypes(this.FileType);
                if (!string.IsNullOrEmpty(allowedTypes))
                    this.AllowedFileTypes = allowedTypes + (!string.IsNullOrEmpty(this.AllowedFileTypes) ? "," + this.AllowedFileTypes : string.Empty);

                buttonUpload.DirectEvents.Click.ExtraParams.AddRange(new List<Ext.Net.Parameter>() {
                    new Ext.Net.Parameter() { Name = "AllowedFileTypes", Value = AllowedFileTypes },
                    new Ext.Net.Parameter() { Name = "AllowedFileSize", Value = AllowedFileSize.ToString() },
                    new Ext.Net.Parameter() { Name = "FieldID", Value = fileUpload.ID },
                    new Ext.Net.Parameter() { Name = "FileID", Value = "0", Mode = Ext.Net.ParameterMode.Value }
                });

                hBoxUploadControl.Items.Add(fileUpload);
                hBoxUploadControl.Items.Add(buttonUpload);

                this.Items.Add(hBoxUploadControl);

                #endregion

                #region Download

                HBox hBoxDownloadControl = new HBox() { ID = string.Format("downloadControl_{0}", this.ID), StyleSpec = "margin-left: -3px; margin-top: 1px;", Hidden = true };

                Ext.Net.LinkButton buttonDownload = new Ext.Net.LinkButton() { ID = string.Format("buttonDownload_{0}", this.ID), Text = "Download" };
                buttonDownload.DirectEvents.Click.Url = DownloadUrl ?? "/Files/FileDownload";
                buttonDownload.DirectEvents.Click.CleanRequest = true;
                buttonDownload.DirectEvents.Click.Method = Ext.Net.HttpMethod.POST;
                buttonDownload.DirectEvents.Click.FormID = "proxyForm";
                buttonDownload.DirectEvents.Click.IsUpload = true;
                buttonDownload.DirectEvents.Click.ExtraParams.Add(new Ext.Net.Parameter() { Name = "id", Value = "#{" + hiddenFileID.ID + "}.getValue()", Mode = Ext.Net.ParameterMode.Raw });

                Ext.Net.ImageButton deleteButton = new Ext.Net.ImageButton() { ID = string.Format("deleteButton_{0}", this.ID), ImageUrl = "/Content/icon-cross.png", StyleSpec = "padding-left:5px;" };

                StringBuilder clickHandler = new StringBuilder();
                clickHandler.Append((BeforeDeleteHandler ?? string.Empty));//Before
                clickHandler.Append(string.Format("#{{DeletedFileIds_{0}}}.setValue(#{{DeletedFileIds_{0}}}.getValue() + #{{{0}}}.getValue() + ',');", hiddenFileID.ID)); // Click
                clickHandler.Append(string.Format(@"#{{{0}}}.allowBlank = {3};
                                        #{{{0}}}.reset();
                                        #{{{1}}}.show();
                                        #{{{2}}}.hide();
                                        #{{{4}}}.setValue(null);
                                        if(Ext.isIE) {{ #{{{0}}}.el.setStyle('width', '122px'); }}
                                        {5}", fileUpload.ID, hBoxUploadControl.ID, hBoxDownloadControl.ID, fileUpload.AllowBlank.ToString().ToLower(), hiddenFileID.ID, (DeleteSuccessHandler ?? string.Empty))); // Success

                StringBuilder sbConfirmation = new StringBuilder();
                sbConfirmation.Append("var dlg = Ext.Msg.confirm('Confirm', 'Do you want to delete this file?', function (btn) { if(btn == 'yes') { " + clickHandler.ToString() + " } else { #{" + this.ID + "}.focus(); } }).getDialog();");
                sbConfirmation.Append("dlg.defaultButton = 1;");
                sbConfirmation.Append("dlg.focus();");

                deleteButton.Listeners.Click.Handler = sbConfirmation.ToString();

                hBoxDownloadControl.Items.Add(buttonDownload);
                hBoxDownloadControl.Items.Add(deleteButton);
                hBoxDownloadControl.Items.Add(hiddenFileID);
                hBoxDownloadControl.Items.Add(new Ext.Net.Hidden() { ID = string.Format("DeletedFileIds_{0}", hiddenFileID.ID) });
                hBoxDownloadControl.Items.Add(new Ext.Net.Hidden() { ID = string.Format("DeleteUrl_{0}", hiddenFileID.ID), Value = DeleteUrl ?? "/Files/DeleteFile/" });

                this.Items.Add(hBoxDownloadControl);

                #endregion

            }
        }
        public SelectReferenceDialog()
        {
            Build();

            boxRefs.WidthRequest = 200;

            refTreeStore             = new ListStore(typeof(string), typeof(string), typeof(string), typeof(ProjectReference), typeof(Gdk.Pixbuf));
            ReferencesTreeView.Model = refTreeStore;

            TreeViewColumn col = new TreeViewColumn();

            col.Title = GettextCatalog.GetString("Reference");
            CellRendererPixbuf crp = new CellRendererPixbuf();

            crp.Yalign = 0f;
            col.PackStart(crp, false);
            col.AddAttribute(crp, "pixbuf", IconColumn);
            CellRendererText text_render = new CellRendererText();

            col.PackStart(text_render, true);
            col.AddAttribute(text_render, "markup", NameColumn);
            text_render.Ellipsize = Pango.EllipsizeMode.End;

            ReferencesTreeView.AppendColumn(col);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Type"), new CellRendererText (), "text", TypeNameColumn);
//			ReferencesTreeView.AppendColumn (GettextCatalog.GetString ("Location"), new CellRendererText (), "text", LocationColumn);

            projectRefPanel  = new ProjectReferencePanel(this);
            packageRefPanel  = new PackageReferencePanel(this, false);
            allRefPanel      = new PackageReferencePanel(this, true);
            assemblyRefPanel = new AssemblyReferencePanel(this);
            panels.Add(allRefPanel);
            panels.Add(packageRefPanel);
            panels.Add(projectRefPanel);
            panels.Add(assemblyRefPanel);

            mainBook.RemovePage(mainBook.CurrentPage);

            HBox tab = new HBox(false, 3);

//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Reference, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("_All")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(allRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Package, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("_Packages")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(packageRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.Project, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString("Pro_jects")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(projectRefPanel, tab);

            tab = new HBox(false, 3);
//			tab.PackStart (new Image (ImageService.GetPixbuf (MonoDevelop.Ide.Gui.Stock.OpenFolder, IconSize.Menu)), false, false, 0);
            tab.PackStart(new Label(GettextCatalog.GetString(".Net A_ssembly")), true, true, 0);
            tab.BorderWidth = 3;
            tab.ShowAll();
            mainBook.AppendPage(assemblyRefPanel, tab);

            mainBook.Page = 0;

            var w = selectedHeader.Child;

            selectedHeader.Remove(w);
            HeaderBox header = new HeaderBox(1, 0, 1, 1);

            header.SetPadding(6, 6, 6, 6);
            header.GradientBackround = true;
            header.Add(w);
            selectedHeader.Add(header);

            RemoveReferenceButton.CanFocus        = false;
            ReferencesTreeView.Selection.Changed += new EventHandler(OnChanged);
            Child.ShowAll();
            OnChanged(null, null);
            InsertFilterEntry();
        }
Пример #44
0
        void Build()
        {
            Spacing = 6;

            PackStart(new Label {
                Markup = "<b>" + GettextCatalog.GetString("General Options") + "</b>", Xalign = 0
            });

            var gpadLabel = new Label {
                WidthRequest = 12
            };
            var ipLabel = new Label(GettextCatalog.GetString("IP address:"))
            {
                Xalign = 0
            };
            var ipHint = new Label(GettextCatalog.GetString("(blank = localhost)"))
            {
                Xalign = 0
            };
            var ipHbox = new HBox(false, 6);

            ipHbox.PackStart(ipAddress, false, false, 0);
            ipHbox.PackStart(ipHint, false, false, 0);
            var portLabel = new Label(GettextCatalog.GetString("Port:"))
            {
                Xalign = 0
            };
            var portHint = new Label(GettextCatalog.GetString("(0 = random)"))
            {
                Xalign = 0
            };
            var portHbox = new HBox(false, 6);

            portHbox.PackStart(portNumber, false, false, 0);
            portHbox.PackStart(portHint, false, false, 0);
            verboseCheck.Label  = GettextCatalog.GetString("Verbose console output");
            verboseCheck.Xalign = 0;

            var ipTable = new Table(3, 3, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            ipTable.Attach(gpadLabel, 0, 1, 0, 1, AttachOptions.Fill, 0, 0, 0);
            ipTable.Attach(ipLabel, 1, 2, 0, 1, AttachOptions.Fill, 0, 0, 0);
            ipTable.Attach(ipHbox, 2, 3, 0, 1, AttachOptions.Fill, 0, 0, 0);
            ipTable.Attach(portLabel, 1, 2, 1, 2, AttachOptions.Fill, 0, 0, 0);
            ipTable.Attach(portHbox, 2, 3, 1, 2, AttachOptions.Fill, 0, 0, 0);
            ipTable.Attach(verboseCheck, 1, 3, 2, 3, AttachOptions.Fill, 0, 0, 0);
            PackStart(ipTable);

            PackStart(new Label {
                Markup = "<b>" + GettextCatalog.GetString("Security") + "</b>", Xalign = 0
            });

            var sslPadLabel = new Label {
                WidthRequest = 12
            };
            var sslModeLabel = new Label(GettextCatalog.GetString("SSL mode:"))
            {
                Xalign = 0
            };
            var sslModeAlign = new Alignment(0, 0, 0, 0)
            {
                Child = sslMode
            };
            var sslProtocolLabel = new Label(GettextCatalog.GetString("SSL protocol:"))
            {
                Xalign = 0
            };
            var sslProtocolAlign = new Alignment(0, 0, 0, 0)
            {
                Child = sslProtocol
            };

            var sslTable = new Table(2, 3, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            sslTable.Attach(sslPadLabel, 0, 1, 0, 1, AttachOptions.Fill, 0, 0, 0);
            sslTable.Attach(sslModeLabel, 1, 2, 0, 1, AttachOptions.Fill, 0, 0, 0);
            sslTable.Attach(sslModeAlign, 2, 3, 0, 1, AttachOptions.Fill, 0, 0, 0);
            sslTable.Attach(sslProtocolLabel, 1, 2, 1, 2, AttachOptions.Fill, 0, 0, 0);
            sslTable.Attach(sslProtocolAlign, 2, 3, 1, 2, AttachOptions.Fill, 0, 0, 0);
            PackStart(sslTable);

            PackStart(new Label {
                Markup = "<b>" + GettextCatalog.GetString("SSL Key") + "</b>", Xalign = 0
            });

            var keyPadLabel = new Label {
                WidthRequest = 12
            };
            var keyTypeLabel = new Label(GettextCatalog.GetString("Key type:"))
            {
                Xalign = 0
            };
            var keyTypeAlign = new Alignment(0, 0, 0, 0)
            {
                Child = keyType
            };
            var keyFileLabel = new Label(GettextCatalog.GetString("Key file:"))
            {
                Xalign = 0
            };
            var certFileLabel = new Label(GettextCatalog.GetString("Certificate file:"))
            {
                Xalign = 0
            };
            var passwordLabel = new Label(GettextCatalog.GetString("Password:"))
            {
                Xalign = 0
            };
            var passwordHbox = new HBox(false, 6);

            passwordHbox.PackStart(passwordOptions, false, false, 0);
            passwordHbox.PackStart(passwordEntry, true, true, 0);

            var keyTable = new Table(4, 4, false)
            {
                ColumnSpacing = 6, RowSpacing = 6
            };

            keyTable.Attach(keyPadLabel, 0, 1, 0, 1, AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(keyTypeLabel, 1, 2, 0, 1, AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(keyTypeAlign, 2, 3, 0, 1, AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(keyFileLabel, 1, 2, 1, 2, AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(keyLocation, 2, 4, 1, 2, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(certFileLabel, 1, 2, 2, 3, AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(certLocation, 2, 4, 2, 3, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(passwordLabel, 1, 2, 3, 4, AttachOptions.Fill, 0, 0, 0);
            keyTable.Attach(passwordHbox, 2, 4, 3, 4, AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);
            PackStart(keyTable);

            sslMode.Changed         += UpdateSensitivity;
            keyType.Changed         += UpdateSensitivity;
            passwordOptions.Changed += UpdateSensitivity;

            ShowAll();
        }
            private VBox GetRightPane()
            {
                VBox vbox = new VBox ();

                // labels
                moveNumberLabel = new Label ();
                nagCommentLabel = new Label ();
                nagCommentLabel.Xalign = 0;
                HBox hbox = new HBox ();
                hbox.PackStart (moveNumberLabel, false, false,
                        2);
                hbox.PackStart (nagCommentLabel, false, false,
                        2);

                vbox.PackStart (hbox, false, false, 2);

                // board
                chessGameDetailsBox = new VBox ();
                chessGameDetailsBox.PackStart (gameView,
                                   true, true, 4);

                vbox.PackStart (chessGameDetailsBox, true,
                        true, 2);

                // buttons
                firstButton = new Button ();
                firstButton.Clicked += on_first_clicked;
                firstButton.Image =
                    new Image (Stock.GotoFirst,
                           IconSize.Button);
                prevButton = new Button ();
                prevButton.Clicked += on_prev_clicked;
                prevButton.Image =
                    new Image (Stock.GoBack,
                           IconSize.Button);
                nextButton = new Button ();
                nextButton.Clicked += on_next_clicked;
                nextButton.Image =
                    new Image (Stock.GoForward,
                           IconSize.Button);
                lastButton = new Button ();
                lastButton.Clicked += on_last_clicked;
                lastButton.Image =
                    new Image (Stock.GotoLast,
                           IconSize.Button);

                HBox bbox = new HBox ();
                bbox.PackStart (firstButton, false, false, 1);
                bbox.PackStart (prevButton, false, false, 1);
                bbox.PackStart (nextButton, false, false, 1);
                bbox.PackStart (lastButton, false, false, 1);
                Alignment alignment =
                    new Alignment (0.5f, 1, 0, 0);
                alignment.Add (bbox);
                alignment.Show ();

                vbox.PackStart (alignment, false, false, 2);

                return vbox;
            }
Пример #46
0
  public static void Main(string [] args)
  {	
    Application.Init();

    Window win = new Window("EFL# Demo App");	
    win.Resize(640, 480);

    Application.EE.ResizeEvent += AppResizeHandler;

    /* integrate this code in the Window class */
    Edje win_bg = new Edje(Application.EE.Get());
    win_bg.FileSet(DataConfig.DATADIR + "/data/eblocks/themes/e17.edj","window");
    win_bg.Resize(640, 480);
    win_bg.Move(0, 0);
    win_bg.Lower();
    win_bg.Show();
    
    MenuItem item;    
    MenuItem entry;

    MenuBar mb = new MenuBar();
    mb.Move(0, 0);
    mb.Resize(640, 35);
    mb.Spacing = 15;

    item = new MenuItem("_File");
    Menu file_menu = new Menu();
    
    entry = new MenuItem(file_menu.Canvas, "_Open");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Close");
    file_menu.Append(entry);
    entry = new MenuItem(file_menu.Canvas, "_Save");
    file_menu.Append(entry);
    
    item.SubMenu = file_menu;
    
    mb.Append(item);

    item = new MenuItem("_Edit");
    Menu edit_menu = new Menu();
    
    entry = new MenuItem(edit_menu.Canvas, "_Copy");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Cut");
    edit_menu.Append(entry);
    entry = new MenuItem(edit_menu.Canvas, "_Paste");
    edit_menu.Append(entry);
    
    item.SubMenu = edit_menu;
    mb.Append(item);

    item = new MenuItem("_About");
    //item.SubMenu = about_menu;
    mb.Append(item);

    mb.Show();

    Button button;	

    HBox box_left = new HBox();
    box_left.Move(0, 37);
    box_left.Resize(70, 480 - 37);
	
    VBox box_icons = new VBox();
    box_icons.Spacing = 0;
    box_icons.Resize(64, 480 - 37);
	
    button = new Button("Tile");
    button.Resize(64, 64);
    box_icons.PackEnd(button);
    button = new Button("Stretch");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Rotate");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Flip");
    button.Resize(64, 64);
    box_icons.PackEnd(button);	
    button = new Button("Quit");
    button.MouseUpEvent += new Enlightenment.Evas.Item.EventHandler(AppQuitButtonHandler);
    button.Resize(64, 64);	
    box_icons.PackEnd(button);		
	
    box_left.PackEnd(box_icons);
	
    Enlightenment.Eblocks.Line vline = new Enlightenment.Eblocks.Line(Application.EE.Get());
    vline.Vertical = true;
    vline.Resize(6, 480 - 37);
	
    box_left.PackEnd(vline);
	
    box_left.Show();
	
    dir = args[0];	
	       	
    imageTable = new Table(Application.EE.Get(), items);
	
    HBox box_images = new HBox();
    box_images.Move(70, 37);
    box_images.Spacing = 0;
    box_images.Resize(640 - 70 - 2, 480 - 37 - 2);
    box_images.PackStart(imageTable);
	
    Application.EE.DataSet("box_images", box_images);
    Application.EE.DataSet("box_left", box_left);
    Application.EE.DataSet("box_icons", box_icons);
    Application.EE.DataSet("win_bg", win_bg);
    Application.EE.DataSet("vline", vline);
    Application.EE.DataSet("mb", mb);
	
    WaitCallback callback = new WaitCallback(Callback);
    ThreadPool.QueueUserWorkItem(callback);	

    win.ShowAll();
	
    Application.Run();
  }   
Пример #47
0
        public MainToolbar()
        {
            IdeApp.Workspace.ActiveConfigurationChanged += (sender, e) => UpdateCombos();
            IdeApp.Workspace.ConfigurationsChanged      += (sender, e) => UpdateCombos();

            IdeApp.Workspace.SolutionLoaded   += (sender, e) => UpdateCombos();
            IdeApp.Workspace.SolutionUnloaded += (sender, e) => UpdateCombos();

            IdeApp.ProjectOperations.CurrentSelectedSolutionChanged += HandleCurrentSelectedSolutionChanged;


            WidgetFlags |= Gtk.WidgetFlags.AppPaintable;

            AddWidget(button);
            AddSpace(8);

            configurationCombo       = new Gtk.ComboBox();
            configurationCombo.Model = configurationStore;
            var ctx = new Gtk.CellRendererText();

            configurationCombo.PackStart(ctx, true);
            configurationCombo.AddAttribute(ctx, "text", 0);

            configurationCombosBox = new HBox(false, 8);

            var configurationComboVBox = new VBox();

            configurationComboVBox.PackStart(configurationCombo, true, false, 0);
            configurationCombosBox.PackStart(configurationComboVBox, false, false, 0);

            runtimeCombo       = new Gtk.ComboBox();
            runtimeCombo.Model = runtimeStore;
            runtimeCombo.PackStart(ctx, true);
            runtimeCombo.AddAttribute(ctx, "text", 0);

            var runtimeComboVBox = new VBox();

            runtimeComboVBox.PackStart(runtimeCombo, true, false, 0);
            configurationCombosBox.PackStart(runtimeComboVBox, false, false, 0);
            AddWidget(configurationCombosBox);

            buttonBarBox             = new Alignment(0.5f, 0.5f, 0, 0);
            buttonBarBox.LeftPadding = 7;
            buttonBarBox.Add(buttonBar);
            buttonBarBox.NoShowAll = true;
            AddWidget(buttonBarBox);
            AddSpace(24);

            statusArea = new StatusArea();
            statusArea.ShowMessage(BrandingService.ApplicationName);

            var statusAreaAlign = new Alignment(0, 0, 1, 1);

            statusAreaAlign.Add(statusArea);
            contentBox.PackStart(statusAreaAlign, true, true, 0);
            AddSpace(24);

            statusAreaAlign.SizeAllocated += (object o, SizeAllocatedArgs args) => {
                Gtk.Widget toplevel = this.Toplevel;
                if (toplevel == null)
                {
                    return;
                }

                int  windowWidth   = toplevel.Allocation.Width;
                int  center        = windowWidth / 2;
                int  left          = Math.Max(center - 300, args.Allocation.Left);
                int  right         = Math.Min(left + 600, args.Allocation.Right);
                uint left_padding  = (uint)(left - args.Allocation.Left);
                uint right_padding = (uint)(args.Allocation.Right - right);

                if (left_padding != statusAreaAlign.LeftPadding || right_padding != statusAreaAlign.RightPadding)
                {
                    statusAreaAlign.SetPadding(0, 0, (uint)left_padding, (uint)right_padding);
                }
            };

            matchEntry = new SearchEntry();

            var searchFiles = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Files"));

            searchFiles.Activated += delegate {
                SetSearchCategory("files");
            };
            var searchTypes = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Types"));

            searchTypes.Activated += delegate {
                SetSearchCategory("type");
            };
            var searchMembers = this.matchEntry.AddMenuItem(GettextCatalog.GetString("Search Members"));

            searchMembers.Activated += delegate {
                SetSearchCategory("member");
            };

            matchEntry.ForceFilterButtonVisible = true;
            matchEntry.Entry.FocusOutEvent     += delegate {
                matchEntry.Entry.Text = "";
            };
            var cmd = IdeApp.CommandService.GetCommand(Commands.NavigateTo);

            cmd.KeyBindingChanged += delegate {
                UpdateSearchEntryLabel();
            };
            UpdateSearchEntryLabel();

            matchEntry.Ready       = true;
            matchEntry.Visible     = true;
            matchEntry.IsCheckMenu = true;
            matchEntry.Entry.ModifyBase(StateType.Normal, Style.White);
            matchEntry.WidthRequest   = 240;
            matchEntry.RoundedShape   = true;
            matchEntry.Entry.Changed += HandleSearchEntryChanged;
            matchEntry.Activated     += (sender, e) => {
                if (popup != null)
                {
                    popup.OpenFile();
                }
            };
            matchEntry.Entry.KeyPressEvent += (o, args) => {
                if (args.Event.Key == Gdk.Key.Escape)
                {
                    var doc = IdeApp.Workbench.ActiveDocument;
                    if (doc != null)
                    {
                        if (popup != null)
                        {
                            popup.Destroy();
                        }
                        doc.Select();
                    }
                    return;
                }
                if (popup != null)
                {
                    args.RetVal = popup.ProcessKey(args.Event.Key, args.Event.State);
                }
            };
            IdeApp.Workbench.RootWindow.WidgetEvent += delegate(object o, WidgetEventArgs args) {
                if (args.Event is Gdk.EventConfigure)
                {
                    PositionPopup();
                }
            };

            BuildToolbar();
            IdeApp.CommandService.RegisterCommandBar(buttonBar);

            AddinManager.ExtensionChanged += delegate(object sender, ExtensionEventArgs args) {
                if (args.PathChanged(ToolbarExtensionPath))
                {
                    BuildToolbar();
                }
            };

            contentBox.PackStart(matchEntry, false, false, 0);

            var align = new Gtk.Alignment(0, 0, 1f, 1f);

            align.Show();
            align.TopPadding    = 5;
            align.LeftPadding   = 9;
            align.RightPadding  = 18;
            align.BottomPadding = 10;
            align.Add(contentBox);

            Add(align);
            UpdateCombos();

            button.Clicked += HandleStartButtonClicked;
            IdeApp.CommandService.RegisterCommandBar(this);
            this.ShowAll();
            this.statusArea.statusIconBox.HideAll();
        }
Пример #48
0
            public GameViewerUI()
                : base()
            {
                menubar = new ViewerMenuBar ();
                // this will be enabled as and when
                menubar.moveCommentMenuItem.Sensitive = false;
                chessGameWidget = new ChessGameWidget (this);

                PackStart (chessGameWidget, true, true, 2);
                statusBar = new Statusbar ();
                progressBar = new ProgressBar ();
                progressBar.Stop ();
                HBox box = new HBox ();
                box.PackStart (progressBar, false, false, 2);
                box.PackStart (statusBar, true, true, 2);
                PackStart (box, false, true, 2);
            }
Пример #49
0
        void CreateAbout()
        {
            CssProvider window_css_provider = new CssProvider();
            Image       image = UserInterfaceHelpers.GetImage("about.png");

            window_css_provider.LoadFromData("GtkWindow {" +
                                             "background-image: url('" + image.File + "');" +
                                             "background-repeat: no-repeat;" +
                                             "background-position: left bottom;" +
                                             "}");

            StyleContext.AddProvider(window_css_provider, 800);

            var layout_vertical = new VBox(false, 0);
            var links_layout    = new HBox(false, 16);

            CssProvider label_css_provider = new CssProvider();

            label_css_provider.LoadFromData("GtkLabel { color: #fff; font-size: 10px; background-color: rgba(0, 0, 0, 0); }");

            CssProvider label_highlight_css_provider = new CssProvider();

            label_highlight_css_provider.LoadFromData("GtkLabel { color: #a8bbcf; font-size: 10px; }");

            var version = new Label {
                Text   = "version " + Controller.RunningVersion,
                Xalign = 0, Xpad = 0
            };

            if (InstallationInfo.Directory.StartsWith("/app", StringComparison.InvariantCulture))
            {
                version.Text += " (Flatpak)";
            }

            version.StyleContext.AddProvider(label_css_provider, 800);

            updates = new Label("Checking for updates…")
            {
                Xalign = 0, Xpad = 0
            };

            updates.StyleContext.AddProvider(label_highlight_css_provider, 800);

            var copyright = new Label {
                Markup = string.Format("Copyright © 2010–{0} Hylke Bons and others", DateTime.Now.Year),
                Xalign = 0, Xpad = 0
            };

            copyright.StyleContext.AddProvider(label_css_provider, 800);

            var license = new TextView {
                Sensitive = false,
                WrapMode  = WrapMode.Word
            };

            var text_view_css_provider = new CssProvider();

            text_view_css_provider.LoadFromData("GtkTextView { color: #fff; font-size: 10px; background-color: rgba(0, 0, 0, 0); }");

            license.StyleContext.AddProvider(text_view_css_provider, 800);

            TextBuffer license_buffer = license.Buffer;

            license_buffer.Text = "SparkleShare is Open Source and you’re free to use, change, " +
                                  "and share it under the GNU GPLv3";

            version.StyleContext.AddProvider(label_css_provider, 800);

            var website_link        = new Link("Website", Controller.WebsiteLinkAddress);
            var credits_link        = new Link("Credits", Controller.CreditsLinkAddress);
            var report_problem_link = new Link("Report a problem", Controller.ReportProblemLinkAddress);
            var debug_log_link      = new Link("Debug log", Controller.DebugLogLinkAddress);

            layout_vertical.PackStart(new Label(""), true, true, 0);
            layout_vertical.PackStart(version, false, false, 0);
            layout_vertical.PackStart(updates, false, false, 0);
            layout_vertical.PackStart(copyright, false, false, 6);
            layout_vertical.PackStart(license, false, false, 6);
            layout_vertical.PackStart(links_layout, false, false, 16);

            links_layout.PackStart(website_link, false, false, 0);
            links_layout.PackStart(credits_link, false, false, 0);
            links_layout.PackStart(report_problem_link, false, false, 0);
            links_layout.PackStart(debug_log_link, false, false, 0);

            var layout_horizontal = new HBox(false, 0);

            layout_horizontal.PackStart(new Label(""), false, false, 149);
            layout_horizontal.PackStart(layout_vertical, false, false, 0);

            Add(layout_horizontal);
        }
Пример #50
0
        public LoginView(LauncherWindow window)
        {
            Window        = window;
            this.MinWidth = 250;

            ErrorLabel = new Label("Username or password incorrect")
            {
                TextColor     = Color.FromBytes(255, 0, 0),
                TextAlignment = Alignment.Center,
                Visible       = false
            };
            UsernameText      = new TextEntry();
            PasswordText      = new PasswordEntry();
            LogInButton       = new Button("Log In");
            RegisterButton    = new Button("Register");
            OfflineButton     = new Button("Play Offline");
            RememberCheckBox  = new CheckBox("Remember Me");
            UsernameText.Text = UserSettings.Local.Username;
            if (UserSettings.Local.AutoLogin)
            {
                PasswordText.Password   = UserSettings.Local.Password;
                RememberCheckBox.Active = true;
            }

            using (var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream("TrueCraft.Launcher.Content.truecraft_logo.png"))
                TrueCraftLogoImage = new ImageView(Image.FromStream(stream).WithBoxSize(350, 75));

            UsernameText.PlaceholderText = "Username";
            PasswordText.PlaceholderText = "Password";
            PasswordText.KeyReleased    += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                {
                    LogInButton_Clicked(sender, e);
                }
            };
            UsernameText.KeyReleased += (sender, e) =>
            {
                if (e.Key == Key.Return || e.Key == Key.NumPadEnter)
                {
                    LogInButton_Clicked(sender, e);
                }
            };
            RegisterButton.Clicked += (sender, e) =>
            {
                Window.WebView.Url = "https://truecraft.io/register";
            };
            OfflineButton.Clicked += (sender, e) =>
            {
                Window.User.Username  = UsernameText.Text;
                Window.User.SessionId = "-";
                Window.InteractionBox.Remove(this);
                Window.InteractionBox.PackEnd(Window.MainMenuView = new MainMenuView(Window));
            };
            var regoffbox = new HBox();

            RegisterButton.WidthRequest = OfflineButton.WidthRequest = 0.5;
            regoffbox.PackStart(RegisterButton, true);
            regoffbox.PackStart(OfflineButton, true);
            LogInButton.Clicked += LogInButton_Clicked;

            this.PackEnd(regoffbox);
            this.PackEnd(LogInButton);
            this.PackEnd(RememberCheckBox);
            this.PackEnd(PasswordText);
            this.PackEnd(UsernameText);
            this.PackEnd(ErrorLabel);
        }
Пример #51
0
        public Widget CreateLabel(Orientation orientation)
        {
            Gtk.Box box;
            if (orientation == Orientation.Horizontal)
            {
                box = new HBox();
            }
            else
            {
                box = new VBox();
            }
            box.Spacing = 3;

            Gdk.Pixbuf errorIcon     = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Error, IconSize.Menu);
            Gdk.Pixbuf noErrorIcon   = ImageService.MakeGrayscale(errorIcon);            // creates a new pixbuf instance
            Gdk.Pixbuf warningIcon   = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Warning, IconSize.Menu);
            Gdk.Pixbuf noWarningIcon = ImageService.MakeGrayscale(warningIcon);          // creates a new pixbuf instance

            Gtk.Image errorImage   = new Gtk.Image(errorIcon);
            Gtk.Image warningImage = new Gtk.Image(warningIcon);

            box.PackStart(errorImage, false, false, 0);
            Label errors = new Gtk.Label();

            box.PackStart(errors, false, false, 0);

            box.PackStart(warningImage, false, false, 0);
            Label warnings = new Gtk.Label();

            box.PackStart(warnings, false, false, 0);

            TaskEventHandler updateHandler = delegate {
                int ec = 0, wc = 0;
                foreach (Task t in TaskService.Errors)
                {
                    if (t.Severity == TaskSeverity.Error)
                    {
                        ec++;
                    }
                    else if (t.Severity == TaskSeverity.Warning)
                    {
                        wc++;
                    }
                }
                errors.Text         = ec.ToString();
                errorImage.Pixbuf   = ec > 0 ? errorIcon : noErrorIcon;
                warnings.Text       = wc.ToString();
                warningImage.Pixbuf = wc > 0 ? warningIcon : noWarningIcon;
            };

            updateHandler(null, null);

            TaskService.Errors.TasksAdded   += updateHandler;
            TaskService.Errors.TasksRemoved += updateHandler;

            box.Destroyed += delegate {
                noErrorIcon.Dispose();
                noWarningIcon.Dispose();
                TaskService.Errors.TasksAdded   -= updateHandler;
                TaskService.Errors.TasksRemoved -= updateHandler;
            };
            return(box);
        }
            public SearchableGamesListWidget(GameViewerUI viewer)
            {
                HBox box = new HBox ();
                box.PackStart (new
                           Label (Catalog.
                              GetString ("Filter")),
                           false, false, 4);
                searchEntry = new Entry ();
                box.PackStart (searchEntry, true, true, 2);

                PackStart (box, false, true, 2);

                gamesListWidget =
                    new
                    GameViewerGamesListWidget (viewer);

                PackStart (gamesListWidget, true, true, 2);
                ShowAll ();

                filter = new TreeModelFilter (gamesListWidget.
                                  Model, null);
                filter.VisibleFunc = SearchFilterFunc;
                searchEntry.Changed += OnSearch;
            }
Пример #53
0
        private void InitUI()
        {
            try
            {
                //Tab1
                VBox vboxTab1 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                // HBoxs
                HBox hbox1 = new HBox(true, _boxSpacing);
                HBox hbox2 = new HBox(true, _boxSpacing);

                //Ord
                Entry       entryOrd = new Entry();
                BOWidgetBox boxLabel = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_order"), entryOrd);
                vboxTab1.PackStart(boxLabel, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxLabel, _dataSourceRow, "Ord", SettingsApp.RegexIntegerGreaterThanZero, true));

                //Code
                Entry       entryCode = new Entry();
                BOWidgetBox boxCode   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_code"), entryCode);
                vboxTab1.PackStart(boxCode, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxCode, _dataSourceRow, "Code", SettingsApp.RegexIntegerGreaterThanZero, true));

                //PrinterType
                _xpoComboBoxPrinterType = new XPOComboBox(DataSourceRow.Session, typeof(sys_configurationprinterstype), (DataSourceRow as sys_configurationprinters).PrinterType, "Designation", null);
                BOWidgetBox boxPrinterType = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_type"), _xpoComboBoxPrinterType);
                vboxTab1.PackStart(boxPrinterType, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxPrinterType, DataSourceRow, "PrinterType", SettingsApp.RegexGuid, true));

                //Designation
                Entry       entryDesignation = new Entry();
                BOWidgetBox boxDesignation   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_designation"), entryDesignation);
                vboxTab1.PackStart(boxDesignation, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxDesignation, _dataSourceRow, "Designation", SettingsApp.RegexAlfaNumericExtended, true));

                //NetworkName
                Entry       entryNetworkName = new Entry();
                BOWidgetBox boxNetworkName   = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_networkname"), entryNetworkName);
                vboxTab1.PackStart(boxNetworkName, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxNetworkName, _dataSourceRow, "NetworkName", SettingsApp.RegexHardwarePrinterNetworkNameAndUsbEndpoint, false));

                //Tab2
                _vboxTab2 = new VBox(false, _boxSpacing)
                {
                    BorderWidth = (uint)_boxSpacing
                };

                //ThermalMaxCharsPerLineNormal
                _entryThermalMaxCharsPerLineNormal = new Entry();
                BOWidgetBox boxThermalMaxCharsPerLineNormal = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_max_chars_per_line_normal"), _entryThermalMaxCharsPerLineNormal);
                _vboxTab2.PackStart(boxThermalMaxCharsPerLineNormal, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalMaxCharsPerLineNormal, _dataSourceRow, "ThermalMaxCharsPerLineNormal", SettingsApp.RegexInteger, true));

                //ThermalMaxCharsPerLineNormalBold
                _entryThermalMaxCharsPerLineNormalBold = new Entry();
                BOWidgetBox boxThermalMaxCharsPerLineNormalBold = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_max_chars_per_line_normal_bold"), _entryThermalMaxCharsPerLineNormalBold);
                _vboxTab2.PackStart(boxThermalMaxCharsPerLineNormalBold, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalMaxCharsPerLineNormalBold, _dataSourceRow, "ThermalMaxCharsPerLineNormalBold", SettingsApp.RegexInteger, true));

                //ThermalMaxCharsPerLineSmall
                _entryThermalMaxCharsPerLineSmall = new Entry();
                BOWidgetBox boxThermalMaxCharsPerLineSmall = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_max_chars_per_line_small"), _entryThermalMaxCharsPerLineSmall);
                _vboxTab2.PackStart(boxThermalMaxCharsPerLineSmall, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalMaxCharsPerLineSmall, _dataSourceRow, "ThermalMaxCharsPerLineSmall", SettingsApp.RegexInteger, true));

                //ThermalEncoding
                _entryThermalEncoding = new Entry();
                BOWidgetBox boxThermalEncoding = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_encoding"), _entryThermalEncoding);
                //_vboxTab2.PackStart(boxThermalEncoding, false, false, 0);
                hbox1.PackStart(boxThermalEncoding, true, true, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalEncoding, _dataSourceRow, "ThermalEncoding", SettingsApp.RegexAlfaNumeric, false));

                //ThermalCutCommand
                _entryThermalCutCommand = new Entry();
                BOWidgetBox boxThermalCutCommand = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_cut_command"), _entryThermalCutCommand);
                //_vboxTab2.PackStart(boxThermalCutCommand, false, false, 0);
                hbox1.PackStart(boxThermalCutCommand, true, true, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalCutCommand, _dataSourceRow, "ThermalCutCommand", SettingsApp.RegexAlfaNumericExtended, false));

                // Pack hbox
                _vboxTab2.PackStart(hbox1, false, false, 0);

                //ThermalOpenDrawerValueM
                _entryThermalOpenDrawerValueM = new Entry();
                BOWidgetBox boxThermalOpenDrawerValueM = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_open_drawer_value_m"), _entryThermalOpenDrawerValueM);
                //_vboxTab2.PackStart(boxThermalOpenDrawerValueM, false, false, 0);
                hbox2.PackStart(boxThermalOpenDrawerValueM, true, true, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalOpenDrawerValueM, _dataSourceRow, "ThermalOpenDrawerValueM", SettingsApp.RegexAlfaNumericExtended, false));

                //ThermalOpenDrawerValueT1
                _entryThermalOpenDrawerValueT1 = new Entry();
                BOWidgetBox boxThermalOpenDrawerValueT1 = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_open_drawer_value_t1"), _entryThermalOpenDrawerValueT1);
                //_vboxTab2.PackStart(boxThermalOpenDrawerValueT1, false, false, 0);
                hbox2.PackStart(boxThermalOpenDrawerValueT1, true, true, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalOpenDrawerValueT1, _dataSourceRow, "ThermalOpenDrawerValueT1", SettingsApp.RegexAlfaNumericExtended, false));

                //ThermalOpenDrawerValueT2
                _entryThermalOpenDrawerValueT2 = new Entry();
                BOWidgetBox boxThermalOpenDrawerValueT2 = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_open_drawer_value_t2"), _entryThermalOpenDrawerValueT2);
                //_vboxTab2.PackStart(boxThermalOpenDrawerValueT2, false, false, 0);
                hbox2.PackStart(boxThermalOpenDrawerValueT2, true, true, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalOpenDrawerValueT2, _dataSourceRow, "ThermalOpenDrawerValueT2", SettingsApp.RegexAlfaNumericExtended, false));

                // Pack hbox
                _vboxTab2.PackStart(hbox2, false, false, 0);

                //ThermalPrintLogo
                _entryThermalImageCompanyLogo = new Entry();
                BOWidgetBox boxThermalImageCompanyLogo = new BOWidgetBox(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_image_company_logo"), _entryThermalImageCompanyLogo);
                _vboxTab2.PackStart(boxThermalImageCompanyLogo, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(boxThermalImageCompanyLogo, _dataSourceRow, "ThermalImageCompanyLogo", SettingsApp.RegexAlfaNumericFilePath, false));

                //ThermalPrintLogo
                CheckButton checkButtonThermalPrintLogo = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_printer_thermal_print_logo"));
                _vboxTab2.PackStart(checkButtonThermalPrintLogo, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonThermalPrintLogo, _dataSourceRow, "ThermalPrintLogo"));

                // Events
                _xpoComboBoxPrinterType.Changed += XpoComboBoxPrinterType_Changed;

                //Disabled
                CheckButton checkButtonDisabled = new CheckButton(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_disabled"));
                if (_dialogMode == DialogMode.Insert)
                {
                    checkButtonDisabled.Active = SettingsApp.BOXPOObjectsStartDisabled;
                }
                vboxTab1.PackStart(checkButtonDisabled, false, false, 0);
                _crudWidgetList.Add(new GenericCRUDWidgetXPO(checkButtonDisabled, _dataSourceRow, "Disabled"));

                //Append Tab
                _notebook.AppendPage(vboxTab1, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_detail")));
                _notebook.AppendPage(_vboxTab2, new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_record_main_properties")));
            }
            catch (System.Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }
Пример #54
0
        public SubTileEditor(AreaEditor areaEditor) : base(0, 0, 0, 0)
        {
            this.areaEditor = areaEditor;

            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.PackStart(subTileViewer);
            hbox.PackStart(subTileCollisionEditor);
            hAlign.Add(hbox);

            vbox.PackStart(hAlign);

            // Next row: collision value

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

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

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

            // Next rows: subtile properties

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

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

            subTileSpinButton               = new SpinButtonHexadecimal(0, 255);
            subTileSpinButton.CanFocus      = false;
            subTileSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            paletteSpinButton               = new SpinButton(0, 7, 1);
            paletteSpinButton.CanFocus      = false;
            paletteSpinButton.ValueChanged += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            flipXCheckButton          = new Gtk.CheckButton();
            flipXCheckButton.CanFocus = false;
            flipXCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            flipYCheckButton          = new Gtk.CheckButton();
            flipYCheckButton.CanFocus = false;
            flipYCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            priorityCheckButton          = new Gtk.CheckButton();
            priorityCheckButton.CanFocus = false;
            priorityCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };
            bankCheckButton          = new Gtk.CheckButton();
            bankCheckButton.CanFocus = false;
            bankCheckButton.Toggled += delegate(object sender, EventArgs e) {
                PushFlags();
            };

            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       = "You're better off leaving this checked.";
            bankCheckButton.TooltipText = "You're better off leaving this 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.PackStart(table);
            this.Add(vbox);

            ShowAll();

            PullEverything();
        }
Пример #55
0
        public PosPaymentsDialog(Window pSourceWindow, DialogFlags pDialogFlags, ArticleBag pArticleBag, bool pEnablePartialPaymentButtons, bool pEnableCurrentAccountButton, bool pSkipPersistFinanceDocument, ProcessFinanceDocumentParameter pProcessFinanceDocumentParameter, string pSelectedPaymentMethodButtonName)
            : base(pSourceWindow, pDialogFlags, false)
        {
            try
            {
                //Init Local Vars
                _sourceWindow = pSourceWindow;
                string windowTitle = resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "window_title_dialog_payments");
                //TODO:THEME
                Size   windowSize            = new Size(598, 620);
                string fileDefaultWindowIcon = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\Windows\icon_window_payments.png");

                //Parameters
                _articleBagFullPayment           = pArticleBag;
                _skipPersistFinanceDocument      = pSkipPersistFinanceDocument;
                _processFinanceDocumentParameter = pProcessFinanceDocumentParameter;
                bool enablePartialPaymentButtons = pEnablePartialPaymentButtons;
                bool enableCurrentAccountButton  = pEnableCurrentAccountButton;
                if (enablePartialPaymentButtons)
                {
                    enablePartialPaymentButtons = (_articleBagFullPayment.TotalQuantity > 1) ? true : false;
                }
                //Files
                //TK016311 Botão Novo Cliente nos pagamentos do TicketPad
                string fileIconNewCustomer    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_clients.png");
                string fileIconClearCustomer  = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_nav_delete.png");
                string fileIconFullPayment    = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_full.png");
                string fileIconPartialPayment = FrameworkUtils.OSSlash(GlobalFramework.Path["images"] + @"Icons\icon_pos_payment_partial.png");
                //Colors
                Color colorPosPaymentsDialogTotalPannelBackground = FrameworkUtils.StringToColor(GlobalFramework.Settings["colorPosPaymentsDialogTotalPannelBackground"]);
                //Objects
                _intialValueConfigurationCountry = SettingsApp.ConfigurationSystemCountry;

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
                //Payment Buttons
                //Get Custom Select Data
                string       executeSql   = @"SELECT Oid, Token, ResourceString FROM fin_configurationpaymentmethod ORDER BY Ord;";
                XPSelectData xPSelectData = FrameworkUtils.GetSelectedDataFromQuery(executeSql);
                //Get Required XpObjects from Selected Data
                fin_configurationpaymentmethod xpoMoney      = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "MONEY");
                fin_configurationpaymentmethod xpoCheck      = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "BANK_CHECK");
                fin_configurationpaymentmethod xpoMB         = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "CASH_MACHINE");
                fin_configurationpaymentmethod xpoCreditCard = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "CREDIT_CARD");
                /* IN009142 - "Visa" option replaced by "Debit Card" */
                fin_configurationpaymentmethod xpoDebitCard      = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "DEBIT_CARD");
                fin_configurationpaymentmethod xpoVisa           = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "VISA");
                fin_configurationpaymentmethod xpoCurrentAccount = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "CURRENT_ACCOUNT");
                fin_configurationpaymentmethod xpoCustomerCard   = (fin_configurationpaymentmethod)xPSelectData.GetXPGuidObjectFromField(typeof(fin_configurationpaymentmethod), "Token", "CUSTOMER_CARD");

                //Instantiate Buttons  //IN009257 Redimensionar botões para a resolução 1024 x 768. Alterei variável de tamanho de icons. era a mesma que documentos
                TouchButtonIconWithText buttonMoney = new TouchButtonIconWithText("touchButtonMoney_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoMoney.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMoney.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBasePaymentButton.Width, _sizeBasePaymentButton.Height)
                {
                    CurrentButtonOid = xpoMoney.Oid, Sensitive = (xpoMoney.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCheck = new TouchButtonIconWithText("touchButtonCheck_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoCheck.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCheck.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBasePaymentButton.Width, _sizeBasePaymentButton.Height)
                {
                    CurrentButtonOid = xpoCheck.Oid, Sensitive = (xpoCheck.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonMB = new TouchButtonIconWithText("touchButtonMB_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoMB.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoMB.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBasePaymentButton.Width, _sizeBasePaymentButton.Height)
                {
                    CurrentButtonOid = xpoMB.Oid, Sensitive = (xpoMB.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCreditCard = new TouchButtonIconWithText("touchButtonCreditCard_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoCreditCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCreditCard.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBasePaymentButton.Width, _sizeBasePaymentButton.Height)
                {
                    CurrentButtonOid = xpoCreditCard.Oid, Sensitive = (xpoCreditCard.Disabled) ? false : true
                };
                /* IN009142 */
                TouchButtonIconWithText buttonDebitCard = new TouchButtonIconWithText("touchButtonDebitCard_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoDebitCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoDebitCard.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBasePaymentButton.Width, _sizeBasePaymentButton.Height)
                {
                    CurrentButtonOid = xpoDebitCard.Oid, Sensitive = (xpoDebitCard.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonVisa = new TouchButtonIconWithText("touchButtonVisa_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoVisa.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoVisa.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBasePaymentButton.Width, _sizeBasePaymentButton.Height)
                {
                    CurrentButtonOid = xpoVisa.Oid, Sensitive = (xpoVisa.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCurrentAccount = new TouchButtonIconWithText("touchButtonCurrentAccount_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoCurrentAccount.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCurrentAccount.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCurrentAccount.Oid, Sensitive = (xpoCurrentAccount.Disabled) ? false : true
                };
                TouchButtonIconWithText buttonCustomerCard = new TouchButtonIconWithText("touchButtonCustomerCard_Green", _colorBaseDialogDefaultButtonBackground, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], xpoCustomerCard.ResourceString), _fontBaseDialogButton, _colorBaseDialogDefaultButtonFont, FrameworkUtils.OSSlash(string.Format("{0}{1}", GlobalFramework.Path["images"], xpoCustomerCard.ButtonIcon)), _sizeBasePaymentButtonIcon, _sizeBaseDialogDefaultButton.Width, _sizeBaseDialogDefaultButton.Height)
                {
                    CurrentButtonOid = xpoCustomerCard.Oid, Sensitive = (xpoCustomerCard.Disabled) ? false : true
                };
                //Secondary Buttons
                //Events
                buttonMoney.Clicked      += buttonMoney_Clicked;
                buttonCheck.Clicked      += buttonCheck_Clicked;
                buttonMB.Clicked         += buttonMB_Clicked;
                buttonCreditCard.Clicked += buttonCredit_Clicked;
                /* IN009142 */
                buttonDebitCard.Clicked      += buttonDebitCard_Clicked;
                buttonVisa.Clicked           += buttonVisa_Clicked;
                buttonCurrentAccount.Clicked += buttonCurrentAccount_Clicked;
                buttonCustomerCard.Clicked   += buttonCustomerCard_Clicked;

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Table
                uint  tablePaymentsPadding = 0;
                Table tablePayments        = new Table(2, 3, true)
                {
                    BorderWidth = 2
                };
                //Row 1
                tablePayments.Attach(buttonMoney, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonMB, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                /* IN009142 - adding "Debit Card" option to Payment window */
                tablePayments.Attach(buttonDebitCard, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                /* IN009142 - removed "Visa" payment method */
                //tablePayments.Attach(buttonVisa, 2, 3, 0, 1, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                //Row 2
                tablePayments.Attach(buttonCheck, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                tablePayments.Attach(buttonCreditCard, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding);
                if (enableCurrentAccountButton)
                {
                    tablePayments.Attach(
                        (SettingsApp.PosPaymentsDialogUseCurrentAccount) ? buttonCurrentAccount : buttonCustomerCard
                        , 2, 3, 1, 2, AttachOptions.Fill, AttachOptions.Fill, tablePaymentsPadding, tablePaymentsPadding
                        );
                }

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Labels
                Label labelTotal    = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_price_to_pay") + ":");
                Label labelDelivery = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_deliver") + ":");
                Label labelChange   = new Label(resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_total_change") + ":");
                _labelTotalValue = new Label(FrameworkUtils.DecimalToStringCurrency(_articleBagFullPayment.TotalFinal))
                {
                    //Total Width
                    WidthRequest = 120
                };
                _labelDeliveryValue = new Label(FrameworkUtils.DecimalToStringCurrency(0));
                _labelChangeValue   = new Label(FrameworkUtils.DecimalToStringCurrency(0));

                //Colors
                labelTotal.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                labelDelivery.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                labelChange.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.FromArgb(101, 137, 171)));
                _labelTotalValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));
                _labelDeliveryValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));
                _labelChangeValue.ModifyFg(StateType.Normal, Utils.ColorToGdkColor(Color.White));

                //Alignments
                labelTotal.SetAlignment(0, 0.5F);
                labelDelivery.SetAlignment(0, 0.5F);
                labelChange.SetAlignment(0, 0.5F);
                _labelTotalValue.SetAlignment(1, 0.5F);
                _labelDeliveryValue.SetAlignment(1, 0.5F);
                _labelChangeValue.SetAlignment(1, 0.5F);

                //labels Font
                Pango.FontDescription fontDescription = Pango.FontDescription.FromString("Bold 10");
                labelTotal.ModifyFont(fontDescription);
                labelDelivery.ModifyFont(fontDescription);
                labelChange.ModifyFont(fontDescription);
                Pango.FontDescription fontDescriptionValue = Pango.FontDescription.FromString("Bold 12");
                _labelTotalValue.ModifyFont(fontDescriptionValue);
                _labelDeliveryValue.ModifyFont(fontDescriptionValue);
                _labelChangeValue.ModifyFont(fontDescriptionValue);

                //Table TotalPannel
                uint  totalPannelPadding = 9;
                Table tableTotalPannel   = new Table(3, 2, false);
                tableTotalPannel.HeightRequest = 132;
                //Row 1
                tableTotalPannel.Attach(labelTotal, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelTotalValue, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                //Row 2
                tableTotalPannel.Attach(labelDelivery, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelDeliveryValue, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                //Row 3
                tableTotalPannel.Attach(labelChange, 0, 1, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);
                tableTotalPannel.Attach(_labelChangeValue, 1, 2, 2, 3, AttachOptions.Fill, AttachOptions.Fill, totalPannelPadding, totalPannelPadding);

                //TotalPannel
                EventBox eventboxTotalPannel = new EventBox();
                eventboxTotalPannel.BorderWidth = 3;
                eventboxTotalPannel.ModifyBg(StateType.Normal, Utils.ColorToGdkColor(colorPosPaymentsDialogTotalPannelBackground));
                eventboxTotalPannel.Add(tableTotalPannel);

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Customer Name
                CriteriaOperator criteriaOperatorCustomerName = null;
                /* IN009202 */
                _entryBoxSelectCustomerName             = new XPOEntryBoxSelectRecordValidation <erp_customer, TreeViewCustomer>(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_customer"), "Name", "Name", null, criteriaOperatorCustomerName, KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericPlus, false);
                _entryBoxSelectCustomerName.ClosePopup += delegate
                {
                    //IN009284 POS - Pagamento conta-corrente - Cliente por defeito
                    if (_processFinanceDocumentParameter != null)
                    {
                        GetCustomerDetails("Oid", _processFinanceDocumentParameter.Customer.ToString());
                        Validate();
                    }
                    //IN009284 ENDS
                    else
                    {
                        GetCustomerDetails("Oid", _entryBoxSelectCustomerName.Value.Oid.ToString());
                        Validate();
                    }
                };
                _entryBoxSelectCustomerName.EntryValidation.Changed += _entryBoxSelectCustomerName_Changed;

                //Customer Discount
                _entryBoxCustomerDiscount = new EntryBoxValidation(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_discount"), KeyboardMode.Alfa, SettingsApp.RegexPercentage, true);
                _entryBoxCustomerDiscount.EntryValidation.Text           = FrameworkUtils.DecimalToString(0.0m);
                _entryBoxCustomerDiscount.EntryValidation.Sensitive      = false;
                _entryBoxCustomerDiscount.EntryValidation.Changed       += _entryBoxCustomerDiscount_Changed;
                _entryBoxCustomerDiscount.EntryValidation.FocusOutEvent += delegate
                {
                    _entryBoxCustomerDiscount.EntryValidation.Text = FrameworkUtils.StringToDecimalAndToStringAgain(_entryBoxCustomerDiscount.EntryValidation.Text);
                };

                //Address
                _entryBoxCustomerAddress = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_address"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericPlus, false);/* IN009253 */
                _entryBoxCustomerAddress.EntryValidation.Changed += delegate { Validate(); };

                //Locality
                _entryBoxCustomerLocality = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_locality"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericPlus, false);/* IN009253 */
                _entryBoxCustomerLocality.EntryValidation.Changed += delegate { Validate(); };

                //ZipCode
                _entryBoxCustomerZipCode = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_zipcode"), KeyboardMode.Alfa, SettingsApp.ConfigurationSystemCountry.RegExZipCode, false);
                _entryBoxCustomerZipCode.WidthRequest             = 150;
                _entryBoxCustomerZipCode.EntryValidation.Changed += delegate { Validate(); };

                //City
                _entryBoxCustomerCity = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_city"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericPlus, false);/* IN009253 */
                _entryBoxCustomerCity.WidthRequest             = 200;
                _entryBoxCustomerCity.EntryValidation.Changed += delegate { Validate(); };

                //Country
                CriteriaOperator criteriaOperatorCustomerCountry = CriteriaOperator.Parse("(Disabled IS NULL OR Disabled  <> 1) AND (RegExFiscalNumber IS NOT NULL AND RegExZipCode IS NOT NULL)");
                _entryBoxSelectCustomerCountry = new XPOEntryBoxSelectRecordValidation <cfg_configurationcountry, TreeViewConfigurationCountry>(pSourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_country"), "Designation", "Oid", _intialValueConfigurationCountry, criteriaOperatorCustomerCountry, SettingsApp.RegexGuid, true);
                _entryBoxSelectCustomerCountry.WidthRequest = 235;
                //Extra Protection to prevent Customer without Country
                if (_entryBoxSelectCustomerCountry.Value != null)
                {
                    _entryBoxSelectCustomerCountry.EntryValidation.Validate(_entryBoxSelectCustomerCountry.Value.Oid.ToString());
                }
                _entryBoxSelectCustomerCountry.EntryValidation.IsEditable  = false;
                _entryBoxSelectCustomerCountry.ButtonSelectValue.Sensitive = false;
                _entryBoxSelectCustomerCountry.ClosePopup += delegate
                {
                    _selectedCountry = _entryBoxSelectCustomerCountry.Value;
                    //Require to Update RegEx and Criteria to filter Country Clients Only
                    _entryBoxSelectCustomerFiscalNumber.EntryValidation.Rule = _entryBoxSelectCustomerCountry.Value.RegExFiscalNumber;
                    _entryBoxCustomerZipCode.EntryValidation.Rule            = _entryBoxSelectCustomerCountry.Value.RegExZipCode;
                    //Clear Customer Fields, Except Country
                    ClearCustomer(false);
                    //Apply Criteria Operators
                    ApplyCriteriaToCustomerInputs();
                    //Call Main Validate
                    Validate();
                };

                //FiscalNumber
                CriteriaOperator criteriaOperatorFiscalNumber = null;
                _entryBoxSelectCustomerFiscalNumber = new XPOEntryBoxSelectRecordValidation <erp_customer, TreeViewCustomer>(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_fiscal_number"), "FiscalNumber", "FiscalNumber", null, criteriaOperatorFiscalNumber, KeyboardMode.AlfaNumeric, _intialValueConfigurationCountry.RegExFiscalNumber, false);
                _entryBoxSelectCustomerFiscalNumber.EntryValidation.Changed += _entryBoxSelectCustomerFiscalNumber_Changed;

                //CardNumber
                CriteriaOperator criteriaOperatorCardNumber = null;//Now Criteria is assigned in ApplyCriteriaToCustomerInputs();
                _entryBoxSelectCustomerCardNumber             = new XPOEntryBoxSelectRecordValidation <erp_customer, TreeViewCustomer>(_sourceWindow, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_card_number"), "CardNumber", "CardNumber", null, criteriaOperatorCardNumber, KeyboardMode.AlfaNumeric, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxSelectCustomerCardNumber.ClosePopup += delegate
                {
                    if (_entryBoxSelectCustomerCardNumber.EntryValidation.Validated)
                    {
                        GetCustomerDetails("CardNumber", _entryBoxSelectCustomerCardNumber.EntryValidation.Text);
                    }
                    Validate();
                };

                //Notes
                _entryBoxCustomerNotes = new EntryBoxValidation(this, resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_notes"), KeyboardMode.Alfa, SettingsApp.RegexAlfaNumericExtended, false);
                _entryBoxCustomerNotes.EntryValidation.Changed += delegate { Validate(); };

                //Fill Dialog Inputs with Defaults FinalConsumerEntity Values
                if (_processFinanceDocumentParameter == null)
                {
                    //If ProcessFinanceDocumentParameter is not null fill Dialog with value from ProcessFinanceDocumentParameter, implemented for SplitPayments
                    GetCustomerDetails("Oid", SettingsApp.XpoOidDocumentFinanceMasterFinalConsumerEntity.ToString());
                }
                //Fill Dialog Inputs with Stored Values, ex when we Work with SplitPayments
                else
                {
                    //Apply Default Customer Entity
                    GetCustomerDetails("Oid", _processFinanceDocumentParameter.Customer.ToString());

                    //Assign Totasl and Discounts Values
                    _totalDelivery  = _processFinanceDocumentParameter.TotalDelivery;
                    _totalChange    = _processFinanceDocumentParameter.TotalChange;
                    _discountGlobal = _processFinanceDocumentParameter.ArticleBag.DiscountGlobal;
                    // Update Visual Components
                    _labelDeliveryValue.Text = FrameworkUtils.DecimalToStringCurrency(_totalDelivery);
                    _labelChangeValue.Text   = FrameworkUtils.DecimalToStringCurrency(_totalChange);
                    // Selects
                    _selectedCustomer = (erp_customer)FrameworkUtils.GetXPGuidObject(typeof(erp_customer), _processFinanceDocumentParameter.Customer);
                    _selectedCountry  = _selectedCustomer.Country;
                    // PaymentMethod
                    _selectedPaymentMethod = (fin_configurationpaymentmethod)FrameworkUtils.GetXPGuidObject(typeof(fin_configurationpaymentmethod), _processFinanceDocumentParameter.PaymentMethod);
                    // Restore Selected Payment Method, require to associate button reference to selectedPaymentMethodButton
                    if (!string.IsNullOrEmpty(pSelectedPaymentMethodButtonName))
                    {
                        switch (pSelectedPaymentMethodButtonName)
                        {
                        case "touchButtonMoney_Green":
                            _selectedPaymentMethodButton = buttonMoney;
                            break;

                        case "touchButtonCheck_Green":
                            _selectedPaymentMethodButton = buttonCheck;
                            break;

                        case "touchButtonMB_Green":
                            _selectedPaymentMethodButton = buttonMB;
                            break;

                        case "touchButtonCreditCard_Green":
                            _selectedPaymentMethodButton = buttonCreditCard;
                            break;

                        /* IN009142 */
                        case "touchButtonDebitCard_Green":
                            _selectedPaymentMethodButton = buttonDebitCard;
                            break;

                        case "touchButtonVisa_Green":
                            _selectedPaymentMethodButton = buttonVisa;
                            break;

                        case "touchButtonCurrentAccount_Green":
                            _selectedPaymentMethodButton = buttonCurrentAccount;
                            break;

                        case "touchButtonCustomerCard_Green":
                            _selectedPaymentMethodButton = buttonCustomerCard;
                            break;
                        }

                        //Assign Payment Method after have Reference
                        AssignPaymentMethod(_selectedPaymentMethodButton);
                    }

                    //UpdateChangeValue, if we add/remove Splits we must recalculate ChangeValue
                    UpdateChangeValue();
                }

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Pack Content

                HBox hboxPaymenstAndTotals = new HBox(false, 0);
                hboxPaymenstAndTotals.PackStart(tablePayments, true, true, 0);
                hboxPaymenstAndTotals.PackStart(eventboxTotalPannel, true, true, 0);

                HBox hboxCustomerNameAndCustomerDiscount = new HBox(true, 0);
                hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxSelectCustomerName, true, true, 0);
                hboxCustomerNameAndCustomerDiscount.PackStart(_entryBoxCustomerDiscount, true, true, 0);

                HBox hboxFiscalNumberAndCardNumber = new HBox(true, 0);
                hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerFiscalNumber, true, true, 0);
                hboxFiscalNumberAndCardNumber.PackStart(_entryBoxSelectCustomerCardNumber, true, true, 0);

                HBox hboxZipCodeCityAndCountry = new HBox(false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerZipCode, false, false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxCustomerCity, false, false, 0);
                hboxZipCodeCityAndCountry.PackStart(_entryBoxSelectCustomerCountry, true, true, 0);

                VBox vboxContent = new VBox(false, 0);
                vboxContent.PackStart(hboxPaymenstAndTotals, true, true, 0);
                vboxContent.PackStart(hboxFiscalNumberAndCardNumber, true, true, 0);
                vboxContent.PackStart(hboxCustomerNameAndCustomerDiscount, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerAddress, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerLocality, true, true, 0);
                vboxContent.PackStart(hboxZipCodeCityAndCountry, true, true, 0);
                vboxContent.PackStart(_entryBoxCustomerNotes, true, true, 0);

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //ActionArea Buttons
                _buttonOk             = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Ok);
                _buttonCancel         = ActionAreaButton.FactoryGetDialogButtonType(PosBaseDialogButtonType.Cancel);
                _buttonClearCustomer  = ActionAreaButton.FactoryGetDialogButtonType("touchButtonClearCustomer_DialogActionArea", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_label_payment_dialog_clear_client"), fileIconClearCustomer);
                _buttonNewCustomer    = ActionAreaButton.FactoryGetDialogButtonType("touchButtonClearCustomer_DialogActionArea", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "dialog_button_label_new_client"), fileIconNewCustomer);
                _buttonFullPayment    = ActionAreaButton.FactoryGetDialogButtonType("touchButtonFullPayment_DialogActionArea", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_label_payment_dialog_full_payment"), fileIconFullPayment);
                _buttonPartialPayment = ActionAreaButton.FactoryGetDialogButtonType("touchButtonPartialPayment_DialogActionArea", resources.CustomResources.GetCustomResources(GlobalFramework.Settings["customCultureResourceDefinition"], "global_button_label_payment_dialog_partial_payment"), fileIconPartialPayment);
                // Enable if has selectedPaymentMethod defined, ex when working with SplitPayments
                _buttonOk.Sensitive          = (_selectedPaymentMethod != null);
                _buttonFullPayment.Sensitive = false;

                //ActionArea
                ActionAreaButtons actionAreaButtons = new ActionAreaButtons();
                actionAreaButtons.Add(new ActionAreaButton(_buttonClearCustomer, _responseTypeClearCustomer));
                actionAreaButtons.Add(new ActionAreaButton(_buttonNewCustomer, _responseTypeClearCustomer));
                if (enablePartialPaymentButtons)
                {
                    actionAreaButtons.Add(new ActionAreaButton(_buttonFullPayment, _responseTypeFullPayment));
                    actionAreaButtons.Add(new ActionAreaButton(_buttonPartialPayment, _responseTypePartialPayment));
                }

                actionAreaButtons.Add(new ActionAreaButton(_buttonOk, ResponseType.Ok));
                actionAreaButtons.Add(new ActionAreaButton(_buttonCancel, ResponseType.Cancel));

                //:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

                //Init Object
                this.InitObject(this, pDialogFlags, fileDefaultWindowIcon, windowTitle, windowSize, vboxContent, actionAreaButtons);
            }
            catch (Exception ex)
            {
                _log.Error(ex.Message, ex);
            }
        }