当前位置: 首页>>代码示例>>C#>>正文


C# Gtk.Label.ModifyFg方法代码示例

本文整理汇总了C#中Gtk.Label.ModifyFg方法的典型用法代码示例。如果您正苦于以下问题:C# Gtk.Label.ModifyFg方法的具体用法?C# Gtk.Label.ModifyFg怎么用?C# Gtk.Label.ModifyFg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.Label的用法示例。


在下文中一共展示了Gtk.Label.ModifyFg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PreviewPopup

        public PreviewPopup(IconView view)
            : base(Gtk.WindowType.Toplevel)
        {
            Gtk.VBox vbox = new Gtk.VBox ();
            this.Add (vbox);
            this.AddEvents ((int) (Gdk.EventMask.PointerMotionMask |
                           Gdk.EventMask.KeyReleaseMask |
                           Gdk.EventMask.ButtonPressMask));

            this.Decorated = false;
            this.SkipTaskbarHint = true;
            this.SkipPagerHint = true;
            this.SetPosition (Gtk.WindowPosition.None);

            this.KeyReleaseEvent += HandleKeyRelease;
            this.ButtonPressEvent += HandleButtonPress;
            this.Destroyed += HandleDestroyed;

            this.view = view;
            view.MotionNotifyEvent += HandleIconViewMotion;
            view.KeyPressEvent += HandleIconViewKeyPress;
            view.KeyReleaseEvent += HandleKeyRelease;
            view.DestroyEvent += HandleIconViewDestroy;

            this.BorderWidth = 6;

            hist = new FSpot.Histogram ();
            hist.RedColorHint = 127;
            hist.GreenColorHint = 127;
            hist.BlueColorHint = 127;
            hist.BackgroundColorHint = 0xff;

            image = new Gtk.Image ();
            image.CanFocus = false;

            label = new Gtk.Label (String.Empty);
            label.CanFocus = false;
            label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            this.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            this.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            vbox.PackStart (image, true, true, 0);
            vbox.PackStart (label, true, false, 0);
            vbox.ShowAll ();
        }
开发者ID:iainlane,项目名称:f-spot,代码行数:47,代码来源:PreviewPopup.cs

示例2: HandleSlideshow

        //FIXME move all this in a standalone class
        void HandleSlideshow(string tagname)
        {
            Tag tag;
            FSpot.Widgets.SlideShow slideshow = null;

            if (!String.IsNullOrEmpty (tagname))
                tag = Database.Tags.GetTagByName (tagname);
            else
                tag = Database.Tags.GetTagById (Preferences.Get<int> (Preferences.SCREENSAVER_TAG));

            IPhoto[] photos;
            if (tag != null)
                photos = Database.Photos.Query (new Tag[] {tag});
            else if (Preferences.Get<int> (Preferences.SCREENSAVER_TAG) == 0)
                photos = Database.Photos.Query (new Tag [] {});
            else
                photos = new IPhoto [0];

            // Minimum delay 1 second; default is 4s
            var delay = Math.Max (1.0, Preferences.Get<double> (Preferences.SCREENSAVER_DELAY));

            var window = new XScreenSaverSlide ();
            window.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
            window.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));

            if (photos.Length > 0) {
                Array.Sort (photos, new IPhotoComparer.RandomSort ());
                slideshow = new FSpot.Widgets.SlideShow (new BrowsablePointer (new PhotoList (photos), 0), (uint)(delay * 1000), true);
                slideshow.Transition = new FSpot.Transitions.DissolveTransition ();
                window.Add (slideshow);
            } else {
                Gtk.HBox outer = new Gtk.HBox ();
                Gtk.HBox hbox = new Gtk.HBox ();
                Gtk.VBox vbox = new Gtk.VBox ();

                outer.PackStart (new Gtk.Label (String.Empty));
                outer.PackStart (vbox, false, false, 0);
                vbox.PackStart (new Gtk.Label (String.Empty));
                vbox.PackStart (hbox, false, false, 0);
                hbox.PackStart (new Gtk.Image (Gtk.Stock.DialogWarning, Gtk.IconSize.Dialog),
                        false, false, 0);
                outer.PackStart (new Gtk.Label (String.Empty));

                string msg;
                string long_msg;

                if (tag != null) {
                    msg = String.Format (Catalog.GetString ("No photos matching {0} found"), tag.Name);
                    long_msg = String.Format (Catalog.GetString ("The tag \"{0}\" is not applied to any photos. Try adding\n" +
                                             "the tag to some photos or selecting a different tag in the\n" +
                                             "F-Spot preference dialog."), tag.Name);
                } else {
                    msg = Catalog.GetString ("Search returned no results");
                    long_msg = Catalog.GetString ("The tag F-Spot is looking for does not exist. Try\n" +
                                      "selecting a different tag in the F-Spot preference\n" +
                                      "dialog.");
                }

                Gtk.Label label = new Gtk.Label (msg);
                hbox.PackStart (label, false, false, 0);

                Gtk.Label long_label = new Gtk.Label (long_msg);
                long_label.Markup  = String.Format ("<small>{0}</small>", long_msg);

                vbox.PackStart (long_label, false, false, 0);
                vbox.PackStart (new Gtk.Label (String.Empty));

                window.Add (outer);
                label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
                label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
                long_label.ModifyFg (Gtk.StateType.Normal, new Gdk.Color (127, 127, 127));
                long_label.ModifyBg (Gtk.StateType.Normal, new Gdk.Color (0, 0, 0));
            }
            window.ShowAll ();

            Register (window);
            GLib.Idle.Add (delegate {
                if (slideshow != null)
                    slideshow.Start ();
                return false;
            });
        }
开发者ID:nathansamson,项目名称:F-Spot-Album-Exporter,代码行数:83,代码来源:App.cs


注:本文中的Gtk.Label.ModifyFg方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。