コード例 #1
0
        public FilterControl()
        {
            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    RelativeSizeAxes = Axes.Both,
                },
                new FlowContainer
                {
                    Padding          = new MarginPadding(20),
                    AutoSizeAxes     = Axes.Y,
                    RelativeSizeAxes = Axes.X,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Width            = 0.4f, // TODO: InnerWidth property or something
                    Direction        = FlowDirections.Vertical,
                    Children         = new Drawable[]
                    {
                        searchTextBox = new SearchTextBox {
                            RelativeSizeAxes = Axes.X
                        },
                        new GroupSortTabs()
                    }
                }
            };

            searchTextBox.OnChange += (TextBox sender, bool newText) =>
            {
                if (newText)
                {
                    FilterChanged?.Invoke();
                }
            };
            searchTextBox.Exit = () => Exit?.Invoke();
        }
コード例 #2
0
        public FilterControl()
        {
            Children = new Drawable[]
            {
                Background = new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    RelativeSizeAxes = Axes.Both,
                },
                new Container
                {
                    Padding          = new MarginPadding(20),
                    RelativeSizeAxes = Axes.Both,
                    Width            = 0.5f,
                    Anchor           = Anchor.TopRight,
                    Origin           = Anchor.TopRight,
                    Children         = new Drawable[]
                    {
                        searchTextBox = new SearchTextBox
                        {
                            RelativeSizeAxes = Axes.X,
                            Exit             = () => Exit?.Invoke(),
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 1,
                            Colour           = OsuColour.Gray(80),
                            Origin           = Anchor.BottomLeft,
                            Anchor           = Anchor.BottomLeft,
                        },
                        new FillFlowContainer
                        {
                            Anchor           = Anchor.BottomRight,
                            Origin           = Anchor.BottomRight,
                            Direction        = FillDirection.Horizontal,
                            RelativeSizeAxes = Axes.X,
                            AutoSizeAxes     = Axes.Y,
                            Children         = new Drawable[]
                            {
                                groupTabs = new OsuTabControl <GroupMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 24,
                                    Width            = 0.5f,
                                    AutoSort         = true
                                },
                                //spriteText = new OsuSpriteText
                                //{
                                //    Font = @"Exo2.0-Bold",
                                //    Text = "Sort results by",
                                //    Size = 14,
                                //    Margin = new MarginPadding
                                //    {
                                //        Top = 5,
                                //        Bottom = 5
                                //    },
                                //},
                                sortTabs = new OsuTabControl <SortMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Width            = 0.5f,
                                    Height           = 24,
                                    AutoSort         = true,
                                }
                            }
                        },
                    }
                }
            };

            searchTextBox.Current.ValueChanged += t => FilterChanged?.Invoke(CreateCriteria());

            groupTabs.PinItem(GroupMode.All);
            groupTabs.PinItem(GroupMode.RecentlyPlayed);
            groupTabs.Current.ValueChanged += val => Group = val;
            sortTabs.Current.ValueChanged  += val => Sort = val;
        }
コード例 #3
0
ファイル: FilterControl.cs プロジェクト: maniacs-games/osu
        public FilterControl()
        {
            Children = new Drawable[]
            {
                new Box
                {
                    Colour           = Color4.Black,
                    Alpha            = 0.8f,
                    RelativeSizeAxes = Axes.Both,
                },
                new Container
                {
                    Padding            = new MarginPadding(20),
                    AlwaysReceiveInput = true,
                    RelativeSizeAxes   = Axes.Both,
                    Width    = 0.5f,
                    Anchor   = Anchor.TopRight,
                    Origin   = Anchor.TopRight,
                    Children = new Drawable[]
                    {
                        searchTextBox = new SearchTextBox
                        {
                            RelativeSizeAxes = Axes.X,
                            OnChange         = (sender, newText) =>
                            {
                                if (newText)
                                {
                                    FilterChanged?.Invoke();
                                }
                            },
                            Exit = () => Exit?.Invoke(),
                        },
                        new Box
                        {
                            RelativeSizeAxes = Axes.X,
                            Height           = 1,
                            Colour           = OsuColour.Gray(80),
                            Origin           = Anchor.BottomLeft,
                            Anchor           = Anchor.BottomLeft,
                        },
                        new FillFlowContainer
                        {
                            Anchor             = Anchor.BottomRight,
                            Origin             = Anchor.BottomRight,
                            Direction          = FillDirection.Horizontal,
                            RelativeSizeAxes   = Axes.X,
                            AutoSizeAxes       = Axes.Y,
                            AlwaysReceiveInput = true,
                            Children           = new Drawable[]
                            {
                                groupTabs = new OsuTabControl <GroupMode>
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Height           = 24,
                                    Width            = 0.5f,
                                    AutoSort         = true
                                },
                                //spriteText = new OsuSpriteText
                                //{
                                //    Font = @"Exo2.0-Bold",
                                //    Text = "Sort results by",
                                //    TextSize = 14,
                                //    Margin = new MarginPadding
                                //    {
                                //        Top = 5,
                                //        Bottom = 5
                                //    },
                                //},
                                sortTabs = new OsuTabControl <SortMode>()
                                {
                                    RelativeSizeAxes = Axes.X,
                                    Width            = 0.5f,
                                    Height           = 24,
                                    AutoSort         = true,
                                }
                            }
                        },
                    }
                }
            };

            groupTabs.PinItem(GroupMode.All);
            groupTabs.PinItem(GroupMode.RecentlyPlayed);
            groupTabs.ItemChanged += (sender, value) => Group = value;
            sortTabs.ItemChanged  += (sender, value) => Sort = value;
        }