Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.Info"/> class.
        /// </summary>
        /// <param name='g'>
        /// G.
        /// </param>
        public Info(Game.Game g)
        {
            this.Label = "Score";
            this.BorderWidth = 5;
            this.game = g;

            this.HeightRequest = 99;
            this.WidthRequest = 120;

            scoresTable = new Gtk.Table( 6, 2, true );
            scoreValues = new Gtk.Label[ 6*2 ];
            for( int i=0; i < this.game.players.Length; i++) {
                scoreValues[ i ] = new Label( game.players[i].Name );
                scoreValues[ i+6 ] = new Label( "0" );
                scoresTable.Attach( scoreValues[i], 0 , 1, (uint) i, (uint) i+1);
                scoresTable.Attach( scoreValues[i+6] , 1, 2, (uint) i, (uint) i+1 );
            }
            for( int i=this.game.players.Length; i < 6; i++) {
                scoreValues[ i ] = new Label( );
                scoreValues[ i+6 ] = new Label( );
                scoresTable.Attach( scoreValues[i], 0 , 1, (uint) i, (uint) i+1);
                scoresTable.Attach( scoreValues[i+6] , 1, 2, (uint) i, (uint) i+1 );
            }
            scoresTable.BorderWidth = 3;
            this.Add( scoresTable );

            this.ShowAll();
        }
        public MatrixThresholdFilterDialog(
            MatrixThresholdFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as MatrixThresholdFilter;
            if (module == null) {
                modifiedModule = new MatrixThresholdFilter();
                module = modifiedModule as MatrixThresholdFilter;
            }

            matrixPanel = new ThresholdMatrixPanel(
                (uint)module.Matrix.Height,
                (uint)module.Matrix.Width);
            matrixPanel.Matrix = module.Matrix.DefinitionMatrix;
            matrixPanel.Scaled = !module.Matrix.Incremental;

            table = new Table(2, 1, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };
            table.Attach(new Label("Threshold matrix:") { Xalign = 0.0f },
                0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink,
                0, 0);
            table.Attach(matrixPanel, 0, 1, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);
            table.ShowAll();
            VBox.PackStart(table);
        }
Esempio n. 3
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.Info"/> class.
        /// </summary>
        /// <param name='g'>
        /// G.
        /// </param>
        public Info(Game.Game g)
        {
            this.Label       = "Score";
            this.BorderWidth = 5;
            this.game        = g;

            this.HeightRequest = 99;
            this.WidthRequest  = 120;

            scoresTable = new Gtk.Table(6, 2, true);
            scoreValues = new Gtk.Label[6 * 2];
            for (int i = 0; i < this.game.players.Length; i++)
            {
                scoreValues[i]     = new Label(game.players[i].Name);
                scoreValues[i + 6] = new Label("0");
                scoresTable.Attach(scoreValues[i], 0, 1, (uint)i, (uint)i + 1);
                scoresTable.Attach(scoreValues[i + 6], 1, 2, (uint)i, (uint)i + 1);
            }
            for (int i = this.game.players.Length; i < 6; i++)
            {
                scoreValues[i]     = new Label( );
                scoreValues[i + 6] = new Label( );
                scoresTable.Attach(scoreValues[i], 0, 1, (uint)i, (uint)i + 1);
                scoresTable.Attach(scoreValues[i + 6], 1, 2, (uint)i, (uint)i + 1);
            }
            scoresTable.BorderWidth = 3;
            this.Add(scoresTable);

            this.ShowAll();
        }
Esempio n. 4
0
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        Build();

        Table table = new Table(2, 2, true);

        Add(table); 
        ShowAll();

        buttonView = new Button("View");
        // when this button is clicked, it'll run hello()
        buttonView.Clicked += (s, a) =>
        {
            View();
        };


        textviewView = new TextView();

        table.Attach(buttonView, 0, 2, 0, 1);
        table.Attach(textviewView, 0, 2, 1, 2);
        table.ShowAll();

        View();
    }
Esempio n. 5
0
        void BuildDialogUI()
        {
            // Add an HBox to the dialog's VBox.
              HBox hbox = new HBox (false, 8);
              hbox.BorderWidth = 8;
              this.VBox.PackStart (hbox, false, false, 0);

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

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

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

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

              // Add OK and Cancel Buttons.
              this.AddButton(Stock.Ok, ResponseType.Ok);
              this.AddButton(Stock.Cancel, ResponseType.Cancel);
        }
