Example #1
0
        private void Instantiate()
        {
            // Containers
            _container  = new VBox(false, 3);
            _menu       = new MenuBar();
            StatusLabel = new Label();
            Statusbar   = new Statusbar()
            {
                StatusLabel
            };

            // Menu bar
            _fileMenu = new Menu();
            _helpMenu = new Menu();
            _file     = new MenuItem("File");
            _help     = new MenuItem("Help");
            _sync     = new MenuItem("Synchronize");
            _settings = new MenuItem("Preferences");
            _close    = new MenuItem("Close");
            _quit     = new MenuItem("Quit");
            _about    = new MenuItem("About " + Program.AppName);
            _updates  = new MenuItem("Check for Updates");

            // Sidebar
            _pane    = new HPaned();
            _store   = new TreeStore(typeof(Pixbuf), typeof(string));
            _sidebar = new TreeView(_store);
            _column  = new TreeViewColumn();

            // Notebook
            _nb             = new Notebook();
            AnimeBox        = new AnimeWindow();
            _mangaBox       = new VBox();
            _nullAccountBox = new NullAccountWindow();
            _defaultSearch  = new VBox();
            AnimeSearch     = new AnimeSearchWindow();
            _mangaSearch    = new SearchWindow();
        }
Example #2
0
        internal AnimeTreeView(AnimeWindow parent)
        {
            _parent = parent;
            Store   = new ListStore(typeof(Anime));
            Filter  = new TreeModelFilter(Store, null)
            {
                VisibleFunc = FilterTree
            };
            Model = Filter;
            Store.SetSortFunc((int)TreeColumns.Title, CompareTitle);             // sort by title by default

            // Create our columns
            _title = new TreeViewColumn()
            {
                Title        = "Title",
                Resizable    = true,
                Clickable    = true,
                SortColumnId = (int)TreeColumns.Title
            };
            _title.Clicked += TitleClicked;
            _title.PackStart(new CellRendererText(), true);
            _title.SetCellDataFunc(_title.CellRenderers[0], RenderTitle);
            AppendColumn(_title);

            _episode = new TreeViewColumn()
            {
                Title        = "Episode",
                Resizable    = true,
                Clickable    = true,
                SortColumnId = (int)TreeColumns.Episode
            };
            _episode.Clicked += EpisodeClicked;
            _episode.PackStart(new CellRendererText(), true);
            _episode.SetCellDataFunc(_episode.CellRenderers[0], RenderEpisode);
            AppendColumn(_episode);

            _progress = new TreeViewColumn()
            {
                Title = "Progress", SortColumnId = (int)TreeColumns.Progress
            };
            _progress.PackStart(new CellRendererProgress(), true);
            _progress.SetCellDataFunc(_progress.CellRenderers[0], RenderProgress);
            AppendColumn(_progress);

            _score = new TreeViewColumn()
            {
                Title        = "Score",
                Resizable    = true,
                Clickable    = true,
                SortColumnId = (int)TreeColumns.Score
            };
            _score.Clicked += ScoreClicked;
            _score.PackStart(new CellRendererText(), true);
            _score.SetCellDataFunc(_score.CellRenderers[0], RenderScore);
            AppendColumn(_score);

            _type = new TreeViewColumn()
            {
                Title        = "Type",
                Resizable    = true,
                Clickable    = true,
                SortColumnId = (int)TreeColumns.Type
            };
            _type.Clicked += TypeClicked;
            _type.PackStart(new CellRendererText(), true);
            _type.SetCellDataFunc(_type.CellRenderers[0], RenderAnimeType);
            AppendColumn(_type);

            _season = new TreeViewColumn()
            {
                Title        = "Season",
                Resizable    = true,
                Clickable    = true,
                SortColumnId = (int)TreeColumns.Season
            };
            _season.Clicked += SeasonClicked;
            _season.PackStart(new CellRendererText(), true);
            _season.SetCellDataFunc(_season.CellRenderers[0], RenderSeason);
            AppendColumn(_season);

            _next = new TreeViewColumn()
            {
                Title        = "Status",
                Resizable    = true,
                Clickable    = true,
                SortColumnId = (int)TreeColumns.NextEp
            };
            _next.PackStart(new CellRendererText(), true);
            _next.SetCellDataFunc(_next.CellRenderers[0], RenderNextEpisode);
            AppendColumn(_next);

            RowActivated += OnRowActivated;
        }