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/haiku/window.h
6// Purpose: Haiku (BeAPI) main window declaration.
7//-------------------------------------------------------------------------------
8#pragma once
9
10#ifdef __HAIKU__
11#include <Window.h>
12#include <Message.h>
13
14#include <string>
15#include <vector>
16#include <optional>
17
18class BView;
19class BListView;
20class BStringView;
21class BTextView;
22class BScrollView;
23class BMenuBar;
24class BMenuField;
25class BPopUpMenu;
26class BButton;
27class BSplitView;
28class CompareDialog;
29
30class Top100HaikuWindow : public BWindow {
31public:
32 Top100HaikuWindow();
33 bool QuitRequested() override;
34 void MessageReceived(BMessage* msg) override;
35
36private:
37 // Messages
38 enum {
39 kMsgListSelection = 'lsel',
40 kMsgSortChanged = 'srtC',
41 kMsgOpenImdb = 'oimb',
42 kMsgDoAdd = 'addM',
43 kMsgDoDelete = 'delM',
44 kMsgDoRefresh = 'rfrs',
45 kMsgDoUpdate = 'updm',
46 kMsgDoRank = 'rank'
47 };
48
49 // Message from Add dialog when user confirms
50 static constexpr uint32 kMsgAddByImdbOk = 'adbk';
51
52 // Layout
53 BMenuBar* menubar_ = nullptr;
54 BSplitView* split_ = nullptr;
55 // Left
56 BView* leftBox_ = nullptr;
57 BStringView* moviesHdr_ = nullptr;
58 BMenuField* sortField_ = nullptr;
59 BPopUpMenu* sortMenu_ = nullptr;
60 BListView* listView_ = nullptr;
61 BScrollView* listScroll_ = nullptr;
62 // Right
63 BView* rightBox_ = nullptr;
64 BStringView* detailsHdr_ = nullptr;
65 BStringView* titleLabel_ = nullptr;
66 BStringView* directorLabel_= nullptr;
67 BStringView* directorValue_= nullptr;
68 BStringView* actorsLabel_ = nullptr;
69 BStringView* actorsValue_ = nullptr;
70 BStringView* genresLabel_ = nullptr;
71 BStringView* genresValue_ = nullptr;
72 BStringView* runtimeLabel_ = nullptr;
73 BStringView* runtimeValue_ = nullptr;
74 BStringView* imdbLabel_ = nullptr;
75 BButton* imdbButton_ = nullptr;
76 // Top action buttons (simple toolbar row)
77 BButton* addBtn_ = nullptr;
78 BButton* delBtn_ = nullptr;
79 BButton* refreshBtn_ = nullptr;
80 BButton* updateBtn_ = nullptr;
81 BView* posterView_ = nullptr;
82 BTextView* plotText_ = nullptr;
83 BScrollView* plotScroll_ = nullptr;
84 // Footer
85 BStringView* statusLabel_ = nullptr;
86
87 // Data map: list row -> imdb id
88 std::vector<std::string> imdbForRow_;
89
90 // Helpers
91 void BuildLayout();
92 void BuildMenu();
93 void RebuildSortMenu(int currentIndex);
94 void ReloadModel(const std::string& selectImdb = std::string());
95 void UpdateDetails(int rowIndex);
96 void UpdateStatusCount();
97 void SetSortOrder(int idx);
98 static std::string Join(const std::vector<std::string>& v, const std::string& sep);
99};
100
101#endif // __HAIKU__