// Find Bar

    public void OnFindEntryChange(object sender, EventArgs args)
    {
        bool empty = (findentry.Text.Length == 0);
        bool found = (!empty && (textview1.Buffer.Text.IndexOf(findentry.Text) >= 0));

        if (!empty && !found)
        {
            findentry.ModifyBase(StateType.Normal, finderrorbasecolor);
            findentry.ModifyText(StateType.Normal, finderrortextcolor);
            findlabel.Text    = "Text not found";
            findimage.Visible = true;
            findimage.Display.Beep();
        }
        else
        {
            findentry.ModifyBase(StateType.Normal, findnormalbasecolor);
            findentry.ModifyText(StateType.Normal, findnormaltextcolor);
            findlabel.Text    = String.Empty;
            findimage.Visible = false;
        }

        findnextbutton.Sensitive      = found;
        findpreviousbutton.Sensitive  = found;
        findhighlightbutton.Sensitive = found;

        if (found && findhighlight)
        {
            OnFindHighlightButtonClick(sender, args);
            OnFindHighlightButtonClick(sender, args);
        }
    }
 public void SetTextColor(Gdk.Color color)
 {
     _entry.ModifyText(StateType.Normal, color);
 }
Esempio n. 3
0
        /// <summary>
        /// Update Gtk objects properties
        /// </summary>
        private void UpdateGraphicObjects()
        {
            // Set dialog icon
            MainWindow.Icon = Gdk.Pixbuf.LoadFromResource("comex_256.png");

            // Set tool tip text for toolbutton
            TbOpen.TooltipText = GlobalObj.LMan.GetString("openact");
            TbOpen.Label       = GlobalObj.LMan.GetString("openlbl");

            TbClose.Label = GlobalObj.LMan.GetString("closelbl");

            TbSettings.Label       = GlobalObj.LMan.GetString("settingslbl");
            TbSettings.TooltipText = GlobalObj.LMan.GetString("settingsmenulbl");

            TbAbout.TooltipText = GlobalObj.LMan.GetString("infoact");
            TbAbout.Label       = GlobalObj.LMan.GetString("infolbl");

            TbExit.TooltipText = GlobalObj.LMan.GetString("exitact");
            TbExit.Label       = GlobalObj.LMan.GetString("exitlbl");

            TbATR.TooltipText = GlobalObj.LMan.GetString("atract");
            TbATR.Label       = GlobalObj.LMan.GetString("atrlbl");

            // Set labels
            ((Label)MenuFileItem.Child).TextWithMnemonic     = GlobalObj.LMan.GetString("filemenulbl");
            ((Label)MenuFileOpen.Child).TextWithMnemonic     = GlobalObj.LMan.GetString("openmenulbl");
            ((Label)MenuFileClose.Child).TextWithMnemonic    = GlobalObj.LMan.GetString("closemenulbl");
            ((Label)MenuFileSettings.Child).TextWithMnemonic = GlobalObj.LMan.GetString("settingsmenulbl");
            ((Label)MenuFileExit.Child).TextWithMnemonic     = GlobalObj.LMan.GetString("exitmenulbl");
            ((Label)MenuReaderItem.Child).TextWithMnemonic   = GlobalObj.LMan.GetString("readermenulbl");
            ((Label)MenuAboutItem.Child).TextWithMnemonic    = GlobalObj.LMan.GetString("helpmenulbl");
            ((Label)MenuAboutInfo.Child).TextWithMnemonic    = GlobalObj.LMan.GetString("infomenulbl");

            LblATR.Markup      = "<b>" + GlobalObj.LMan.GetString("atrframelbl") + "</b>";
            LblCommand.Text    = GlobalObj.LMan.GetString("cmdlbl");
            LblResponse.Text   = GlobalObj.LMan.GetString("resplbl");
            LblSend.Text       = GlobalObj.LMan.GetString("sendlbl");
            LblExchange.Markup = "<b>" + GlobalObj.LMan.GetString("cardframelbl") + "</b>";
            LblFile.Markup     = "<b>" + GlobalObj.LMan.GetString("commandfilelbl") + "</b>";

            Gdk.Color color = new Gdk.Color();
            Gdk.Color.Parse("#0000FF", ref color);
            TxtATR.ModifyText(StateType.Normal, color);
            Gdk.Color.Parse("#0000FF", ref color);
            TxtResp.ModifyText(StateType.Normal, color);

            Gdk.Color.Parse("#1F6D20", ref color);
            TxtCmd.ModifyText(StateType.Normal, color);

            // TreeView (List)
            LstCommands.Selection.Mode = SelectionMode.Single;
            CellRendererText rendererText = new CellRendererText();

            TreeViewColumn column = new TreeViewColumn();

            column.Title     = "Commands";
            column.Resizable = true;
            column.PackStart(rendererText, true);
            column.AddAttribute(rendererText, "text", 0);

            LstCommands.RulesHint = true;
            LstCommands.AppendColumn(column);

            if (GlobalObj.IsWindows())
            {
                LstCommands.ModifyFont(FontDescription.FromString("Courier New Normal 10"));
            }
            else
            {
                LstCommands.ModifyFont(FontDescription.FromString("Fixed Normal 10"));
            }


            // update gui menu
            Gtk.RadioMenuItem rmi;
            // loop for all readers
            List <string> allReaders = new List <string>();

            // loop for each managed readers type
            foreach (IReader rdr in GlobalObj.ReaderManager.Values)
            {
                allReaders.AddRange(rdr.Readers);
            }


            for (int n = 0; n < allReaders.Count; n++)
            {
                // set first as selected
                if (n == 0)
                {
                    rmi = new Gtk.RadioMenuItem(allReaders[n]);
                    GlobalObj.SelectedReader = allReaders[n];
                    StatusBar.Push(1, GlobalObj.LMan.GetString("selreader") + ": " + allReaders[n]);
                }
                else
                {
                    // added others
                    rmi = new Gtk.RadioMenuItem((RadioMenuItem)MenuReader.Children[0], allReaders[n]);
                }

                rmi.ButtonReleaseEvent += ActionChangeReader;
                MenuReader.Add(rmi);
            }

            MenuReader.ShowAll();
        }
		void Build ()
		{
			BorderWidth = 0;
			WidthRequest = 901;
			HeightRequest = 632;

			Modal = true;
			Name = "wizard_dialog";
			Title = GettextCatalog.GetString ("New Protobuild Module");
			WindowPosition = WindowPosition.CenterOnParent;
			TransientFor = IdeApp.Workbench.RootWindow;

            projectConfigurationWidget = new GtkProtobuildModuleConfigurationWidget();
			projectConfigurationWidget.Name = "projectConfigurationWidget";

            creationWidget = new GtkProtobuildModuleCreationWidget ();
		    creationWidget.Name = "creationWidget";

			// Top banner of dialog.
			var topLabelEventBox = new EventBox ();
			topLabelEventBox.Name = "topLabelEventBox";
			topLabelEventBox.HeightRequest = 52;
			topLabelEventBox.ModifyBg (StateType.Normal, bannerBackgroundColor);
			topLabelEventBox.ModifyFg (StateType.Normal, whiteColor);
			topLabelEventBox.BorderWidth = 0;

			var topBannerTopEdgeLineEventBox = new EventBox ();
			topBannerTopEdgeLineEventBox.Name = "topBannerTopEdgeLineEventBox";
			topBannerTopEdgeLineEventBox.HeightRequest = 1;
			topBannerTopEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor);
			topBannerTopEdgeLineEventBox.BorderWidth = 0;

			var topBannerBottomEdgeLineEventBox = new EventBox ();
			topBannerBottomEdgeLineEventBox.Name = "topBannerBottomEdgeLineEventBox";
			topBannerBottomEdgeLineEventBox.HeightRequest = 1;
			topBannerBottomEdgeLineEventBox.ModifyBg (StateType.Normal, bannerLineColor);
			topBannerBottomEdgeLineEventBox.BorderWidth = 0;

			topBannerLabel = new Label ();
			topBannerLabel.Name = "topBannerLabel";
			Pango.FontDescription font = topBannerLabel.Style.FontDescription.Copy ();
			font.Size = (int)(font.Size * 1.8);
			topBannerLabel.ModifyFont (font);
			topBannerLabel.ModifyFg (StateType.Normal, whiteColor);
			var topLabelHBox = new HBox ();
			topLabelHBox.Name = "topLabelHBox";
			topLabelHBox.PackStart (topBannerLabel, false, false, 20);

            topSearchBox = new Entry();
            topSearchBox.Text = "";
            var normalText = topSearchBox.Style.Text(StateType.Normal);
            topSearchBox.FocusInEvent += (o, args) =>
            {
                topSearchBox.ModifyText(StateType.Normal, normalText);
                if (topSearchBox.Text == "Search online...")
                {
                    topSearchBox.Text = "";
                }
            };
		    topSearchBox.FocusOutEvent += (o, args) => {
                topSearchBox.ModifyText(StateType.Normal, new Color(128, 128, 128));
                if (topSearchBox.Text == "")
                {
                    topSearchBox.Text = "Search online...";
                }
		    };
            topLabelHBox.PackEnd(topSearchBox, false, false, 20);

			topLabelEventBox.Add (topLabelHBox);

			VBox.PackStart (topBannerTopEdgeLineEventBox, false, false, 0);
			VBox.PackStart (topLabelEventBox, false, false, 0);
			VBox.PackStart (topBannerBottomEdgeLineEventBox, false, false, 0);

			// Main templates section.
			centreVBox = new VBox ();
			centreVBox.Name = "centreVBox";
			VBox.PackStart (centreVBox, true, true, 0);
			templatesHBox = new HBox ();
			templatesHBox.Name = "templatesHBox";
			centreVBox.PackEnd (templatesHBox, true, true, 0);

			// Template categories.
			var templateCategoriesVBox = new VBox ();
			templateCategoriesVBox.Name = "templateCategoriesVBox";
			templateCategoriesVBox.BorderWidth = 0;
			templateCategoriesVBox.WidthRequest = 220;
			var templateCategoriesScrolledWindow = new ScrolledWindow ();
			templateCategoriesScrolledWindow.Name = "templateCategoriesScrolledWindow";
			templateCategoriesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

			// Template categories tree view.
			templateCategoriesTreeView = new TreeView ();
			templateCategoriesTreeView.Name = "templateCategoriesTreeView";
			templateCategoriesTreeView.BorderWidth = 0;
			templateCategoriesTreeView.HeadersVisible = false;
			templateCategoriesTreeView.Model = templateCategoriesListStore;
			templateCategoriesTreeView.ModifyBase (StateType.Normal, categoriesBackgroundColor);
			templateCategoriesTreeView.AppendColumn (CreateTemplateCategoriesTreeViewColumn ());
			templateCategoriesScrolledWindow.Add (templateCategoriesTreeView);
			templateCategoriesVBox.PackStart (templateCategoriesScrolledWindow, true, true, 0);
			templatesHBox.PackStart (templateCategoriesVBox, false, false, 0);

			// Templates.
			var templatesVBox = new VBox ();
			templatesVBox.Name = "templatesVBox";
			templatesVBox.WidthRequest = 400;
			templatesHBox.PackStart (templatesVBox, false, false, 0);
			var templatesScrolledWindow = new ScrolledWindow ();
			templatesScrolledWindow.Name = "templatesScrolledWindow";
			templatesScrolledWindow.HscrollbarPolicy = PolicyType.Never;

			// Templates tree view.
			templatesTreeView = new TreeView ();
			templatesTreeView.Name = "templatesTreeView";
			templatesTreeView.HeadersVisible = false;
			templatesTreeView.Model = templatesListStore;
			templatesTreeView.ModifyBase (StateType.Normal, templateListBackgroundColor);
			templatesTreeView.AppendColumn (CreateTemplateListTreeViewColumn ());
			templatesScrolledWindow.Add (templatesTreeView);
			templatesVBox.PackStart (templatesScrolledWindow, true, true, 0);

			// Template
			var templateEventBox = new EventBox ();
			templateEventBox.Name = "templateEventBox";
			templateEventBox.ModifyBg (StateType.Normal, templateBackgroundColor);
			templatesHBox.PackStart (templateEventBox, true, true, 0);
			templateVBox = new VBox ();
			templateVBox.Visible = false;
			templateVBox.BorderWidth = 20;
			templateVBox.Spacing = 10;
			templateEventBox.Add (templateVBox);

			// Template large image.
			templateImage = new ImageView ();
			templateImage.Name = "templateImage";
			templateImage.HeightRequest = 140;
			templateImage.WidthRequest = 240;
			templateVBox.PackStart (templateImage, false, false, 10);

			// Template description.
			templateNameLabel = new Label ();
			templateNameLabel.Name = "templateNameLabel";
			templateNameLabel.WidthRequest = 240;
			templateNameLabel.Wrap = true;
			templateNameLabel.Xalign = 0;
			templateNameLabel.Markup = MarkupTemplateName ("TemplateName");
			templateVBox.PackStart (templateNameLabel, false, false, 0);
			templateDescriptionLabel = new Label ();
			templateDescriptionLabel.Name = "templateDescriptionLabel";
			templateDescriptionLabel.WidthRequest = 240;
			templateDescriptionLabel.Wrap = true;
			templateDescriptionLabel.Xalign = 0;
			templateVBox.PackStart (templateDescriptionLabel, false, false, 0);
			templateVBox.PackStart (new Label (), true, true, 0);

			// Template - button separator.
			var templateSectionSeparatorEventBox = new EventBox ();
			templateSectionSeparatorEventBox.Name = "templateSectionSeparatorEventBox";
			templateSectionSeparatorEventBox.HeightRequest = 1;
			templateSectionSeparatorEventBox.ModifyBg (StateType.Normal, templateSectionSeparatorColor);
			VBox.PackStart (templateSectionSeparatorEventBox, false, false, 0);

			// Buttons at bottom of dialog.
			var bottomHBox = new HBox ();
			bottomHBox.Name = "bottomHBox";
			VBox.PackStart (bottomHBox, false, false, 0);

			// Cancel button - bottom left.
			var cancelButtonBox = new HButtonBox ();
			cancelButtonBox.Name = "cancelButtonBox";
			cancelButtonBox.BorderWidth = 16;
			cancelButton = new Button ();
			cancelButton.Label = "gtk-cancel";
			cancelButton.UseStock = true;
			cancelButtonBox.PackStart (cancelButton, false, false, 0);
			bottomHBox.PackStart (cancelButtonBox, false, false, 0);

			// Previous button - bottom right.
			var previousNextButtonBox = new HButtonBox ();
			previousNextButtonBox.Name = "previousNextButtonBox";
			previousNextButtonBox.BorderWidth = 16;
			previousNextButtonBox.Spacing = 9;
			bottomHBox.PackStart (previousNextButtonBox);
			previousNextButtonBox.Layout = ButtonBoxStyle.End;

			previousButton = new Button ();
			previousButton.Name = "previousButton";
			previousButton.Label = GettextCatalog.GetString ("Previous");
			previousButton.Sensitive = false;
			previousNextButtonBox.PackEnd (previousButton);

			// Next button - bottom right.
			nextButton = new Button ();
			nextButton.Name = "nextButton";
			nextButton.Label = GettextCatalog.GetString ("Next");
			previousNextButtonBox.PackEnd (nextButton);

			// Remove default button action area.
			VBox.Remove (ActionArea);

			if (Child != null) {
				Child.ShowAll ();
			}

            Show ();

            topSearchBox.ModifyText(StateType.Normal, new Color(128, 128, 128));
            topSearchBox.InsertText("Search online...");

			templatesTreeView.HasFocus = true;
			Resizable = false;
		}