예제 #1
0
파일: TabStrip.cs 프로젝트: rdafoe/Cage
        public Gdk.Rectangle GetTabArea(Tab tab, int pos)
        {
            Gdk.Rectangle rect = tab.Allocation;

            int xdif = 0;
            if (pos > 0)
                xdif = 2;

            int reqh;
            //			StateType st;

            if (tab.Active) {
            //				st = StateType.Normal;
                reqh = tab.Allocation.Height;
            }
            else {
                reqh = tab.Allocation.Height - 3;
            //				st = StateType.Active;
            }

            if (DockFrame.IsWindows) {
                rect.Height = reqh - 1;
                rect.Width--;
                if (pos > 0) {
                    rect.X--;
                    rect.Width++;
                }
                return rect;
            }
            else {
                rect.X -= xdif;
                rect.Width += xdif;
                rect.Height = reqh;
                return rect;
            }
        }
예제 #2
0
파일: TabStrip.cs 프로젝트: rdafoe/Cage
        void DrawTab(Gdk.EventExpose evnt, Tab tab, int pos)
        {
            Gdk.Rectangle rect = GetTabArea (tab, pos);
            StateType st;
            if (tab.Active)
                st = StateType.Normal;
            else
                st = StateType.Active;

            if (DockFrame.IsWindows) {
                GdkWindow.DrawRectangle (Style.DarkGC (Gtk.StateType.Normal), false, rect);
                rect.X++;
                rect.Width--;
                if (tab.Active) {
                    GdkWindow.DrawRectangle (Style.LightGC (Gtk.StateType.Normal), true, rect);
                }
                else {
                    using (Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window)) {
                        cr.NewPath ();
                        cr.MoveTo (rect.X, rect.Y);
                        cr.RelLineTo (rect.Width, 0);
                        cr.RelLineTo (0, rect.Height);
                        cr.RelLineTo (-rect.Width, 0);
                        cr.RelLineTo (0, -rect.Height);
                        cr.ClosePath ();
                        Cairo.Gradient pat = new Cairo.LinearGradient (rect.X, rect.Y, rect.X, rect.Y + rect.Height);
                        Cairo.Color color1 = DockFrame.ToCairoColor (Style.Mid (Gtk.StateType.Normal));
                        pat.AddColorStop (0, color1);
                        color1.R *= 1.2;
                        color1.G *= 1.2;
                        color1.B *= 1.2;
                        pat.AddColorStop (1, color1);
                        cr.Pattern = pat;
                        cr.FillPreserve ();
                    }
                }
            }
            else
                Gtk.Style.PaintExtension (Style, GdkWindow, st, ShadowType.Out, evnt.Area, this, "tab", rect.X, rect.Y, rect.Width, rect.Height, Gtk.PositionType.Top);
        }
예제 #3
0
파일: TabStrip.cs 프로젝트: rdafoe/Cage
        public void AddTab(Gtk.Widget page, Gdk.Pixbuf icon, string label)
        {
            Tab tab = new Tab ();
            tab.SetLabel (page, icon, label);
            tab.ShowAll ();
            box.PackStart (tab, true, true, 0);
            if (currentTab == -1)
                CurrentTab = box.Children.Length - 1;
            else {
                tab.Active = false;
                page.Hide ();
            }

            tab.ButtonPressEvent += OnTabPress;
        }