Exemplo n.º 1
0
        public LauncherWidget()
        {
            var tb = new Entry("");
            tb.SetIconFromIconName(EntryIconPosition.Secondary, "search");
            tb.Changed += (s, e) => {
                ShowSearch(tb.Text);
            };

            tb.KeyReleaseEvent += (s, e) => {
                if (e.Event.Key == Gdk.Key.Return && appListStore.NColumns != 0) { //TODO: appListStore.NColumns does not work
                    hpaned.Child1.ChildFocus(DirectionType.TabForward);
                }
                if (e.Event.Key == Gdk.Key.Escape) {
                    Parent.Hide(); //TODO: detect Window
                }
            };

            tb.Margin = 5;
            //tb.BorderWidth = 1;
            PackStart(tb, false, false, 0);

            hpaned = new HPaned();

            Add(hpaned);

            /*Add(CreateList());
            Add(CreateList());*/

            var appList = CreateAppList();
            hpaned.Add1(appList);
            hpaned.Add2(CreateCatList());

            ShowAllApps();

            ShowAll();
            allButton.Active = true;
            lastActiveButton = allButton;
        }
Exemplo n.º 2
0
        private Widget CreateCatList()
        {
            var scroll = new ScrolledWindow();
            var box = new VBox();
            scroll.Add(box);

            var tb = new Toolbar();

            tb.Orientation = Orientation.Vertical;
            tb.ToolbarStyle = ToolbarStyle.BothHoriz;
            tb.ShowArrow = false;

            box.Add(tb);

            allButton = createCatButton(TLauncherIndex.Current.catHash["All"]);
            tb.Add(allButton);

            tb.Add(new SeparatorToolItem());

            foreach (var entry in TLauncherIndex.Current.Categories)
                if (!entry.meta)
                    tb.Add(createCatButton(entry));

            var noneButton = createCatButton(TLauncherIndex.Current.catHash["None"]);
            tb.Add(noneButton);

            var frame = new Frame();
            frame.Add(scroll);
            return frame;
        }
Exemplo n.º 3
0
        private ToggleButton2 createCatButton(TLauncherCategory entry)
        {
            var bt = new  ToggleButton2("");

            var b = new HBox();
            var l = new Label(entry.Name);
            b.PackStart(l, false, false, 0);
            l.Justify = Justification.Left;

            bt.LabelWidget = b;

            if (entry.HasIcon) {
                if (Environment.OSVersion.Platform == PlatformID.Unix)
                    bt.IconName = entry.IconName;
                //bt.IconWidget = new Image();

            }

            /*			bt.Mode = true;
            bt.HeightRequest = 40;
            bt.Entered += (s, e) => {
                if (!bt.Active)
                    bt.Mode = false;
            };
            bt.LeaveNotifyEvent += (s, e) => {
                if (!bt.Active)
                    bt.Mode = true;
            };*/
            bt.Clicked += (s, e) => {
                //return;
            };

            bt.Toggled += (s, e) => {
                if (inToggle)
                    return;
                else
                    inToggle = true;

                try {
                    foreach (var catButton in catButtons) {
                        if (catButton != bt)
                            catButton.Active = false;
                    }
                    bt.Active = true;

                    ShowCategory(entry);
                    lastActiveButton = bt;

                } finally {
                    inToggle = false;
                }
            };

            //bt.MarginLeft = 2;
            //bt.MarginRight = 2;

            bt.Margin = 1;

            catButtons.Add(bt);
            return bt;
        }