Top100
Your Personal Movie List (C++17 CLI + library)
Loading...
Searching...
No Matches
window.h
1// SPDX-License-Identifier: Apache-2.0
2//-------------------------------------------------------------------------------
3// Top100 — Your Personal Movie List
4//
5// File: ui/gtk/window.h
6// Purpose: Declaration of the GTK (gtkmm) main window and its components.
7// Language: C++17 (gtkmm-3)
8//-------------------------------------------------------------------------------
9#pragma once
10
11#include <gtkmm.h>
12#include <glibmm/refptr.h>
13#include <string>
14#include <vector>
15
16namespace Gdk { class Pixbuf; }
17
18class Top100GtkWindow : public Gtk::Window {
19public:
21
22private:
23 // Model columns for list
24 class Columns : public Gtk::TreeModel::ColumnRecord {
25 public:
26 Columns() { add(text); add(index); add(imdb); }
27 Gtk::TreeModelColumn<Glib::ustring> text;
28 Gtk::TreeModelColumn<int> index; // row index for retrieval
29 Gtk::TreeModelColumn<Glib::ustring> imdb; // imdb id
30 } columns_;
31
32 // Root layout
33 Gtk::Box main_box_{Gtk::ORIENTATION_VERTICAL};
34 Gtk::MenuBar menubar_;
35 Glib::RefPtr<Gtk::AccelGroup> accel_group_;
36 Gtk::Toolbar toolbar_;
37 Gtk::Statusbar statusbar_;
38 guint status_ctx_movies_ { 0 };
39 Gtk::Paned paned_{Gtk::ORIENTATION_HORIZONTAL};
40
41 // Left pane
42 Gtk::Box left_box_{Gtk::ORIENTATION_VERTICAL};
43 Gtk::Box sort_box_{Gtk::ORIENTATION_HORIZONTAL};
44 Gtk::Label sort_label_;
45 Gtk::ComboBoxText sort_combo_;
46 Glib::RefPtr<Gtk::ListStore> list_store_;
47 Gtk::TreeView list_view_;
48
49 // Right pane
50 Gtk::Box right_box_{Gtk::ORIENTATION_VERTICAL};
51 Gtk::Label title_label_;
52 Gtk::Grid details_grid_;
53 Gtk::Label director_label_, director_value_;
54 Gtk::Label actors_label_, actors_value_;
55 Gtk::Label genres_label_, genres_value_;
56 Gtk::Label runtime_label_, runtime_value_;
57 Gtk::Label imdb_label_;
58 Gtk::LinkButton imdb_link_;
59 Gtk::Image poster_;
60 Gtk::TextView plot_view_;
61 Glib::RefPtr<Gdk::Pixbuf> poster_pixbuf_original_;
62 std::string current_imdb_id_;
63
64 // --- Helpers split across implementation files ---
65 // menu.cpp
66 void build_menubar();
67 void on_menu_quit();
68 void on_menu_about();
69
70 // toolbar.cpp
71 void build_toolbar();
72 Gtk::ToolButton* btn_add_ { nullptr };
73 Gtk::ToolButton* btn_delete_ { nullptr };
74 Gtk::ToolButton* btn_refresh_ { nullptr };
75 Gtk::ToolButton* btn_update_ { nullptr };
76
77 // poster.cpp
78 void update_poster_scaled();
79 void load_poster_async(const std::string& url, const std::string& imdb);
80
81 // handlers.cpp
82 void show_status(const std::string& msg);
83 void add_form_row(int row, Gtk::Label& lbl, Gtk::Label& val);
84 Glib::ustring current_selected_imdb();
85 void reload_model(const Glib::ustring& select_imdb = {});
86 void on_selection_changed();
87 void on_delete_current();
88 void on_update_current();
89 void on_add_movie();
90 static std::string join(const std::vector<std::string>& v, const std::string& sep);
91 void update_status_movie_count();
92};
Definition window.h:18