Top100
Your Personal Movie List (C++17 CLI + library)
Loading...
Searching...
No Matches
rankdialog.h
1// SPDX-License-Identifier: Apache-2.0
2//-------------------------------------------------------------------------------
3// File: ui/gtk/rankdialog.h
4// Purpose: GTK dialog for pairwise ranking of movies.
5//-------------------------------------------------------------------------------
6#pragma once
7
8#include <gtkmm.h>
9//#include <gdkmm/cursor.h>
10
11class Top100GtkRankDialog : public Gtk::Dialog {
12public:
13 Top100GtkRankDialog(Gtk::Window& parent);
14private:
15 // Containers to size posters consistently
16 Gtk::Box* left_box_ { nullptr };
17 Gtk::Box* right_box_ { nullptr };
18 Gtk::EventBox* left_click_ { nullptr };
19 Gtk::EventBox* right_click_ { nullptr };
20
21 Gtk::Label heading_;
22 Gtk::Label prompt_;
23
24 Gtk::Label left_title_;
25 Gtk::Label left_details_;
26 Gtk::Image left_poster_;
27
28 Gtk::Label right_title_;
29 Gtk::Label right_details_;
30 Gtk::Image right_poster_;
31
32 Gtk::Button pass_btn_ {"Pass"};
33 Gtk::Button finish_btn_ {"Finish Ranking"};
34
35 int left_index_ { -1 };
36 int right_index_ { -1 };
37
38 void pick_two();
39 void refresh_side(bool left);
40 void choose_left();
41 void choose_right();
42 void pass_pair();
43
44 // Poster helpers
45 Glib::RefPtr<Gdk::Pixbuf> left_orig_;
46 Glib::RefPtr<Gdk::Pixbuf> right_orig_;
47 static Glib::RefPtr<Gdk::Pixbuf> scale_pixbuf(const Glib::RefPtr<Gdk::Pixbuf>& src, int maxW, int maxH);
48 void update_scaled_posters();
49 void load_poster_async_for(Gtk::Image& image, Glib::RefPtr<Gdk::Pixbuf>& store, const std::string& url);
50
51 // Click handlers
52 bool on_left_click(GdkEventButton*);
53 bool on_right_click(GdkEventButton*);
54
55 // Hover handlers to set hand cursor
56 bool on_left_enter(GdkEventCrossing*);
57 bool on_left_leave(GdkEventCrossing*);
58 bool on_right_enter(GdkEventCrossing*);
59 bool on_right_leave(GdkEventCrossing*);
60};
61
62// Helper to open dialog (for toolbar wiring)
63void gtk_open_rank_dialog(Gtk::Window& parent);
Definition rankdialog.h:11