示例#1
0
 protected void OnEventbox1EnterNotifyEvent(object o, EnterNotifyEventArgs args)
 {
     if (Highlighted == null)
     {
         Gdk.Color col = new Gdk.Color(65, 177, 225);
         drawingarea1.ModifyBg(StateType.Normal, col);
     }
     else
     {
         image1.Pixbuf = this.Highlighted;
     }
 }
示例#2
0
        public TemplateWindow(string title)
            : base(Gtk.WindowType.Toplevel)
        {
            this.Decorated = false;

            global::Stetic.Gui.Initialize(this);
            // Widget CrossPlatformWebServer.TemplateWindow
            //this.WidthRequest = 550;
            //this.HeightRequest = 350;
            this.Name           = "CrossPlatformWebServer.TemplateWindow";
            this.Title          = global::Mono.Unix.Catalog.GetString("MainWindow");
            this.WindowPosition = ((global::Gtk.WindowPosition)(3));

            // Container child CrossPlatformWebServer.TemplateWindow.Gtk.Container+ContainerChild
            this.gridMain           = new global::Gtk.Fixed();
            this.gridMain.Name      = "gridMain";
            this.gridMain.HasWindow = false;
            // Container child gridMain.Gtk.Fixed+FixedChild
            this.border      = new global::Gtk.DrawingArea();
            this.border.Name = "border";
            this.gridMain.Add(this.border);
            // Container child gridMain.Gtk.Fixed+FixedChild
            this.titlebar      = new global::Gtk.DrawingArea();
            this.titlebar.Name = "titlebar";
            this.gridMain.Add(this.titlebar);
            global::Gtk.Fixed.FixedChild w2 = ((global::Gtk.Fixed.FixedChild)(this.gridMain[this.titlebar]));
            w2.X = 1;
            w2.Y = 1;
            // Container child gridMain.Gtk.Fixed+FixedChild
            this.borderleft      = new global::Gtk.DrawingArea();
            this.borderleft.Name = "borderleft";
            this.gridMain.Add(this.borderleft);
            // Container child gridMain.Gtk.Fixed+FixedChild
            this.bordertop      = new global::Gtk.DrawingArea();
            this.bordertop.Name = "bordertop";
            this.gridMain.Add(this.bordertop);
            // Container child gridMain.Gtk.Fixed+FixedChild
            this.borderright      = new global::Gtk.DrawingArea();
            this.borderright.Name = "borderright";
            this.gridMain.Add(this.borderright);
            // Container child gridMain.Gtk.Fixed+FixedChild
            this.borderbottom      = new global::Gtk.DrawingArea();
            this.borderbottom.Name = "borderbottom";
            this.gridMain.Add(this.borderbottom);
            this.Add(this.gridMain);

            this._closeState    = ButtonStates.Outside;
            this._minimizeState = ButtonStates.Outside;

            _closeStart    = new Cairo.Point(this.WidthRequest - ButtonOffSet - ButtonWidth, ButtonOffSet);
            _minimizeStart = new Cairo.Point(this.WidthRequest - ButtonOffSet - ButtonWidth - ButtonWidth,
                                             ButtonOffSet);

            w2 = null;

            this.ModifyBg(StateType.Normal, new Gdk.Color(255, 255, 255));
            this.titlebar.WidthRequest  = this.WidthRequest - 2;
            this.titlebar.HeightRequest = 60;
            this.titlebar.AddEvents((int)Gdk.EventMask.ButtonPressMask |
                                    (int)Gdk.EventMask.PointerMotionMask |
                                    (int)Gdk.EventMask.ButtonReleaseMask);
            this.titlebar.ButtonPressEvent   += TitlebarButtonPressEvent;
            this.titlebar.ExposeEvent        += OnTitlebarExpose;
            this.titlebar.MotionNotifyEvent  += OnTitlebarMotionNotifyEvent;
            this.titlebar.ButtonReleaseEvent += OnTitlebarButtonReleaseEvent;

            titleLayout                 = new Pango.Layout(this.PangoContext);
            titleLayout.Alignment       = Pango.Alignment.Left;
            titleLayout.FontDescription = new Pango.FontDescription();

            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
            case PlatformID.Win32Windows:
            case PlatformID.WinCE:
                titleLayout.FontDescription.Family = "Segoe UI Light";
                break;

            case PlatformID.Unix:
                titleLayout.FontDescription.Family = "Ubuntu";
                break;

            default:
                //Unknown OS, use default font family
                break;
            }
            titleLayout.FontDescription.Size = 17000;
            titleLayout.SetText(title.ToLower());

            borderleft.WidthRequest  = 1;
            borderleft.HeightRequest = this.HeightRequest;
            borderleft.ModifyBg(StateType.Normal, new Gdk.Color(65, 177, 225));

            bordertop.WidthRequest  = this.WidthRequest;
            bordertop.HeightRequest = 1;
            bordertop.ModifyBg(StateType.Normal, new Gdk.Color(65, 177, 225));

            borderright.WidthRequest  = 1;
            borderright.HeightRequest = this.HeightRequest;
            borderright.ModifyBg(StateType.Normal, new Gdk.Color(65, 177, 225));
            w2   = ((global::Gtk.Fixed.FixedChild)(this.gridMain[this.borderright]));
            w2.X = this.WidthRequest - 1;
            w2.Y = 0;

            borderbottom.WidthRequest  = this.WidthRequest;
            borderbottom.HeightRequest = 1;
            borderbottom.ModifyBg(StateType.Normal, new Gdk.Color(65, 177, 225));
            w2   = ((global::Gtk.Fixed.FixedChild)(this.gridMain[this.borderbottom]));
            w2.X = 0;
            w2.Y = this.HeightRequest - 1;

            if ((this.Child != null))
            {
                this.Child.ShowAll();
            }
            this.Show();
            this.DeleteEvent += new global::Gtk.DeleteEventHandler(this.OnDeleteEvent);
        }