Esempio n. 6
0
        public AddNodeDialog(SimulatorInterface simulatorInterface)
        {
            this.Build ();
            this.simulatorInterface = simulatorInterface;
            ScrolledWindow sw = new ScrolledWindow ();
            sw.ShadowType = ShadowType.EtchedIn;
            sw.SetPolicy (PolicyType.Automatic, PolicyType.Automatic);
            sw.HeightRequest = 250;

            VBox.PackStart (sw, true, true, 0);
            Table table = new Table ((uint)(BasicNode.NodeLabels.Length), 2, true);
            sw.AddWithViewport (table);
            for (int i = 0; i < BasicNode.NodeLabels.Length; i++)
            {
                labels.Add (new Label (BasicNode.NodeLabels[i]));
                table.Attach (labels[i], 0, 1, (uint)(i), (uint)(i) + 1);
                entries.Add (new SpinButton (0, 80, 1));
                entries[i].ClimbRate = 1;
                entries[i].Numeric = true;
                table.Attach (entries[i], 1, 2, (uint)(i), (uint)(i) + 1);
            }
            buttonOk.Clicked += new EventHandler (AddNode);
            buttonCancel.Clicked += new EventHandler (Cancel);
            this.SetDefaultSize (340, 300);
            this.Modal = true;
            this.ShowAll ();
        }
        /// <summary>
        /// Creates a Gtk.Widget that's used to configure the service.  This
        /// will be used in the Synchronization Preferences.  Preferences should
        /// not automatically be saved by a GConf Property Editor.  Preferences
        /// should be saved when SaveConfiguration () is called.
        /// </summary>
        public override Gtk.Widget CreatePreferencesControl()
        {
            Gtk.Table table = new Gtk.Table(1, 2, false);
            table.RowSpacing    = 5;
            table.ColumnSpacing = 10;

            // Read settings out of gconf
            string syncPath;

            if (GetConfigSettings(out syncPath) == false)
            {
                syncPath = string.Empty;
            }

            Label l = new Label(Catalog.GetString("_Folder Path:"));

            l.Xalign = 1;
            table.Attach(l, 0, 1, 0, 1,
                         Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            pathButton = new FileChooserButton(Catalog.GetString("Select Synchronization Folder..."),
                                               FileChooserAction.SelectFolder);
            l.MnemonicWidget = pathButton;
            pathButton.SetFilename(syncPath);

            table.Attach(pathButton, 1, 2, 0, 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            table.ShowAll();
            return(table);
        }
Esempio n. 8
0
        public Spec(InvoiceSpec ispec, Table table, uint row)
        {
            description = new Entry();
            number = new Entry();
            price = new Entry();
            total = new Entry();

            number.Changed += new EventHandler(UpdateTotal);
            price.Changed += new EventHandler(UpdateTotal);
            total.Changed += new EventHandler(TotalChanged);

            number.SetUsize(NumberEntryWidth, -2);
            price.SetUsize(NumberEntryWidth, -2);
            total.SetUsize(NumberEntryWidth, -2);
            description.SetUsize(300, -2);

            table.Attach(description, 0, 1, row, row+1,
                         AttachOptions.Expand | AttachOptions.Fill, 0, 0, 0);
            table.Attach(number, 1, 2, row, row+1, 0, 0, 0, 0);
            table.Attach(price,  2, 3, row, row+1, 0, 0, 0, 0);
            table.Attach(total,  3, 4, row, row+1, 0, 0, 0, 0);

            description.Text =  ispec.beskrivning;
            if (ispec.antal.Length > 0)				  number.Text = ispec.antal;
            price.Text = ispec.styckpris;
            total.Text = ispec.belopp;
        }
Esempio n. 9
0
        public DebugView(Settings set, DebugManager mgr)
        {
            debugManager = mgr;
            layout = new Table(2, 2, false);
            runStop = new Button("Interrupt");
            command = new Entry();
            log = new ConsoleLog(set);

            command.Activated += OnCommand;
            runStop.Clicked += OnRunStop;

            layout.Attach(log.View, 0, 2, 0, 1,
              AttachOptions.Fill,
              AttachOptions.Expand | AttachOptions.Fill,
              4, 4);
            layout.Attach(command, 0, 1, 1, 2,
              AttachOptions.Fill | AttachOptions.Expand,
              AttachOptions.Fill,
              4, 4);
            layout.Attach(runStop, 1, 2, 1, 2,
              AttachOptions.Fill, AttachOptions.Fill, 4, 4);

            runStop.SetSizeRequest(80, -1);

            command.Sensitive = false;
            runStop.Sensitive = false;

            mgr.MessageReceived += OnDebugOutput;
            mgr.DebuggerBusy += OnBusy;
            mgr.DebuggerReady += OnReady;
            mgr.DebuggerStarted += OnStarted;
            mgr.DebuggerExited += OnExited;
            layout.Destroyed += OnDestroy;
        }
Esempio n. 10
0
        public Tile ()
        {
            Table table = new Table (2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing = 2;
            table.BorderWidth = 2;

            PrimaryLabel = new Label ();
            SecondaryLabel = new Label ();

            table.Attach (image, 0, 1, 0, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            table.Attach (PrimaryLabel, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);
            table.Attach (SecondaryLabel, 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            table.ShowAll ();
            Add (table);

            PrimaryLabel.Xalign = 0.0f;
            PrimaryLabel.Yalign = 0.0f;

            SecondaryLabel.Xalign = 0.0f;
            SecondaryLabel.Yalign = 0.0f;

            StyleSet += delegate {
                PrimaryLabel.ModifyFg (StateType.Normal, Style.Text (StateType.Normal));
                SecondaryLabel.ModifyFg (StateType.Normal, Hyena.Gui.GtkUtilities.ColorBlend (
                    Style.Foreground (StateType.Normal), Style.Background (StateType.Normal)));
            };

            Relief = ReliefStyle.None;
        }
        public VectorErrorFilterDialog(VectorErrorFilter existingModule)
            : base(existingModule)
        {
            module = modifiedModule as VectorErrorFilter;
            if (module == null) {
                modifiedModule = new VectorErrorFilter();
                module = modifiedModule as VectorErrorFilter;
            }

            vectorPanel = new ErrorVectorPanel((uint)module.Matrix.Width);
            vectorPanel.BareMatrix = module.Matrix.DefinitionMatrix;
            vectorPanel.Divisor = module.Matrix.Divisor;
            vectorPanel.UseCustomDivisor = false;
            vectorPanel.SourceOffsetX = module.Matrix.SourceOffsetX;

            table = new Table(2, 1, false)
                { ColumnSpacing = 5, RowSpacing = 5, BorderWidth = 5 };
            table.Attach(new Label("Error vector:") { Xalign = 0.0f },
                0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);
            table.Attach(vectorPanel, 0, 1, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand, 0, 0);
            table.ShowAll();
            VBox.PackStart(table);
        }
Esempio n. 12
0
		public HeightMapSizeDialog( DoneCallback source )
		{
            this.source = source;

			window = new Window ("Heightmap width and height:");
			window.SetDefaultSize (200, 100);

            Table table = new Table( 3, 2, false );
            table.BorderWidth = 20;
            table.RowSpacing = 20;
            table.ColumnSpacing = 20;
            window.Add(table);

            table.Attach(new Label("Width:"), 0, 1, 0, 1);
            table.Attach(new Label("Height:"), 0, 1, 1, 2);

            widthcombo = new Combo();
            widthcombo.PopdownStrings = new string[]{"4","8","12","16","20","24","28","32"};
            table.Attach(widthcombo, 1, 2, 0, 1);

            heightcombo = new Combo();
            heightcombo.PopdownStrings = new string[]{"4","8","12","16","20","24","28","32"};
            table.Attach(heightcombo, 1, 2, 1, 2);

			Button button = new Button (Stock.Ok);
			button.Clicked += new EventHandler (OnOkClicked);
			button.CanDefault = true;
			
            table.Attach(button, 1, 2, 2, 3);

            window.Modal = true;
            window.ShowAll();
		}
Esempio n. 13
0
        /// <summary>Crea una instancia de la clase.</summary>

        public PanelMemoria() : base(false, 0)
        {
            VBox vb = new VBox(false, 0);

            Gtk.Table tabla = new Gtk.Table(MemoriaPrincipal.TAMANO, 5, true);
            for (short i = 0; i < MemoriaPrincipal.TAMANO; i++)
            {
                direcciones[i] =
                    new Gtk.Label(Conversiones.ToHexString(i));
                contenido[i] =
                    new Gtk.Label(Conversiones.ToHexString((short)0));

                tabla.Attach(direcciones[i], 1, 2, (uint)i, (uint)i + 1);
                tabla.Attach(contenido[i], 3, 4, (uint)i, (uint)i + 1);
            }
            vb.PackStart(tabla);
            ScrolledWindow sw = new ScrolledWindow();

            sw.AddWithViewport(vb);

            Gtk.Table t2 = new Gtk.Table(4, 1, true);
            t2.Attach(new Gtk.Label(Ventana.GetText("PMem_Contenido")),
                      0, 1, 0, 1);
            t2.Attach(sw, 0, 1, 1, 3);
            t2.Attach(new Gtk.Label(""), 0, 1, 3, 4);

            this.PackStart(t2);
        }
Esempio n. 14
0
    public Nim()
        : base("Play Nim!")
    {
        SetDefaultSize(250, 230);
        SetPosition(WindowPosition.Center);
        DeleteEvent += delegate { Application.Quit(); } ;
        ModifyBg(StateType.Normal, new Gdk.Color(0,0,0));
        VBox vbox = new VBox(false, 2);

        Label indicator_text = new Label(indicator);
        Pango.FontDescription fontdesc= Pango.FontDescription.FromString("Times New Roman 15");
        indicator_text.ModifyFont(fontdesc);
        /*
        MenuBar mb = new MenuBar();
        Menu filemenu = new Menu();
        MenuItem file = new MenuItem("File");
        file.Submenu = filemenu;
        mb.Append(file);

        vbox.PackStart(mb, false, false, 0);
        */
        Table table = new Table(3,15,true);
        table.Attach(indicator_text,0,15,0,1);
        for( uint x=1; x<16; x++){
            uint y=x-1;
            table.Attach(new Button(String.Format("{0}",x)),y,x,1,2);
        }
        /*
        table.Attach(new Button("Cls"), 0,1,0,1);
        table.Attach(new Button("Bck"), 1,2,0,1);
        table.Attach(new Label(), 2,3,0,1);
        table.Attach(new Button("Close"),3,4,0,1);

        table.Attach(new Button("7"), 0,1,1,2);
        table.Attach(new Button("8"), 1,2,1,2);
        table.Attach(new Button("9"), 2,3,1,2);
        table.Attach(new Button("/"), 3,4,1,2);

        table.Attach(new Button("4"), 0,1,2,3);
        table.Attach(new Button("5"), 1,2,2,3);
        table.Attach(new Button("6"), 2,3,2,3);
        table.Attach(new Button("*"), 3,4,2,3);

        table.Attach(new Button("1"), 0,1,3,4);
        table.Attach(new Button("2"), 1,2,3,4);
        table.Attach(new Button("3"), 2,3,3,4);
        table.Attach(new Button("-"), 3,4,3,4);

        table.Attach(new Button("0"), 0,1,4,5);
        table.Attach(new Button("."), 1,2,4,5);
        table.Attach(new Button("="), 2,3,4,5);
        table.Attach(new Button("+"), 3,4,4,5);
        */
        //		vbox.PackStart(new Entry(), false, false, 0);
        vbox.PackEnd(table, true, true,0);

        Add(vbox);
        ShowAll();
    }
Esempio n. 15
0
        public override bool GetPreferenceTabWidget(PreferencesDialog parent,
                                                    out string tabLabel,
                                                    out Gtk.Widget preferenceWidget)
        {
            Gtk.Label      label;
            Gtk.SpinButton menuNoteCountSpinner;
            Gtk.Alignment  align;
            int            menuNoteCount;

            // Addin's tab caption
            tabLabel = Catalog.GetString("Advanced");

            Gtk.VBox opts_list = new Gtk.VBox(false, 12);
            opts_list.BorderWidth = 12;
            opts_list.Show();

            align = new Gtk.Alignment(0.5f, 0.5f, 0.0f, 1.0f);
            align.Show();
            opts_list.PackStart(align, false, false, 0);

            Gtk.Table table = new Gtk.Table(1, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing    = 6;
            table.Show();
            align.Add(table);


            // Menu Note Count option
            label = new Gtk.Label(Catalog.GetString("Minimum number of notes to show in Recent list (maximum 18)"));

            label.UseMarkup = true;
            label.Justify   = Gtk.Justification.Left;
            label.SetAlignment(0.0f, 0.5f);
            label.Show();

            table.Attach(label, 0, 1, 0, 1);

            menuNoteCount = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT);
            // we have a hard limit of 18 set, thus not allowing anything bigger than 18
            menuNoteCountSpinner       = new Gtk.SpinButton(1, 18, 1);
            menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18;

            menuNoteCountSpinner.Show();
            table.Attach(menuNoteCountSpinner, 1, 2, 0, 1);

            menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference;

            if (opts_list != null)
            {
                preferenceWidget = opts_list;
                return(true);
            }
            else
            {
                preferenceWidget = null;
                return(false);
            }
        }
Esempio n. 16
0
		public CredentialsDialog (URIish uri, IEnumerable<CredentialItem> credentials)
		{
			this.Build ();
			this.credentials = credentials;
			
			labelTop.Text = string.Format (labelTop.Text, uri.ToString ());
			
			Gtk.Table table = new Gtk.Table (0, 0, false);
			table.ColumnSpacing = 6;
			vbox.PackStart (table, true, true, 0);
			
			uint r = 0;
			Widget firstEditor = null;
			foreach (CredentialItem c in credentials) {
				Label lab = new Label (c.GetPromptText () + ":");
				lab.Xalign = 0;
				table.Attach (lab, 0, 1, r, r + 1);
				Table.TableChild tc = (Table.TableChild) table [lab];
				tc.XOptions = AttachOptions.Shrink;
				
				Widget editor = null;
				
				if (c is CredentialItem.YesNoType) {
					CredentialItem.YesNoType cred = (CredentialItem.YesNoType) c;
					CheckButton btn = new CheckButton ();
					editor = btn;
					btn.Toggled += delegate {
						cred.SetValue (btn.Active);
					};
				}
				else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType) {
					CredentialItem cred = c;
					Entry e = new Entry ();
					editor = e;
					e.ActivatesDefault = true;
					if (cred.IsValueSecure ())
						e.Visibility = false;
					e.Changed += delegate {
						if (cred is CredentialItem.StringType)
							((CredentialItem.StringType)cred).SetValue (e.Text);
						else
							((CredentialItem.CharArrayType)cred).SetValue (e.Text.ToCharArray ());
					};
				}
				if (editor != null) {
					table.Attach (editor, 1, 2, r, r + 1);
					tc = (Table.TableChild) table [lab];
					tc.XOptions = AttachOptions.Fill;
					if (firstEditor == null)
						firstEditor = editor;
				}
				
				r++;
			}
			table.ShowAll ();
			Focus = firstEditor;
			Default = buttonOk;
		}
        public void AttachToTable(Table t, uint row, uint maxCols)
        {
            if(maxCols < 3)
                throw new ArgumentOutOfRangeException("maxCols", "The minimum number of columns required is 3.");

            t.Attach(Low, 0, 1, row, row + 1, AttachOptions.Shrink, AttachOptions.Fill | AttachOptions.Expand, 2, 6);
            t.Attach(Label, 1, maxCols - 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill | AttachOptions.Expand, 2, 6);
            t.Attach(High, maxCols - 1, maxCols, row, row + 1, AttachOptions.Shrink, AttachOptions.Fill | AttachOptions.Expand, 2, 6);
        }
Esempio n. 18
0
		public override bool GetPreferenceTabWidget (	PreferencesDialog parent,
								out string tabLabel,
								out Gtk.Widget preferenceWidget)
		{
			
			Gtk.Label label;
			Gtk.SpinButton menuNoteCountSpinner;
			Gtk.Alignment align;
			int menuNoteCount;

			// Addin's tab caption
			tabLabel = Catalog.GetString ("Advanced");
			
			Gtk.VBox opts_list = new Gtk.VBox (false, 12);
			opts_list.BorderWidth = 12;
			opts_list.Show ();
			
			align = new Gtk.Alignment (0.5f, 0.5f, 0.0f, 1.0f);
			align.Show ();
			opts_list.PackStart (align, false, false, 0);

			Gtk.Table table = new Gtk.Table (1, 2, false);
			table.ColumnSpacing = 6;
			table.RowSpacing = 6;
			table.Show ();
			align.Add (table);


			// Menu Note Count option
			label = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list (maximum 18)"));

			label.UseMarkup = true;
			label.Justify = Gtk.Justification.Left;
			label.SetAlignment (0.0f, 0.5f);
			label.Show ();
			
			table.Attach (label, 0, 1, 0, 1);
		
			menuNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT);
			// we have a hard limit of 18 set, thus not allowing anything bigger than 18
			menuNoteCountSpinner = new Gtk.SpinButton (1, 18, 1);
			menuNoteCountSpinner.Value = menuNoteCount <= 18 ? menuNoteCount : 18;
			
			menuNoteCountSpinner.Show ();
			table.Attach (menuNoteCountSpinner, 1, 2, 0, 1);
			
			menuNoteCountSpinner.ValueChanged += UpdateMenuNoteCountPreference;
			
			if (opts_list != null) {
				preferenceWidget = opts_list;
				return true;
			} else {
				preferenceWidget = null;
				return false;
			}
		}
Esempio n. 19
0
        public DirPropertyWidget(FilePropertisData fpd)
        {
            project = fpd.Project;
            fiOld = project.FilesProperty.Find(x => x.SystemFilePath == fpd.Filename);
            if (fiOld == null){
                fiOld =new FileItem(fpd.Filename,false);
                fiOld.IsDirectory = true;
                project.FilesProperty.Add(fiOld);
            }
            if (fiOld.ConditionValues == null)
                fiOld.ConditionValues = new System.Collections.Generic.List<ConditionRule>();

            Table mainTable = new Table(2,1,false);
            Table propertyTable = new Table(5,2,false);

            Label lblFN =GetLabel(System.IO.Path.GetFileName(fiOld.SystemFilePath)); // new Label(System.IO.Path.GetFileName(fiOld.SystemFilePath));

            Entry entr = new Entry(fiOld.SystemFilePath);
            entr.IsEditable = false;

            Entry entrFullPath = new Entry(MainClass.Workspace.GetFullPath(fiOld.SystemFilePath));
            entrFullPath.IsEditable = false;

            Label lblPrj = GetLabel(project.ProjectName); //new Label(project.ProjectName);

            AddControl(ref propertyTable,0,lblFN,"Name ");
            AddControl(ref propertyTable,1,entr,"Relative Path ");
            AddControl(ref propertyTable,2,entrFullPath,"Full Path ");
            AddControl(ref propertyTable,3,lblPrj,"Project ");

            int rowCount = project.ConditoinsDefine.Count;
            Table conditionsTable = new Table((uint)(rowCount + 3),(uint)2,false);

            GenerateContent(ref conditionsTable, MainClass.Settings.Platform.Name, 1, MainClass.Settings.Platform,false);//tableSystem
            GenerateContent(ref conditionsTable, MainClass.Settings.Resolution.Name, 2,MainClass.Settings.Resolution,true); //project.Resolution);//tableSystem
            int i = 3;
            foreach (Condition cd in project.ConditoinsDefine) {
                GenerateContent(ref conditionsTable, cd.Name, i, cd,false);
                i++;
            }
            Expander exp1 = new Expander("General");
            exp1.Expanded = true;
            exp1.Add(propertyTable);

            Expander exp2 = new Expander("Conditions");
            exp2.Expanded = true;
            exp2.Add(conditionsTable);

            mainTable.Attach(exp1,0,1,0,1,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);
            mainTable.Attach(exp2,0,1,1,2,AttachOptions.Expand|AttachOptions.Fill,AttachOptions.Fill,0,0);

            this.PackStart(mainTable,true,true,0);
            this.ShowAll();
        }
Esempio n. 20
0
        public Entry AddLabeledEntry(Table table, string title, uint top_attach, uint bottom_attach)
        {
            Label label = new Label(title);
            table.Attach(label, 0, 1, top_attach, bottom_attach);

            Entry entry = new Entry();
            entry.IsEditable = true;
            table.Attach(entry, 1, 2, top_attach, bottom_attach);

            return entry;
        }
Esempio n. 21
0
 public StyleSelectDialog()
 {
     this.Build();
     box = new ComboBox (StyleReader.GetStyleList ());
     Gtk.Table table = new Table (2, 2, false);
     this.VBox.Add (table);
     table.Attach (new Label ("Style: "), 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
     table.Attach (box, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Expand, 0, 0);
     table.Attach (new Gtk.HSeparator (), 0, 2, 1, 2, AttachOptions.Expand | AttachOptions.Fill, AttachOptions.Shrink, 0, 5);
     this.ShowAll ();
 }
Esempio n. 22
0
	public MainWindow (): base (Gtk.WindowType.Toplevel)
	{
		Build ();

		random = new Random ();

		Table table = new Table (9, 10, true);

		List<int> numeros = new List<int> ();
		List<Button> ButtonsType = new List<Button> ();

//		for (uint row = 0; row < 9; row++)
//			for (uint column = 0; column < 10; column++)
//			{
//				uint index = row * 10 + column;
//				Button button = new Button ();
//				button.Label = (index + 1).ToString();
//				button.Visible = true;
//				table.Attach (button, column, column + 1, row, row + 1);
//			}

		for (uint index = 0; index < 90; index++) {
			uint row = index /10;
			uint column = index % 10;
			int numero = (int)index + 1;
			Button button = new Button ();
			button.Label = numero.ToString();
			button.Visible = true;
			table.Attach (button, column, column +1, row, row +1);
			Buttons.Add (button);
			numeros.Add (numero);

		Button button = new Button ();
		button.Label = "1";
		button.Visible = true;
		table.Attach (button, 0, 1, 0, 1);
		button.ModifyBg (StateType.Normal, new Gdk.Color (0, 255, 0));

		table.Visible = true;
		vbox1.Add (table);

		button.Clicked += delegate
		{
			int indexAleatorio = random.Next (numeros.Count);
			int numero = numeros[indexAleatorio];
			numeros.RemoveAt(indexAleatorio);

				//labelNumero.Text = numero.ToString;
			Button button = buttons[numero - 1];
			button.BodyfyBg (StateType.Normal, GREEN_COLOR);
			Process.start ("espeak", "-v es " + numero);
			buttonNumero.Sensitive = numeros.Count > 0;
			};
        public MenuMinMaxNoteCountPreference()
        {
            table = new Gtk.Table(2, 2, false);
            table.ColumnSpacing = 6;
            table.RowSpacing    = 6;
            table.Show();

            // Menu Min Note Count option
            menuMinNoteCountLabel = new Gtk.Label(Catalog.GetString("Minimum number of notes to show in Recent list"));

            menuMinNoteCountLabel.UseMarkup = true;
            menuMinNoteCountLabel.Justify   = Gtk.Justification.Left;
            menuMinNoteCountLabel.SetAlignment(0.0f, 0.5f);
            menuMinNoteCountLabel.Show();
            table.Attach(menuMinNoteCountLabel, 0, 1, 0, 1);

            menuMinNoteCount = (int)Preferences.Get(Preferences.MENU_NOTE_COUNT);
            menuMaxNoteCount = (int)Preferences.Get(Preferences.MENU_MAX_NOTE_COUNT);
            // This is to avoid having Max bigger than absolute maximum if someone changed the setting
            // outside of the Tomboy using e.g. gconf
            menuMaxNoteCount = (menuMaxNoteCount <= int.MaxValue ? menuMaxNoteCount : int.MaxValue);
            // This is to avoid having Min bigger than Max if someone changed the setting
            // outside of the Tomboy using e.g. gconf
            menuMinNoteCount = (menuMinNoteCount <= menuMaxNoteCount ? menuMinNoteCount : menuMaxNoteCount);

            menuMinNoteCountSpinner       = new Gtk.SpinButton(1, menuMaxNoteCount, 1);
            menuMinNoteCountSpinner.Value = menuMinNoteCount;
            menuMinNoteCountSpinner.Show();
            table.Attach(menuMinNoteCountSpinner, 1, 2, 0, 1);
            menuMinNoteCountSpinner.ValueChanged += UpdateMenuMinNoteCountPreference;

            // Menu Max Note Count option
            menuMaxNoteCountLabel = new Gtk.Label(Catalog.GetString("Maximum number of notes to show in Recent list"));

            menuMaxNoteCountLabel.UseMarkup = true;
            menuMaxNoteCountLabel.Justify   = Gtk.Justification.Left;
            menuMaxNoteCountLabel.SetAlignment(0.0f, 0.5f);
            menuMaxNoteCountLabel.Show();
            table.Attach(menuMaxNoteCountLabel, 0, 1, 1, 2);

            menuMaxNoteCountSpinner       = new Gtk.SpinButton(menuMinNoteCount, int.MaxValue, 1);
            menuMaxNoteCountSpinner.Value = menuMaxNoteCount;
            menuMaxNoteCountSpinner.Show();
            table.Attach(menuMaxNoteCountSpinner, 1, 2, 1, 2);
            menuMaxNoteCountSpinner.ValueChanged += UpdateMenuMaxNoteCountPreference;

            align = new Gtk.Alignment(0.0f, 0.0f, 0.0f, 1.0f);
            align.Show();
            align.Add(table);
        }
Esempio n. 24
0
        public CodeCompilationPanel()
        {
            InitializeComponent();
            vbox = new VBox();
            var hboxTmp = new HBox();
            hboxTmp.PackStart (codeGenerationLabel, false, false, 0);
            vbox.PackStart (hboxTmp, false, false, 12);

            hboxTmp = new HBox();
            var tableOutputOptions = new Table (4, 2, false);
            tableOutputOptions.Attach (outputLabel, 0, 1, 0, 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            tableOutputOptions.Attach (outputAssembly, 1, 2, 0, 1, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 3);
            tableOutputOptions.Attach (labelOutputDir, 0, 1, 1, 2, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            tableOutputOptions.Attach (outputDirectory, 1, 2, 1, 2, AttachOptions.Fill | AttachOptions.Expand , AttachOptions.Fill, 0, 3);
            tableOutputOptions.Attach (labelCompileTarget, 0, 1, 2, 3, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            tableOutputOptions.Attach (compileTargetCombo, 1, 2, 2, 3, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 3);
            tableOutputOptions.Attach (labelCulture, 0, 1, 3, 4, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);
            tableOutputOptions.Attach (culture, 1, 2, 3, 4, AttachOptions.Fill | AttachOptions.Expand, AttachOptions.Fill, 0, 3);
            hboxTmp.PackStart (tableOutputOptions, true, true, 6);
            vbox.PackStart (hboxTmp, false, false, 0);

            hboxTmp = new HBox ();
            hboxTmp.PackStart (labelWarnings, false, false, 0);
            vbox.PackStart (hboxTmp, false, false, 12);
            hboxTmp = new HBox();
            hboxTmp.PackStart (checkDebug, false, false, 6);
            vbox.PackStart (hboxTmp, false, false, 0);
            hboxTmp = new HBox();
            hboxTmp.PackStart (checkDucky, false, false, 6);
            vbox.PackStart (hboxTmp, false, false, 0);

            vbox.ShowAll ();
        }
Esempio n. 25
0
        public static void RunIt()
        {
            Application.Init();

            // Create the Window
            window = new Gtk.Window("Memorize");
            window.DeleteEvent += delegate { Application.Quit(); };
            window.Resize(800, 600);

            // Status bar ...
            icon = new StatusIcon(new Pixbuf("res/icon.png"));
            icon.Visible = true;
            icon.Activate += delegate { window.Visible = !window.Visible; };
            icon.Tooltip = "Yo imma let you finish";

            // Table view
            Table table1 = new Table(2, 2, false);
            Label top = new Label();
            top.Text = "Buttons shortcuts, statuses, etc...";
            Label bottomLeft= new Label();
            bottomLeft.Text = "A \"cardboard\" of memos will be hung here.";
            Label bottomRight = new Label();
            bottomRight.Text = "Menu for creating memo \nlists, projects, memos...";

            // Here I could attach some informations, buttons
            // something that is general to all memos ?
            table1.Attach(top, 0, 2, 0, 1, Gtk.AttachOptions.Expand,
                    Gtk.AttachOptions.Fill, 10, 10);

            // Here I would create a specific widget that specializes
            // in displaying memos
            /*
            BoardDisplay mBoard = new BoardDisplay();
            mBoard.AddMemoDisplay(new MemoItemDisplay(new Memo("1", "one")));
            mBoard.AddMemoDisplay(new MemoItemDisplay(new Memo("2", "two")));
            mBoard.AddMemoDisplay(new MemoItemDisplay(new Memo("3", "three is an incredibly long text blah blah blah")));
            mBoard.AddMemoDisplay(new MemoItemDisplay(new Memo("4", "four")));
            mBoard.DrawBoard();
            table1.Attach(mBoard.Board, 0, 1, 1, 2, Gtk.AttachOptions.Expand,
                    Gtk.AttachOptions.Expand, 10, 10);
            */
            // Ideally here I would attach something that inherits a widget
            // and is a menu for creating new memos
            table1.Attach(bottomRight, 1, 2, 1, 2, Gtk.AttachOptions.Fill,
                    Gtk.AttachOptions.Fill, 1, 1);

            window.Add(table1);
            window.ShowAll();
            Application.Run();
        }
		public MenuMinMaxNoteCountPreference ()
		{
			table = new Gtk.Table (2, 2, false);
			table.ColumnSpacing = 6;
			table.RowSpacing = 6;
			table.Show ();

			// Menu Min Note Count option
			menuMinNoteCountLabel = new Gtk.Label (Catalog.GetString ("Minimum number of notes to show in Recent list"));

			menuMinNoteCountLabel.UseMarkup = true;
			menuMinNoteCountLabel.Justify = Gtk.Justification.Left;
			menuMinNoteCountLabel.SetAlignment (0.0f, 0.5f);
			menuMinNoteCountLabel.Show ();
			table.Attach (menuMinNoteCountLabel, 0, 1, 0, 1);

			menuMinNoteCount = (int) Preferences.Get (Preferences.MENU_NOTE_COUNT);
			menuMaxNoteCount = (int) Preferences.Get (Preferences.MENU_MAX_NOTE_COUNT);
			// This is to avoid having Max bigger than absolute maximum if someone changed the setting
			// outside of the Tomboy using e.g. gconf
			menuMaxNoteCount = (menuMaxNoteCount <= int.MaxValue ? menuMaxNoteCount : int.MaxValue);
			// This is to avoid having Min bigger than Max if someone changed the setting
			// outside of the Tomboy using e.g. gconf
			menuMinNoteCount = (menuMinNoteCount <= menuMaxNoteCount ? menuMinNoteCount : menuMaxNoteCount);

			menuMinNoteCountSpinner = new Gtk.SpinButton (1, menuMaxNoteCount, 1);
			menuMinNoteCountSpinner.Value = menuMinNoteCount;
			menuMinNoteCountSpinner.Show ();
			table.Attach (menuMinNoteCountSpinner, 1, 2, 0, 1);
			menuMinNoteCountSpinner.ValueChanged += UpdateMenuMinNoteCountPreference;

			// Menu Max Note Count option
			menuMaxNoteCountLabel = new Gtk.Label (Catalog.GetString ("Maximum number of notes to show in Recent list"));

			menuMaxNoteCountLabel.UseMarkup = true;
			menuMaxNoteCountLabel.Justify = Gtk.Justification.Left;
			menuMaxNoteCountLabel.SetAlignment (0.0f, 0.5f);
			menuMaxNoteCountLabel.Show ();
			table.Attach (menuMaxNoteCountLabel, 0, 1, 1, 2);

			menuMaxNoteCountSpinner = new Gtk.SpinButton (menuMinNoteCount, int.MaxValue, 1);
			menuMaxNoteCountSpinner.Value = menuMaxNoteCount;
			menuMaxNoteCountSpinner.Show ();
			table.Attach (menuMaxNoteCountSpinner, 1, 2, 1, 2);
			menuMaxNoteCountSpinner.ValueChanged += UpdateMenuMaxNoteCountPreference;

			align = new Gtk.Alignment (0.0f, 0.0f, 0.0f, 1.0f);
			align.Show ();
			align.Add (table);
		}
Esempio n. 27
0
		public void CreateGui() 
		{
			dialog = new Dialog ();
			dialog.Title = "Login";
			dialog.BorderWidth = 3;
			dialog.VBox.BorderWidth = 5;
			dialog.HasSeparator = false;

			Frame frame = new Frame ("Connection");
			string image = Stock.DialogInfo;
			
			HBox hbox = new HBox (false, 2);
			hbox.BorderWidth = 5;
			hbox.PackStart (new Gtk.Image (image, IconSize.Dialog), true, true, 0);
		
			Table table = new Table (2, 3, false);
			hbox.PackStart (table);
			table.ColumnSpacing = 4;
			table.RowSpacing = 4;
			Label label = null;

			label = Label.NewWithMnemonic ("_Provider");
			table.Attach (label, 0, 1, 0, 1);
			providerOptionMenu = CreateProviderOptionMenu();
			table.Attach (providerOptionMenu, 1, 2, 0, 1);
			
			label = Label.NewWithMnemonic ("_Connection String");
			table.Attach (label, 0, 1, 1, 2);
			connection_entry = new Entry ();
			table.Attach (connection_entry, 1, 2, 1, 2);

			frame.Add (hbox);

			dialog.VBox.PackStart (frame, true, true, 0);

			Button button = null;
			button = new Button(Stock.Ok);
			button.Clicked += new EventHandler (Connect_Action);
			button.CanDefault = true;
			dialog.ActionArea.PackStart (button, true, true, 0);
			button.GrabDefault ();

			button = new Button(Stock.Cancel);
			button.Clicked += new EventHandler (Dialog_Cancel);
			dialog.ActionArea.PackStart (button, true, true, 0);
			dialog.Modal = true;

			dialog.ShowAll ();
		}
		public FileSelectorDialog (string title, Gtk.FileChooserAction action): base (title, action)
		{
			LocalOnly = true;
			
			// Add the text encoding selector
			Table table = new Table (2, 2, false);
			table.RowSpacing = 6;
			table.ColumnSpacing = 6;
			
			encodingLabel = new Label (GettextCatalog.GetString ("_Character Coding:"));
			encodingLabel.Xalign = 0;
			table.Attach (encodingLabel, 0, 1, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			
			encodingMenu = new Gtk.OptionMenu ();
			FillEncodings ();
			encodingMenu.SetHistory (0);
			table.Attach (encodingMenu, 1, 2, 0, 1, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0);

			encodingMenu.Changed += EncodingChanged;
			
			// Add the viewer selector
			viewerLabel = new Label (GettextCatalog.GetString ("Open With:"));
			viewerLabel.Xalign = 0;
			table.Attach (viewerLabel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
			
			Gtk.HBox box = new HBox (false, 6);
			viewerSelector = Gtk.ComboBox.NewText ();
			box.PackStart (viewerSelector, true, true, 0);
			closeWorkspaceCheck = new CheckButton (GettextCatalog.GetString ("Close current workspace"));
			closeWorkspaceCheck.Active = true;
			box.PackStart (closeWorkspaceCheck, false, false, 0);
			table.Attach (box, 1, 2, 1, 2, AttachOptions.Expand|AttachOptions.Fill, AttachOptions.Expand|AttachOptions.Fill, 0, 0);
			FillViewers ();
			viewerSelector.Changed += OnViewerChanged;
			
			table.ShowAll ();
			this.ExtraWidget = table;
			
			// Give back the height that the extra widgets take
			int w, h;
			GetSize (out w, out h);
			Resize (w, h + table.SizeRequest ().Height);
			
			if (action == Gtk.FileChooserAction.SelectFolder)
				ShowEncodingSelector = false;
				
			if (action != Gtk.FileChooserAction.Open)
				closeWorkspaceCheck.Visible = ShowViewerSelector = false;
		}
Esempio n. 29
0
		public static ScrolledWindow CreateViewport()
		{
			ScrolledWindow scroller = new ScrolledWindow();
			Viewport viewer = new Viewport();
			
			Table widgets = new Table(1, 2, false);
			
			widgets.Attach(new Entry("This is example Entry 1"), 0, 1, 0, 1);
			widgets.Attach(new Entry("This is example Entry 2"), 1, 2, 0, 1);
			
			// Place the widgets in a Viewport, and the Viewport in a ScrolledWindow
			viewer.Add(widgets);
			scroller.Add(viewer);
			return scroller;
		}
Esempio n. 30
0
		public DemoDialog () : base ("Dialogs")
		{
			BorderWidth = 8;

			Frame frame = new Frame ("Dialogs");
			Add (frame);

			VBox vbox = new VBox (false, 8);
			vbox.BorderWidth = 8;
			frame.Add (vbox);

			// Standard message dialog
			HBox hbox = new HBox (false,8);
			vbox.PackStart (hbox, false, false, 0);
			Button button = new Button ("_Message Dialog");
			button.Clicked += new EventHandler (MessageDialogClicked);
			hbox.PackStart (button, false, false, 0);
			vbox.PackStart (new HSeparator(), false, false, 0);

			// Interactive dialog
			hbox = new HBox (false, 8);
			vbox.PackStart (hbox, false, false, 0);
			VBox vbox2 = new VBox (false, 0);

			button = new Button ("_Interactive Dialog");
			button.Clicked += new EventHandler (InteractiveDialogClicked);
			hbox.PackStart (vbox2, false, false, 0);
			vbox2.PackStart (button, false, false, 0);

			Table table = new Table (2, 2, false);
			table.RowSpacing = 4;
			table.ColumnSpacing = 4;
			hbox.PackStart (table, false, false, 0);

			Label label = new Label ("_Entry1");
			table.Attach (label, 0, 1, 0, 1);
			entry1 = new Entry ();
			table.Attach (entry1, 1, 2, 0, 1);
			label.MnemonicWidget = entry1;

			label = new Label ("E_ntry2");
			table.Attach (label,0,1,1,2);
			entry2 = new Entry ();
			table.Attach (entry2, 1, 2, 1, 2);
			label.MnemonicWidget = entry2;

			ShowAll ();
		}
Esempio n. 31
0
        public ErrorListDialog()
            : base(Catalog.GetString ("Error"))
        {
            var table = new Table (3, 2, false) {
                RowSpacing = 12,
                ColumnSpacing = 16
            };

            table.Attach (icon_image = new Image () {
                    IconName = "dialog-error",
                    IconSize = (int)IconSize.Dialog,
                    Yalign = 0.0f
                }, 0, 1, 0, 3, AttachOptions.Shrink, AttachOptions.Fill | AttachOptions.Expand, 0, 0);

            table.Attach (header_label = new Label () { Xalign = 0.0f }, 1, 2, 0, 1,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            table.Attach (message_label = new Hyena.Widgets.WrapLabel (), 1, 2, 1, 2,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Shrink, 0, 0);

            var scrolled_window = new ScrolledWindow () {
                HscrollbarPolicy = PolicyType.Automatic,
                VscrollbarPolicy = PolicyType.Automatic,
                ShadowType = ShadowType.In
            };

            list_view = new TreeView () {
                HeightRequest = 120,
                WidthRequest = 200
            };
            scrolled_window.Add (list_view);

            table.Attach (details_expander = new Expander (Catalog.GetString ("Details")),
                1, 2, 2, 3,
                AttachOptions.Fill | AttachOptions.Expand,
                AttachOptions.Fill | AttachOptions.Expand,
                0, 0);
            details_expander.Add (scrolled_window);

            VBox.PackStart (table, true, true, 0);
            VBox.Spacing = 12;
            VBox.ShowAll ();

            details_expander.Activated += OnConfigureGeometry;
            Realized += OnConfigureGeometry;
        }
Esempio n. 32
0
        private void BuildControl(string textEntry, string textLabel, bool onlyInt,Gtk.Window parent)
        {
            this.onlyInt =onlyInt;

            this.TransientFor = parent;

            HBox hbox = new HBox(false, 8);
            hbox.BorderWidth = 8;
            this.VBox.PackStart(hbox, false, false, 0);

            Image stock = new Image(Stock.DialogQuestion, IconSize.Dialog);
            hbox.PackStart(stock, false, false, 0);

            Table table = new Table(2, 2, false);
            table.RowSpacing = 4;
            table.ColumnSpacing = 4;
            hbox.PackStart(table, true, true, 0);

            Label label = new Label(textLabel);
            table.Attach(label, 0, 1, 0, 1);

            if (!onlyInt){
                localEntry1 = new Entry();
                localEntry1.Text = textEntry;//textEntry;
                //localEntry1.Changed += delegate(object sender, EventArgs e) { textEntry = localEntry1.Text; };
                table.Attach(localEntry1, 1, 2, 0, 1);
                label.MnemonicWidget = localEntry1;

                localEntry1.KeyPressEvent+= new KeyPressEventHandler(OnKeyPress);

                localEntry1.GrabFocus();
            } else {
                localSpin = new SpinButton(1,10000,10);
                localSpin.Digits = 0;
                localSpin.Numeric = true;

                localSpin.KeyPressEvent+= new KeyPressEventHandler(OnKeyPress);

                table.Attach(localSpin, 1, 2, 0, 1);
                label.MnemonicWidget = localSpin;
                localSpin.GrabFocus();
            }

            this.AddButton(MainClass.Languages.Translate("cancel"), ResponseType.Cancel);
            this.AddButton(MainClass.Languages.Translate("ok"), ResponseType.Ok);

            this.ShowAll();
        }
		Widget CreateEntry (Table table, string text, bool password)
		{
			var lab = new Label (text);
			lab.Xalign = 0;
			table.Attach (lab, 0, 1, r, r + 1);
			var tc = (Table.TableChild)table [lab];
			tc.XOptions = AttachOptions.Shrink;

			var e = new Entry ();
			Widget editor = e;
			e.ActivatesDefault = true;
			if (password)
				e.Visibility = false;

			e.Changed += delegate {
				if (password) {
					if (upcred != null)
						upcred.Password = e.Text ?? "";
					else
						sshcred.Passphrase = e.Text ?? "";
				} else {
					if (upcred != null)
						upcred.Username = e.Text;
				}
			};

			if (editor != null) {
				table.Attach (editor, 1, 2, r, r + 1);
				tc = (Table.TableChild)table [lab];
				tc.XOptions = AttachOptions.Fill;
			}
			r++;
			return editor;
		}
Esempio n. 34
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();
        //vbox1.Add(button); //Con esta linea añadimos un boton en toda la pantalla
        random = new Random ();

        Table table = new Table(9,10,true);

        //Forma de sacar las filas y las columnas
        for (uint row=0; row<9; row++) {
            for (uint col=0; col<10; col++) {
                uint index = row * 10 + col;
                int numero = (int)index + 1;
                Button button = new Button ();
                button.Label = numero.ToString();
                button.Visible = true;
                table.Attach (button, col, col+1, row, row+1);
                buttons.Add (button);
                numeros.Add (numero);
            }
        }

        table.Visible = true;
        vbox1.Add (table);

        buttonNumero.Clicked += delegate {
            int numero = getNumero();
            show(numero);
            buttonNumero.Sensitive = numeros.Count>0; // No cerrarse cuando se pongan todos los numeros.
            espeak(numero);
        };
    }
Esempio n. 35
0
    public MainWindow()
        : base(Gtk.WindowType.Toplevel)
    {
        Build ();

        Random random = new Random ();

        List<Button> buttons = new List<Button> ();

        Table table = new Table (9, 10, true);

        //Opcion 1
        for (uint index = 0; index<90; index++) {

            Button button = new Button ();
            button.Label = (index+1).ToString();
            button.Visible = true;
            uint fila = index / 10;
            uint colum = index % 10;

            table.Attach (button, colum, colum+1, fila, fila+1);
            buttons.Add (button);
        }

        table.Visible = true;
        vbox5.Add (table);

        buttonNumero.Clicked += delegate {
            int indexAleatorio = random.Next(90)+1;
            Button button = buttons[indexAleatorio];
            button.ModifyBg(StateType.Normal, new Gdk.Color(0,255,0));
            indexAleatorio++;
            Process.Start("espeak", "-v es "+indexAleatorio);
        };
    }
Esempio n. 36
0
        /// <summary>Crea el notebook donde están los campos
        /// de edición de texto del ensamblador.</summary>
        /// <returns>El notebook.</returns>

        private Notebook CrearNotebook()
        {
            Notebook not = new Notebook();


            Gtk.HPaned panel1 = new Gtk.HPaned();
            panel1.Add1(CrearEditorEnsamblador());
            panel1.Add2(CrearResultadoEnsamblador());
            panel1.Position = 340;

            Gtk.VPaned panel2 = new Gtk.VPaned();
            panel2.Add1(panel1);
            panel2.Add2(CrearErroresEnsamblador());
            panel2.Position = 350;

            not.AppendPage(
                panel2,
                new Gtk.Label(GetText("Ventana_Notebook_Codigo"))
                );

            panelMemoria   = new PanelMemoria();
            panelRegistros = new PanelRegistros();

            Gtk.Table memreg = new Gtk.Table(1, 2, true);
            memreg.Attach(panelMemoria, 0, 1, 0, 1);
            memreg.Attach(panelRegistros, 1, 2, 0, 1);
            not.AppendPage(
                memreg,
                new Gtk.Label(
                    String.Format(
                        "{0} - {1}",
                        GetText("Ventana_Notebook_Memoria"),
                        GetText("Ventana_Notebook_Registros")
                        )
                    )
                );


            dArea = new PanelDibujo();
            not.AppendPage(
                dArea,
                new Gtk.Label(GetText("Ventana_Notebook_rdd"))
                );

            return(not);
        }
Esempio n. 37
0
        public void Append(string tip)
        {
            uint row = table.NRows;

            Gtk.Image image = new Gtk.Image(arrow);
            image.Show();
            table.Attach(image, 0, 1, row, row + 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 0);

            Gtk.Label label = new Gtk.Label();
            label.Markup   = tip;
            label.LineWrap = true;
            label.Justify  = Justification.Fill;
            label.SetAlignment(0.0f, 0.5f);
            label.ModifyFg(Gtk.StateType.Normal, label.Style.Foreground(Gtk.StateType.Insensitive));
            label.Show();
            table.Attach(label, 1, 2, row, row + 1, Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill, 0, 0, 0);
        }
Esempio n. 38
0
        public Base()
        {
            table               = new Gtk.Table(1, 2, false);
            table.RowSpacing    = 12;
            table.ColumnSpacing = 12;

            header_icon = new Gtk.Image();
            table.Attach(header_icon, 0, 1, 0, 1, Gtk.AttachOptions.Fill, Gtk.AttachOptions.Fill, 0, 5);

            header_label = new Gtk.Label();
            header_label.SetAlignment(0.0f, 0.5f);
            table.Attach(header_label, 1, 2, 0, 1, Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, 0, 0, 5);

            table.ShowAll();

            Add(table);
        }
Esempio n. 39
0
        /// <summary>
        /// Replaces Windows Form Designer code
        /// </summary>
        private void InitializeComponent()
        {
            SetSizeRequest(192, 240);           // Define MenuForm size
            //
            // Define an 8x6 table on which to lay out the test buttons, etc
            //
            Gtk.Table layout = new Gtk.Table(8, 6, true);
            layout.BorderWidth   = 8;
            layout.ColumnSpacing = 2;
            layout.RowSpacing    = 2;
            Add(layout);

            // Create menu components, then add to layout
            //
            // DemosLabel
            //
            demosLabel = new Gtk.Label("Demos");
            layout.Attach(demosLabel, 0, 2, 0, 1);
            //
            // plotSurface2DDemoButton
            //
            plotSurface2DDemoButton          = new Gtk.Button("PlotSurface2D Demo");
            plotSurface2DDemoButton.Clicked += new System.EventHandler(this.plotSurface2DDemoButton_Click);
            layout.Attach(plotSurface2DDemoButton, 0, 6, 1, 2);
            //
            // multiPlotDemoButton
            //
            multiPlotDemoButton          = new Gtk.Button("Multi Plot Demo");
            multiPlotDemoButton.Clicked += new System.EventHandler(this.runDemoButton_Click);
            layout.Attach(multiPlotDemoButton, 0, 6, 2, 3);
            //
            // testsLabel
            //
            testsLabel = new Gtk.Label("Tests");
            layout.Attach(testsLabel, 0, 2, 3, 4);
            //
            // TestSelectComboBox
            //
            //
            TestSelectComboBox = ComboBox.NewText();
            TestSelectComboBox.AppendText("Axis Test");
            TestSelectComboBox.AppendText("PlotSurface2D");
            layout.Attach(TestSelectComboBox, 0, 6, 4, 5);
            //
            // RunTestButton
            //
            RunTestButton          = new Gtk.Button("Run Selected Test");
            RunTestButton.Clicked += new System.EventHandler(this.RunTestButton_Click);
            layout.Attach(RunTestButton, 0, 6, 5, 6);
            //
            // quitButton
            //
            quitButton          = new Gtk.Button("Quit");
            quitButton.Clicked += new System.EventHandler(this.quitButton_Click);
            layout.Attach(quitButton, 2, 4, 7, 8, 0, 0, 0, 0);
            //
            // Gtk.Window events
            //
            this.Destroyed += new EventHandler(MenuForm_Destroyed);
        }
Esempio n. 40
0
        /// <summary>Crea una instancia de la clase.</summary>

        public PanelRegistros() : base(false, 0)
        {
            Gtk.Table tabla = new Gtk.Table(16, 5, true);
            VBox      vb    = new VBox(false, 0);

            for (int i = 0; i < 16; i++)
            {
                direcciones[i] =
                    new Gtk.Label(BancoRegistros.GetNombreRegistro(i));
                contenido[i] =
                    new Gtk.Label(Conversiones.ToHexString((short)0));
                tabla.Attach(direcciones[i], 1, 2, (uint)i, (uint)i + 1);
                tabla.Attach(contenido[i], 3, 4, (uint)i, (uint)i + 1);
            }
            vb.PackStart(new Gtk.Label
                             (Ventana.GetText("PReg_Contenido")));
            vb.PackStart(tabla);
            vb.PackStart(new Gtk.Label(""));
            this.PackStart(vb);
        }
Esempio n. 41
0
        // ============================================
        // PUBLIC Constructors
        // ============================================
        public TopBar() : base(false, 2)
        {
            // Initialize Search Logo
            this.imageLogo        = StockIcons.GetImage("Search");
            this.imageLogo.Xalign = 0.1f;
            this.imageLogo.Yalign = 0.1f;
            this.imageLogo.Xpad   = 2;
            this.PackStart(this.imageLogo, false, false, 2);

            // Initialize Top VBox
            this.table = new Gtk.Table(3, 2, false);
            this.table.ColumnSpacing = 6;
            this.table.RowSpacing    = 2;
            this.PackStart(this.table, true, true, 2);

            Gtk.Label label;

            // Initialize Search Label
            label           = new Gtk.Label("<b>Search:</b>");
            label.UseMarkup = true;
            label.Xalign    = 1.0f;
            this.table.Attach(label, 0, 1, 0, 1);

            // Initialize Entry Search
            this.entrySearch = new Gtk.Entry();
            this.table.Attach(this.entrySearch, 1, 2, 0, 1);

            // Initialize Search By
            label           = new Gtk.Label("<b>By:</b>");
            label.UseMarkup = true;
            label.Xalign    = 1.0f;
            this.table.Attach(label, 0, 1, 1, 2);

            // Initialize Combo Search Type
            this.comboSearchType = ComboBox.NewText();
            AddSearchType();
            this.comboSearchType.Active = 0;
            this.table.Attach(this.comboSearchType, 1, 2, 1, 2);

            // Initialize Search By
            label           = new Gtk.Label("<b>User:</b>");
            label.UseMarkup = true;
            label.Xalign    = 1.0f;
            table.Attach(label, 0, 1, 2, 3);

            // Initialize Combo Search Type
            this.comboSearchUser = ComboBox.NewText();
            AddSearchUsers();
            this.comboSearchUser.Active = 0;
            this.table.Attach(this.comboSearchUser, 1, 2, 2, 3);

            this.ShowAll();
        }
Esempio n. 42
0
        // TODO: Centralize duplicated code
        private void AddRow(Gtk.Table table, Gtk.Widget widget, string labelText, uint row)
        {
            Gtk.Label l = new Gtk.Label(labelText);
            l.UseUnderline = true;
            l.Xalign       = 0.0f;
            l.Show();
            table.Attach(l, 0, 1, row, row + 1,
                         Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            widget.Show();
            table.Attach(widget, 1, 2, row, row + 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         0, 0);

            l.MnemonicWidget = widget;

            // TODO: Tooltips
        }
Esempio n. 43
0
        /// <summary>
        /// Creates and shows samplePlot [index]
        /// </summary>
        private void ShowSample(int index)
        {
            layout.Remove(plotCanvas);                          // remove previous sample

            currentType   = sampleTypes [index];
            currentSample = (PlotSample)Activator.CreateInstance(currentType);
            plotCanvas    = currentSample.Canvas;

            infoBox.Buffer.Text = currentSample.InfoText;               // update info Text
            layout.Attach(plotCanvas, 0, 8, 0, 8);                      // attach new sample
            ShowAll();
        }
Esempio n. 44
0
        /// <summary>
        /// server gui stuff:
        /// server path
        /// server username + password
        /// check server ssl certificate yes/no
        /// </summary>
        /// <param name="insertTo"></param>
        /// <param name="defaultSpacing"></param>
        void SetupGuiServerRelated(Gtk.Box insertTo, int defaultSpacing)
        {
            Gtk.Table customBox = new Gtk.Table(3, 2, false);

            // somehow you can't change the default spacing or set it for all rows
            for (int i = 0; i < 3; i++)
            {
                customBox.SetRowSpacing((uint)i, (uint)defaultSpacing);
            }

            // insert the labels
            customBox.Attach(new Gtk.Label(Catalog.GetString("Server path:")), 0, 1, 0, 1);
            customBox.Attach(new Gtk.Label(Catalog.GetString("Username:"******"Password:"******"SaveConfiguration" is called
            //IPropertyEditor serverEditor = Services.Factory.CreatePropertyEditorEntry(
            //	AddinPreferences.SYNC_PRIVATENOTES_SERVERPATH, server_path);
            //serverEditor.Setup();

            server_user = new Gtk.Entry();
            customBox.Attach(server_user, 1, 2, 1, 2);
            string serverUser = Preferences.Get(AddinPreferences.SYNC_PRIVATENOTES_SERVERUSER) as String;

            server_user.Text = serverUser;
            // NO EDITOR! because we only save when "SaveConfiguration" is called
            //IPropertyEditor userEditor = Services.Factory.CreatePropertyEditorEntry(
            // AddinPreferences.SYNC_PRIVATENOTES_SERVERUSER, server_user);
            //userEditor.Setup();

            server_pass = new Gtk.Entry();
            server_pass.InvisibleChar = '*';
            server_pass.Visibility    = false;
            customBox.Attach(server_pass, 1, 2, 2, 3);
            string serverpass = Preferences.Get(AddinPreferences.SYNC_PRIVATENOTES_SERVERPASS) as String;

            server_pass.Text = serverpass;
            // NO EDITOR! because we only save when "SaveConfiguration" is called
            //IPropertyEditor passEditor = Services.Factory.CreatePropertyEditorEntry(
            // AddinPreferences.SYNC_PRIVATENOTES_SERVERPASS, server_pass);
            //passEditor.Setup();

            check_ssl = new Gtk.CheckButton(Catalog.GetString("Check servers SSL certificate"));
            insertTo.PackStart(check_ssl);

            // set up check-ssl certificate stuff
            object value = Preferences.Get(AddinPreferences.SYNC_PRIVATENOTES_SERVERCHECKSSLCERT);

            if (value == null || value.Equals(true))
            {
                check_ssl.Active = true;
            }
        }
        Gtk.Widget CreateAssembliesTable()
        {
            var box = new Gtk.VBox();

            box.PackStart(new Gtk.Label()
            {
                Markup = string.Format("<b>{0}</b>", GettextCatalog.GetString("Loaded Assemblies")),
                Xalign = 0
            });
            var table = new Gtk.Table(0, 0, false);

            table.ColumnSpacing = 3;
            uint line = 0;

            foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies().Where(a => !a.IsDynamic).OrderBy(a => a.FullName))
            {
                try {
                    var assemblyName = assembly.GetName();
                    table.Attach(new Gtk.Label(assemblyName.Name)
                    {
                        Xalign = 0
                    }, 0, 1, line, line + 1);
                    table.Attach(new Gtk.Label(assemblyName.Version.ToString())
                    {
                        Xalign = 0
                    }, 1, 2, line, line + 1);
                    table.Attach(new Gtk.Label(System.IO.Path.GetFullPath(assembly.Location))
                    {
                        Xalign = 0
                    }, 2, 3, line, line + 1);
                } catch {
                }
                line++;
            }
            box.PackStart(table, false, false, 0);
            box.ShowAll();
            return(box);
        }
Esempio n. 46
0
        private void InitializeComponent()
        {
            //
            // costWidget
            //
            this.costWidget = new PlotWidget();
            //
            // volumeWidget
            //
            this.volumeWidget = new PlotWidget();
            //
            // closeButton
            //
            this.closeButton          = new Gtk.Button("Close");
            this.closeButton.Clicked += new System.EventHandler(this.closeButton_Click);

            //
            // FinancialDemo
            //
            this.SetSizeRequest(630, 450);
            //
            // Define a 10x10 table on which to lay out the plots and button
            //
            Gtk.Table layout = new Gtk.Table(10, 10, true);
            layout.BorderWidth = 4;
            Add(layout);

            AttachOptions opt = AttachOptions.Expand | AttachOptions.Fill;
            uint          xpad = 2, ypad = 10;

            layout.Attach(costWidget, 0, 10, 0, 6);
            layout.Attach(volumeWidget, 0, 10, 6, 9);
            layout.Attach(closeButton, 1, 2, 9, 10, opt, opt, xpad, ypad);
            this.Name = "PlotSurface2DDemo";

            this.Name = "FinancialDemo";
        }
Esempio n. 47
0
        protected override void BuildUI()
        {
            base.BuildUI();

            string title = Strings.Sharpen;

            dialog = new Gtk.Dialog(title, (Gtk.Window) this, DialogFlags.DestroyWithParent, new object[0])
            {
                BorderWidth = 12
            };
            dialog.VBox.Spacing = 6;

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

            table.Attach(SetFancyStyle(new Gtk.Label(Strings.AmountColon)), 0, 1, 0, 1);
            table.Attach(SetFancyStyle(new Gtk.Label(Strings.RadiusColon)), 0, 1, 1, 2);
            table.Attach(SetFancyStyle(new Gtk.Label(Strings.ThresholdColon)), 0, 1, 2, 3);

            SetFancyStyle(amount_spin    = new Gtk.SpinButton(0.00, 100.0, .01));
            SetFancyStyle(radius_spin    = new Gtk.SpinButton(1.0, 50.0, .01));
            SetFancyStyle(threshold_spin = new Gtk.SpinButton(0.0, 50.0, .01));
            amount_spin.Value            = .5;
            radius_spin.Value            = 5;
            threshold_spin.Value         = 0.0;

            amount_spin.ValueChanged    += HandleSettingsChanged;
            radius_spin.ValueChanged    += HandleSettingsChanged;
            threshold_spin.ValueChanged += HandleSettingsChanged;

            table.Attach(amount_spin, 1, 2, 0, 1);
            table.Attach(radius_spin, 1, 2, 1, 2);
            table.Attach(threshold_spin, 1, 2, 2, 3);

            var cancel_button = new Gtk.Button(Gtk.Stock.Cancel);

            cancel_button.Clicked += HandleCancelClicked;
            dialog.AddActionWidget(cancel_button, Gtk.ResponseType.Cancel);

            var ok_button = new Gtk.Button(Gtk.Stock.Ok);

            ok_button.Clicked += HandleOkClicked;
            dialog.AddActionWidget(ok_button, Gtk.ResponseType.Cancel);

            dialog.DeleteEvent += HandleCancelClicked;

            Destroyed += HandleLoupeDestroyed;

            table.ShowAll();
            dialog.VBox.PackStart(table);
            dialog.ShowAll();
        }
    public MainWindow() : base(Gtk.WindowType.Toplevel)
    {
        SetDefaultSize(200, -1);

        var table     = new Gtk.Table(5, 5, true);
        var separator = new Gtk.HSeparator();

        var label0 = new Gtk.Label("Select file to copy/move");

        _fileCopy  = new Gtk.FileChooserButton("Select A File", Gtk.FileChooserAction.Open);
        _radioCopy = new Gtk.RadioButton("Copy");
        _radioMove = new Gtk.RadioButton(_radioCopy, "Move");
        var copyButton = new Gtk.Button("Copy");

        Add(table);

        table.Attach(label0, 0, 4, 0, 1);
        table.Attach(_fileCopy, 0, 1, 1, 2);
        table.Attach(_radioCopy, 1, 2, 1, 2);
        table.Attach(_radioMove, 2, 3, 1, 2);
        table.Attach(copyButton, 3, 4, 1, 2);
        table.Attach(separator, 0, 4, 2, 3);

        var label1 = new Gtk.Label("Select destination for file(s)");

        _folder = new Gtk.FileChooserButton("Select A File", Gtk.FileChooserAction.SelectFolder);
        var pasteButton = new Gtk.Button("Paste");

        table.Attach(label1, 0, 4, 3, 4);
        table.Attach(_folder, 0, 1, 4, 5);
        table.Attach(pasteButton, 3, 4, 4, 5);

        DeleteEvent         += OnDeleteEvent;
        copyButton.Clicked  += OnCopyButtonClick;
        pasteButton.Clicked += OnPasteButtonClick;

        ShowAll();
    }
Esempio n. 49
0
    public static Gtk.Table PopulateTable(ArrayList items)
    {
        Gtk.Table table = new Gtk.Table(0, 0, false);
        uint      x     = 0;
        uint      y     = 0;

        foreach (object item in items)
        {
            if (x > 4)
            {
                x = 0;
                y++;
            }
            table.Attach(((Gtk.Widget)item), x, x + 1, y, y + 1, AttachOptions.Fill, AttachOptions.Fill, 5, 5);
            x++;
        }

        return(table);
    }
Esempio n. 50
0
    private void createTable()
    {
        LogB.Debug("Persons count" + persons.Count.ToString());
        uint padding = 4;
        uint cols    = 4;      //each row has 4 columns
        uint rows    = Convert.ToUInt32(Math.Floor(persons.Count / (1.0 * cols)) + 1);
        int  count   = 0;

        label_selected_person_name.Text = "";
        SelectedPerson = null;
        personButtonsSensitive(false);
        vbox_button_delete_confirm.Visible = false;

        for (int row_i = 0; row_i < rows; row_i++)
        {
            for (int col_i = 0; col_i < cols; col_i++)
            {
                if (count >= persons.Count)
                {
                    return;
                }

                Person p = (Person)persons[count++];

                PersonPhotoButton ppb = new PersonPhotoButton(p);
                Gtk.Button        b   = ppb.CreateButton();
                b.Show();

                b.Clicked += new EventHandler(on_button_portrait_clicked);
                b.CanFocus = true;

                table1.Attach(b, (uint)col_i, (uint)col_i + 1, (uint)row_i, (uint)row_i + 1,
                              Gtk.AttachOptions.Fill,
                              Gtk.AttachOptions.Fill,
                              padding, padding);
            }
        }

        table1.ShowAll();
    }
Esempio n. 51
0
        void InitializeComponent()
        {
            Gtk.Table table = new Gtk.Table(4, 2, false);
            // num retry delay
            numRetryDelay        = new Gtk.SpinButton(0, 10000, 1);
            numRetryDelay.Digits = 0;             //int only
            table.Attach(new Gtk.Label("Delay between retries: "), 0, 1, 0, 1);
            table.Attach(numRetryDelay, 1, 2, 0, 1);

            numMaxRetries        = new Gtk.SpinButton(0, 10, 1);
            numMaxRetries.Digits = 0;             //int only
            table.Attach(new Gtk.Label("Maximum number of retries: "), 0, 1, 1, 2);
            table.Attach(numMaxRetries, 1, 2, 1, 2);

            numMaxSegments = new SpinButton(0, 32, 1);
            table.Attach(new Gtk.Label("Maximum number of segments: "), 0, 1, 2, 3);
            table.Attach(numMaxSegments, 1, 2, 2, 3);

            numMinSegSize = new Gtk.SpinButton(100, double.MaxValue, 1);
            table.Attach(new Gtk.Label("Minimum size of a segment (bytes): "), 0, 1, 3, 4);
            table.Attach(numMinSegSize, 1, 2, 3, 4);

            PackStart(table, false, false, 0);
        }
Esempio n. 52
0
        private void GenerateContent(ref Gtk.Table tableSystem, string label, int xPos, Condition cd, bool isResolution)
        {
            ListStore lstorePlatform = new ListStore(typeof(int), typeof(int), typeof(string));

            int selectRule = 0;

            if (conditionRules_Old.Count > 0)
            {
                ConditionRule cr = conditionRules_Old.Find(x => x.ConditionId == cd.Id);
                if (cr != null)
                {
                    selectRule = cr.RuleId;
                }
            }

            Label lblPlatform = new Label(label);

            lblPlatform.Name   = "lbl_" + label;
            lblPlatform.Xalign = 1F;
            lblPlatform.Yalign = 0.5F;

            ComboBox cboxPlatform = new ComboBox();

            cboxPlatform.Name = "cd_" + label;

            CellRendererText textRenderer = new CellRendererText();

            cboxPlatform.PackStart(textRenderer, true);
            cboxPlatform.AddAttribute(textRenderer, "text", 2);

            cboxPlatform.WidthRequest = 200;
            cboxPlatform.Model        = lstorePlatform;

            tableSystem.Attach(lblPlatform, 0, 1, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);
            tableSystem.Attach(cboxPlatform, 1, 2, (uint)(xPos - 1), (uint)xPos, AttachOptions.Shrink, AttachOptions.Shrink, 2, 2);

            TreeIter selectIter = lstorePlatform.AppendValues(0, cd.Id, "Unset");

            foreach (Rule rl in cd.Rules)
            {
                if (!isResolution)
                {
                    if (rl.Id == selectRule)
                    {
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                    }
                    else
                    {
                        lstorePlatform.AppendValues(rl.Id, cd.Id, rl.Name);
                    }
                }
                else
                {
                    string name = String.Format("{0} ({1}x{2})", rl.Name, rl.Width, rl.Height);
                    if (rl.Id == selectRule)
                    {
                        selectIter = lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                    }
                    else
                    {
                        lstorePlatform.AppendValues(rl.Id, cd.Id, name);
                    }
                }
            }
            cboxPlatform.SetActiveIter(selectIter);

            cboxPlatform.Changed += delegate(object sender, EventArgs e) {
                if (sender == null)
                {
                    return;
                }

                ComboBox combo = sender as ComboBox;

                TreeIter iter;
                if (combo.GetActiveIter(out iter))
                {
                    int ruleId = (int)combo.Model.GetValue(iter, 0);
                    int condId = (int)combo.Model.GetValue(iter, 1);
                    if (ruleId != 0)
                    {
                        ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);                                //cd.Id);
                        if (cr != null)
                        {
                            cr.RuleId = ruleId;
                        }
                        else
                        {
                            conditionRules.Add(new ConditionRule(condId, ruleId));
                        }
                    }
                    else
                    {
                        ConditionRule cr = conditionRules.Find(x => x.ConditionId == condId);
                        if (cr != null)
                        {
                            conditionRules.Remove(cr);
                        }
                    }
                    isChanged = true;
                }
            };
        }
Esempio n. 53
0
    private void CreatePropertyWidgets(string title, object NewObject)
    {
        //NOTE: we need to remove all the old widgets before we empty the widget and field tables, because the
        //      focus out event handlers which may be called during this step need them.
        Foreach(Remove);

        Gtk.VBox box = new Gtk.VBox();

        titleLabel        = new Gtk.Label();
        titleLabel.Xalign = 0;
        titleLabel.Xpad   = 12;
        titleLabel.Ypad   = 6;
        titleLabel.Markup = "<b>" + title + "</b>";
        box.PackStart(titleLabel, true, false, 0);

        Type type = NewObject.GetType();

        // Dispose all former custom editor widgets
        foreach (IDisposable disposable in customWidgets)
        {
            disposable.Dispose();
        }

        // Unregister our event handler from self-managed fields
        foreach (FieldOrProperty field in fieldTable)
        {
            field.Changed -= OnFieldChanged;
        }

        widgetTable.Clear();
        fieldTable.Clear();
        editWidgets.Clear();
        customWidgets.Clear();

        // iterate over all fields and properties
        foreach (FieldOrProperty field in FieldOrProperty.GetFieldsAndProperties(type))
        {
            CustomSettingsWidgetAttribute customSettings = (CustomSettingsWidgetAttribute)
                                                           field.GetCustomAttribute(typeof(CustomSettingsWidgetAttribute));
            if (customSettings != null)
            {
                Type customType = customSettings.Type;
                ICustomSettingsWidget customWidget = (ICustomSettingsWidget)CreateObject(customType);
                customWidgets.Add(customWidget);
                editWidgets.Add(customWidget.Create(this, NewObject, field));
                continue;
            }

            LispChildAttribute ChildAttrib = (LispChildAttribute)
                                             field.GetCustomAttribute(typeof(LispChildAttribute));
            if (ChildAttrib == null)
            {
                continue;
            }

            PropertyPropertiesAttribute propertyProperties = (PropertyPropertiesAttribute)
                                                             field.GetCustomAttribute(typeof(PropertyPropertiesAttribute));

            if ((propertyProperties != null) && (propertyProperties.Hidden))
            {
                continue;
            }

            if (field.Type == typeof(string) || field.Type == typeof(float) ||
                field.Type == typeof(int))
            {
                Gtk.Entry entry = new Gtk.Entry();
                entry.Name = field.Name;
                object val = field.GetValue(NewObject);
                if (val != null)
                {
                    entry.Text = val.ToString();
                }
                widgetTable.Add(entry);
                fieldTable.Add(field);
                entry.Changed       += OnEntryChanged;
                entry.FocusOutEvent += OnEntryChangeDone;
                editWidgets.Add(entry);
                AddTooltip(propertyProperties, entry);
            }
            else if (field.Type == typeof(bool))
            {
                Gtk.CheckButton checkButton = new Gtk.CheckButton(field.Name);
                checkButton.Name   = field.Name;
                checkButton.Active = (bool)field.GetValue(NewObject);
                widgetTable.Add(checkButton);
                fieldTable.Add(field);
                checkButton.Toggled += OnCheckButtonToggled;
                editWidgets.Add(checkButton);
                AddTooltip(propertyProperties, checkButton);
            }
            else if (field.Type.IsEnum)
            {
                // Create a combobox containing all the names of enum values.
                Gtk.ComboBox comboBox = new Gtk.ComboBox(Enum.GetNames(field.Type));
                // Set the name of the box.
                comboBox.Name = field.Name;
                // FIXME: This will break if:
                //        1) the first enum isn't 0 and/or
                //        2) the vaules are not sequential (0, 1, 3, 4 wouldn't work)
                object val = field.GetValue(NewObject);
                if (val != null)
                {
                    comboBox.Active = (int)val;
                }
                widgetTable.Add(comboBox);
                fieldTable.Add(field);
                comboBox.Changed += OnComboBoxChanged;
                editWidgets.Add(comboBox);
                AddTooltip(propertyProperties, comboBox);
            }
        }

        // Register our event handler for self-managed fields
        foreach (FieldOrProperty field in fieldTable)
        {
            field.Changed += OnFieldChanged;
        }

        Gtk.Table table = new Gtk.Table((uint)editWidgets.Count, 2, false);
        table.ColumnSpacing = 6;
        table.RowSpacing    = 6;
        table.BorderWidth   = 12;
        for (uint i = 0; i < editWidgets.Count; ++i)
        {
            Gtk.Widget widget = editWidgets[(int)i];
            if (widget is Gtk.CheckButton)
            {
                table.Attach(widget, 0, 2, i, i + 1,
                             Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, Gtk.AttachOptions.Shrink, 0, 0);
            }
            else
            {
                Gtk.Label label = new Gtk.Label(widget.Name + ":");
                label.SetAlignment(0, 1);
                table.Attach(label, 0, 1, i, i + 1,
                             Gtk.AttachOptions.Fill, Gtk.AttachOptions.Shrink, 0, 0);
                table.Attach(widget, 1, 2, i, i + 1,
                             Gtk.AttachOptions.Fill | Gtk.AttachOptions.Expand, Gtk.AttachOptions.Shrink, 0, 0);
            }
        }
        box.PackStart(table, true, true, 0);

        // TODO add a (!) image in front of the label (and hide/show it depending
        // if there was an error)
        errorLabel        = new Gtk.Label(String.Empty);
        errorLabel.Xalign = 0;
        errorLabel.Xpad   = 12;
        box.PackStart(errorLabel, true, false, 0);

        box.ShowAll();

        AddWithViewport(box);
    }
Esempio n. 54
0
        private void InitializeComponent()
        {
            quitButton         = new Gtk.Button();
            nextPlotButton     = new Gtk.Button();
            prevPlotButton     = new Gtk.Button();
            printButton        = new Gtk.Button();
            exampleNumberLabel = new Gtk.Label();

            // Create the two display panes for the samples
            plotWidget = new PlotWidget();
            infoBox    = new Gtk.TextView();

            quitButton.Name = "quitButton";
            //quitButton.TabIndex = 14;
            quitButton.Label    = "Close";
            quitButton.Clicked += new System.EventHandler(quitButton_Click);

            nextPlotButton.Name = "nextPlotButton";
            //nextPlotButton.TabIndex = 17;
            nextPlotButton.Label    = "Next";
            nextPlotButton.Clicked += new System.EventHandler(nextPlotButton_Click);

            printButton.Name = "printButton";
            //printButton.TabIndex = 9;
            printButton.Label    = "Print";
            printButton.Clicked += new System.EventHandler(printButton_Click);

            prevPlotButton.Name = "prevPlotButton";
            //prevPlotButton.TabIndex = 15;
            prevPlotButton.Label    = "Prev";
            prevPlotButton.Clicked += new System.EventHandler(prevPlotButton_Click);

            exampleNumberLabel.Name = "exampleNumberLabel";

            infoBox.Name = "infoBox";
            //infoBox.TabIndex = 18;

            SetSizeRequest(632, 520);
            //
            // Define 11x8 table on which to lay out the plot, test buttons, etc
            //
            layout             = new Gtk.Table(11, 8, true);
            layout.BorderWidth = 4;
            Add(layout);

            infoFrame            = new Frame();
            infoFrame.ShadowType = Gtk.ShadowType.In;
            infoFrame.Add(infoBox);

            AttachOptions opt = AttachOptions.Expand | AttachOptions.Fill;
            uint          xpad = 2, ypad = 10;

            layout.Attach(infoFrame, 0, 8, 9, 11);
            layout.Attach(plotWidget, 0, 8, 0, 8);
            layout.Attach(quitButton, 3, 4, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(printButton, 2, 3, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(prevPlotButton, 0, 1, 8, 9, opt, opt, xpad, ypad);
            layout.Attach(exampleNumberLabel, 4, 5, 8, 9);
            layout.Attach(nextPlotButton, 1, 2, 8, 9, opt, opt, xpad, ypad);
            Name = "PlotSurface Samples";
        }
Esempio n. 55
0
        public CredentialsDialog(URIish uri, IEnumerable <CredentialItem> credentials)
        {
            this.Build();

            labelTop.Text = string.Format(labelTop.Text, uri.ToString());

            Gtk.Table table = new Gtk.Table(0, 0, false);
            table.ColumnSpacing = 6;
            vbox.PackStart(table, true, true, 0);

            uint   r           = 0;
            Widget firstEditor = null;

            foreach (CredentialItem c in credentials)
            {
                Label lab = new Label(c.GetPromptText() + ":");
                lab.Xalign = 0;
                table.Attach(lab, 0, 1, r, r + 1);
                Table.TableChild tc = (Table.TableChild)table [lab];
                tc.XOptions = AttachOptions.Shrink;

                Widget editor = null;

                if (c is CredentialItem.YesNoType)
                {
                    CredentialItem.YesNoType cred = (CredentialItem.YesNoType)c;
                    if (credentials.Count(i => i is CredentialItem.YesNoType) == 1)
                    {
                        singleYesNoCred = cred;
                        buttonOk.Hide();
                        buttonYes.Show();
                        buttonNo.Show();
                        // Remove the last colon
                        lab.Text = lab.Text.Substring(0, lab.Text.Length - 1);
                    }
                    else
                    {
                        CheckButton btn = new CheckButton();
                        editor       = btn;
                        btn.Toggled += delegate
                        {
                            cred.SetValue(btn.Active);
                        };
                    }
                }
                else if (c is CredentialItem.StringType || c is CredentialItem.CharArrayType)
                {
                    CredentialItem cred = c;
                    Entry          e    = new Entry();
                    editor             = e;
                    e.ActivatesDefault = true;
                    if (cred.IsValueSecure())
                    {
                        e.Visibility = false;
                    }
                    e.Changed += delegate
                    {
                        if (cred is CredentialItem.StringType)
                        {
                            ((CredentialItem.StringType)cred).SetValue(e.Text);
                        }
                        else
                        {
                            ((CredentialItem.CharArrayType)cred).SetValue(e.Text.ToCharArray());
                        }
                    };

                    if (c is CredentialItem.Username)
                    {
                        e.Text = uri.GetUser() ?? "";
                    }
                }
                if (editor != null)
                {
                    table.Attach(editor, 1, 2, r, r + 1);
                    tc          = (Table.TableChild)table [lab];
                    tc.XOptions = AttachOptions.Fill;
                    if (firstEditor == null)
                    {
                        firstEditor = editor;
                    }
                }

                r++;
            }
            table.ShowAll();
            Focus   = firstEditor;
            Default = buttonOk;
        }
    public GnomeArtNgApp(string[] args)
    {
        Application.Init();
        //i18n
        Catalog.Init("gnomeartng", "./locale");
        config = new CConfiguration();
        //initialize Glade
        string mainW = "MainWindow";

        Glade.XML gxml = new Glade.XML(null, "gui.glade", mainW, null);
        mainWindow = (Gtk.Window)gxml.GetWidget(mainW);
        gxml.Autoconnect(this);

        //Connect all events
        mainWindow.DeleteEvent       += new DeleteEventHandler(OnWindowDeleteEvent);
        ExtInfoPreviewButton.Clicked += new EventHandler(OnPreviewButtonClicked);
        InstallButton.Clicked        += new EventHandler(OnInstallButtonClicked);
        RevertButton.Clicked         += new EventHandler(OnRevertButtonClicked);
        RefreshButton.Clicked        += new EventHandler(OnRefreshButtonClicked);
        SaveButton.Clicked           += new EventHandler(OnSaveButtonClicked);
        MainNotebook.SwitchPage      += new SwitchPageHandler(OnSwitchPage);
        FilterEntry.Changed          += new EventHandler(OnFilterEntriesChanged);
//		SortKindCb.Changed += new EventHandler(OnSortKindEntryChanged);
//		SortDirectionCb.Changed += new EventHandler(OnSortDirectionEntryChanged);
//		SortCloseButton.Clicked += new EventHandler(OnSortCloseClicked);
        FilterEntry.KeyReleaseEvent += new KeyReleaseEventHandler(OnFilterbarKeyReleased);
        FilterCloseButton.Clicked   += new EventHandler(OnFilterbarCloseClicked);

        //Menuitems
        QuitMenuItem.Activated   += new EventHandler(OnQuitItemSelected);
        UpdateMenuItem.Activated += new EventHandler(OnUpdateItemSelected);
        DonateMenuItem.Activated += new EventHandler(CUpdateWindow.onDonateButtonClicked);
        FilterMenuItem.Activated += new EventHandler(OnFilterItemSelected);
//		SortMenuItem.Activated += new EventHandler(OnSortItemSelected);
        InfoMenuItem.Activated        += new EventHandler(OnInfoItemSelected);
        PreferencesMenuItem.Activated += new EventHandler(OnPreferencesItemSelected);
        FTAItem.Activated             += new EventHandler(onFtaItemSelected);

        //First, download all thumbs...but don't bother the user with the update message, even if there is one
        bool RestartApp = false;

        if (config.NeverStartedBefore)
        {
            new CFirstTimeAssistant(config);
        }
//		else if (config.DontBotherForUpdates==false) {
//			if (config.UpdateAvailable) {
//				Console.WriteLine("An update is available, newest version is: "+config.NewestVersionNumberOnServer);
//			RestartApp = ShowUpdateWindow();
//			}
//		}

        if (!RestartApp)
        {
            //Application placement - doesn't work properly with compiz (is it the window placement plugin?)
            if (config.SettingsLoadOk)
            {
                mainWindow.Resize(config.Window.Width, config.Window.Height);
                mainWindow.Move(config.Window.X, config.Window.Y);
                //Console.WriteLine(config.Window.X+" "+ config.Window.Y);
            }

            //ArtManager erzeugen
            man = new CArtManager(config);

            //Stores anlegen und IconViews anlegen
            for (int i = 0; i < ListStoreCount; i++)
            {
                sWins[i]     = (Gtk.ScrolledWindow)(gxml.GetWidget("swin" + i));
                stores[i]    = new ListStore(typeof(Pixbuf), typeof(string), typeof(string), typeof(int));
                IconViews[i] = new Gtk.IconView(stores[i]);
                IconViews[i].SelectionChanged += new System.EventHandler(OnSelChanged);
                IconViews[i].ItemActivated    += new ItemActivatedHandler(OnItemActivated);
                IconViews[i].PixbufColumn      = 0;
                CurrentIconView = IconViews[0];

                sWins[i].Add(IconViews[i]);
                IconViews[i].Show();
            }

            //Create the comboboxes
            imageTypeBox        = ComboBox.NewText();
            imageResolutionsBox = ComboBox.NewText();
            imageStyleBox       = ComboBox.NewText();

            //Verschiedene Styles hinzufügen
            imageStyleBox.AppendText(Catalog.GetString("Centered"));
            imageStyleBox.AppendText(Catalog.GetString("Filled"));
            imageStyleBox.AppendText(Catalog.GetString("Scaled"));
            imageStyleBox.AppendText(Catalog.GetString("Zoomed"));
            imageStyleBox.AppendText(Catalog.GetString("Tiled"));
            imageStyleBox.Active   = 0;
            imageStyleBox.Changed += new EventHandler(OnImageStyleBoxChanged);

            LowerTable.Attach(imageTypeBox, 1, 2, 2, 3);
            LowerTable.Attach(imageResolutionsBox, 1, 2, 3, 4);
            LowerTable.Attach(imageStyleBox, 1, 2, 4, 5);

            UpdateMenuItem.Hide();

            OnSwitchPage(MainNotebook, new SwitchPageArgs());
            Gtk.Application.Run();
        }
    }
Esempio n. 57
0
        public Gtk.Widget Create()
        {
            table = new Gtk.Table((uint)rows, (uint)cols, false);

            Gtk.Label title = new Label();
            title.Markup = this.titleMarkup;
            // label starting at left with SetAlignment also needs AttachOptions.Fill for it to work
            title.SetAlignment(0f, 0.5f);
            table.Attach(title, 0, (uint)cols, 0, 1, AttachOptions.Fill, AttachOptions.Shrink, 0, 0);

            // add some spacing so cell content won't touch
            table.ColumnSpacing = table.RowSpacing = 0;

            const uint AxisPadX = 2;
            const uint AxisPadY = 2;

            // x axis
            axisWidgetsX = new Widget[countX];
            for (uint i = 0; i < countX; i++)
            {
                Gtk.Label label = new Label();
                label.Text = axisX[i].ToString();

                axisWidgetsX[i] = label;
                table.Attach(label, DataColLeft + i, DataColLeft + 1 + i, DataRowTop - 1, DataRowTop, AttachOptions.Shrink, AttachOptions.Shrink, AxisPadX, AxisPadY);
            }

            // y axis
            axisWidgetsY = new Widget[countY];
            for (uint i = 0; i < countY; i++)
            {
                Gtk.Label label = new Label();
                label.Text = axisY[i].ToString();
                label.SetAlignment(1f, 0f);

                axisWidgetsY[i] = label;
                table.Attach(label, DataColLeft - 1, DataColLeft, DataRowTop + i, DataRowTop + 1 + i, AttachOptions.Fill, AttachOptions.Shrink, AxisPadX, AxisPadY);
            }

            // values
            int countZ = values.Length;

            valueWidgets = new Widget[countZ];
            for (uint i = 0; i < countZ; i++)
            {
                float        val    = values[i];
                Gtk.Widget   label  = new Label(val.ToString(this.formatValues));
                BorderWidget widget = new BorderWidget();

                // ShadowType differences might be minimal
                if (val >= this.valuesMax)
                {
                    widget.Shadow = ShadowType.EtchedOut;
                }
                else if (val <= this.valuesMin)
                {
                    widget.Shadow = ShadowType.EtchedOut;
                }

                widget.Color = CalcColor(val);
                widget.Add(label);

                valueWidgets[i] = widget;
                uint row = DataRowTop + i / (uint)this.countX;
                uint col = DataColLeft + i % (uint)this.countX;

                table.Attach(widget, col, col + 1, row, row + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
            }

            // x axis name
            Gtk.Label titleX = new Gtk.Label();
            titleX.Markup = "<b>" + this.axisMarkupX + "</b>";
            //titleX.SetAlignment (0.5f, 0.5f);
            table.Attach(titleX, DataColLeft, (uint)cols, DataRowTop - 2, DataRowTop - 1, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            // y axis name
            Gtk.Label titleY = new Gtk.Label();
            // Turning on any wrap property causes 0 angle!
            //titleY.Wrap = true;
            //titleY.LineWrap = true;
            //titleY.LineWrapMode = Pango.WrapMode.WordChar;
            titleY.Angle  = 90;
            titleY.Markup = "<b>" + this.axisMarkupY + "</b>";

            //titleY.SetAlignment (0.5f, 0.5f);
            table.Attach(titleY, 0, 1, DataRowTop, (uint)rows, AttachOptions.Shrink, AttachOptions.Shrink, 0, 0);

            //table.Homogeneous = true;
            return(table);
        }
Esempio n. 58
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Scrabble.GUI.StartWindow"/> class.
        /// </summary>
        public StartWindow() : base(Gtk.WindowType.Toplevel)
        {
            #region Basic window properties
            // Basic window properties
            this.Title        = "Scrabble - Základní nastavení";
            this.Name         = "ConfigWindow";
            this.DeleteEvent += OnDeleteEvent;
            this.SetPosition(WindowPosition.Center);
            this.DefaultWidth  = 410;
            this.DefaultHeight = 280;
            this.Icon          = Scrabble.Game.InitialConfig.icon;
            #endregion

            this.numberOfPlayers = 2;

            // Own thread for loading dictionary
            this.statusb = new Gtk.Statusbar();
            this.statusb.Push(statusb.GetContextId("Slovník"), "Načítám slovník");
            this.tdic = new Thread(LoadDictionary);
            this.tdic.Start();

            // infoText (top)
            this.infoText = new Gtk.Label("Základní nastavení hry.\n" +
                                          "Nastavte prosím počet hráčů, jejich jména a určete zda za ně bude hrát umělá inteligence. " +
                                          "Také můžete nastavit, kteří hráči se připojují vzdáleně.");
            this.infoText.Wrap = true;

            // First config line (number of players, client)
            this.upperHbox = new HBox(false, 5);
            this.l1        = new Label("Počet hráčů");
            this.upperHbox.PackStart(l1);
            this.l2                = new Label(", nebo:");
            this.entryNum          = new SpinButton(2, 5, 1);
            this.entryNum.Changed += OnNumberOfPlayerChange;
            client             = new CheckButton();
            client.Clicked    += IamClient;
            client.Label       = "připojit se ke vzdálené hře";
            client.TooltipText = "Pokud zaškrnete, tak se program bude chovat pouze jako client a připojí se k hře vedené na jiném PC.";
            upperHbox.Add(entryNum);
            upperHbox.Add(l2);
            upperHbox.PackEnd(client);
            upperHbox.BorderWidth  = 10;
            upperHbox.WidthRequest = 20;

            // Table with config for each player (dynamic size)
            table = new Gtk.Table(5, 7, false);
            table.Attach(new Gtk.Label("Jméno hráče:"), 1, 2, 0, 1);
            table.Attach(new Gtk.Label("CPU"), 2, 3, 0, 1);
            table.Attach(new Gtk.Label("Network"), 3, 4, 0, 1);
            ipLabel = new Gtk.Label("IP");
            table.Attach(ipLabel, 4, 5, 0, 1);

            labels    = new Gtk.Label[5];
            entryes   = new Gtk.Entry[5];
            CPUchecks = new Gtk.CheckButton[5];
            MPchecks  = new Gtk.CheckButton[5];
            IPs       = new Gtk.Entry[5];
            for (int i = 0; i < 5; i++)
            {
                labels [i]      = new Gtk.Label((i + 1).ToString());
                labels [i].Name = string.Format("l {0}", i);
                table.Attach(labels [i], 0, 1, (uint)i + 1, (uint)i + 2);
                entryes [i]             = new Gtk.Entry(12);
                entryes [i].Text        = "Hráč " + (i + 1).ToString();
                entryes [i].TooltipText = "Vložte jméno hráče.";
                table.Attach(entryes [i], 1, 2, (uint)i + 1, (uint)i + 2);
                CPUchecks [i]             = new Gtk.CheckButton();
                CPUchecks [i].Name        = string.Format("c {0}", i);
                CPUchecks [i].TooltipText = "Pokud je zaškrtnuto, tak za hráče bude hrát počítač.";
                ((Gtk.CheckButton)CPUchecks [i]).Clicked += OnCpuChange;
                table.Attach(CPUchecks [i], 2, 3, (uint)i + 1, (uint)i + 2);
                MPchecks [i]             = new Gtk.CheckButton();
                MPchecks [i].Name        = string.Format("n {0}", i);
                MPchecks [i].TooltipText = "Pokud je zaškrtnuto, tak se počítá s tím, že se tento hráč připojí vzdáleně. ";
                ((Gtk.CheckButton)MPchecks [i]).Clicked += OnNetChange;
                table.Attach(MPchecks [i], 3, 4, (uint)i + 1, (uint)i + 2);
                IPs [i]            = new Gtk.Entry(15);
                IPs [i].Text       = "192.168.0.X";
                IPs [i].WidthChars = 15;
                IPs [i].Sensitive  = false;
                table.Attach(IPs [i], 4, 5, (uint)i + 1, (uint)i + 2);
            }
            this.CPUchecks[0].Hide();

            ok             = new Button("Hotovo");
            ok.Clicked    += Done;
            ok.BorderWidth = 5;
            ok.TooltipText = "Potvrzením začne hra. Může se stát, že program bude ještě chvíli načítat slovník.";
            table.Attach(ok, 0, 5, 6, 7);

            // Main vbox (where all is)
            this.mainVbox = new Gtk.VBox(false, 5);

            this.mainVbox.PackStart(infoText);
            this.mainVbox.Add(upperHbox);
            this.mainVbox.Spacing = 5;
            this.mainVbox.Add(table);
            this.mainVbox.PackEnd(statusb);

            this.mainVbox.BorderWidth = 9;
            this.Add(mainVbox);
            this.mainVbox.ShowAll();

            for (int i = 2; i < numberOfPlayers + 3; i++)
            {
                labels [i].Hide();
                entryes [i].Hide();
                CPUchecks [i].Hide();
                MPchecks [i].Hide();
                IPs [i].Hide();
            }
            ipLabel.Hide();

            foreach (Gtk.Entry e in IPs)
            {
                e.Hide();
            }

            this.CPUchecks[0].Hide();
            this.MPchecks[0].Hide();
        }
Esempio n. 59
0
        public ProgressBarSample()
        {
            Gtk.HSeparator  separator;
            Gtk.Table       table;
            Gtk.Button      button;
            Gtk.CheckButton check;
            Gtk.VBox        vbox;

            //Application.Init ();

            /* Allocate memory for the data that is passed to the callbacks*/
            pdata = new ProgressData();
            pdata.activity_mode    = false;
            pdata.window           = new Gtk.Window(Gtk.WindowType.Toplevel);
            pdata.window.Resizable = true;

            pdata.window.DeleteEvent += destroy_progress;
            pdata.window.Title        = "GtkProgressBar";
            pdata.window.BorderWidth  = 0;

            vbox             = new Gtk.VBox(false, 5);
            vbox.BorderWidth = 10;
            pdata.window.Add(vbox);
            vbox.Show();

            /* Create a centering alignment object */
            Gtk.Alignment align = new Gtk.Alignment(1, 1, 0, 0);
            vbox.PackStart(align, false, false, 5);
            align.Show();

            /* Create the GtkProgressBar */
            pdata.pbar      = new Gtk.ProgressBar();
            pdata.pbar.Text = "";
            align.Add(pdata.pbar);
            pdata.pbar.Show();

            /* Add a timer callback to update the value of the progress bar*/
            pdata.timer = GLib.Timeout.Add(10000, new GLib.TimeoutHandler(progress_timeout));


            separator = new Gtk.HSeparator();
            vbox.PackStart(separator, false, false, 0);
            separator.Show();

            /* rows, columns, homogeneous */
            table = new Gtk.Table(2, 3, false);
            vbox.PackStart(table, false, true, 0);
            table.Show();

            /* Add a check button to select displaying of the trough text*/
            check = new Gtk.CheckButton("Query cada 1 minuto");
            table.Attach(check, 0, 1, 0, 1,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_show_text;
            check.Show();

            /* Add a check button to toggle activity mode */
            check = new Gtk.CheckButton("Activity mode");
            table.Attach(check, 0, 1, 1, 2,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_activity_mode;
            check.Active   = true;
            check.Show();

            /* Add a check button to toggle orientation */
            check = new Gtk.CheckButton("Right to Left");
            table.Attach(check, 0, 1, 2, 3,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill,
                         5, 5);
            check.Clicked += toggle_orientation;
            check.Show();

            /* Add a button to exit the program */
            button          = new Gtk.Button("close");
            button.Clicked += button_click;
            vbox.PackStart(button, false, false, 0);

            /* This makes it so the button is the default. */
            button.CanDefault = true;

            /* This grabs this button to be the default button. Simply hitting
             * the "Enter" key will cause this button to activate. */
            button.GrabDefault();
            button.Show();

            pdata.window.ShowAll();

            //Application.Run ();
        }
Esempio n. 60
0
    private void createTable()
    {
        LogB.Debug("Persons count" + persons.Count.ToString());
        uint padding = 4;
        uint cols    = 4;      //each row has 4 columns
        uint rows    = Convert.ToUInt32(Math.Floor(persons.Count / (1.0 * cols)) + 1);
        int  count   = 0;

        if (SelectedPerson == null)
        {
            selectedFirstClickPersonID      = -1;
            label_selected_person_name.Text = "";
        }
        else
        {
            selectedFirstClickPersonID           = SelectedPerson.UniqueID;
            label_selected_person_name.Text      = "<b>" + SelectedPerson.Name + "</b>";
            label_selected_person_name.UseMarkup = true;
        }

        personButtonsSensitive(false);
        vbox_button_delete_confirm.Visible = false;
        list_ppb = new List <PersonPhotoButton>();

        for (int row_i = 0; row_i < rows; row_i++)
        {
            for (int col_i = 0; col_i < cols; col_i++)
            {
                if (count >= persons.Count)
                {
                    return;
                }

                Person p = (Person)persons[count++];

                PersonPhotoButton ppb = new PersonPhotoButton(p.UniqueID, p.Name);                 //creates the button

                //select currentPerson
                if (selectedFirstClickPersonID != -1 && selectedFirstClickPersonID == p.UniqueID)
                {
                    ppb.Select(true);
                    assignPersonSelectedStuff(p);
                }

                list_ppb.Add(ppb);
                Gtk.Button b = ppb.Button;

                b.Show();

                b.Clicked += new EventHandler(on_button_portrait_clicked);
                b.CanFocus = true;

                table1.Attach(b, (uint)col_i, (uint)col_i + 1, (uint)row_i, (uint)row_i + 1,
                              Gtk.AttachOptions.Fill,
                              Gtk.AttachOptions.Fill,
                              padding, padding);
            }
        }

        table1.ShowAll();
    }