repository_infos: Enable automatic updates on the main Haiku repostiory.
[haiku.git] / src / apps / haikudepot / ui / ScreenshotWindow.h
blobe96ca02f04d4af12b4f8063a64330762c37e12e2
1 /*
2 * Copyright 2014, Stephan Aßmus <superstippi@gmx.de>.
3 * All rights reserved. Distributed under the terms of the MIT License.
4 */
5 #ifndef SCREENSHOT_WINDOW_H
6 #define SCREENSHOT_WINDOW_H
8 #include <Locker.h>
9 #include <Messenger.h>
10 #include <ToolBar.h>
11 #include <Window.h>
13 #include "PackageInfo.h"
16 class BarberPole;
17 class BitmapView;
18 class BStringView;
21 enum {
22 MSG_NEXT_SCREENSHOT = 'nscr',
23 MSG_PREVIOUS_SCREENSHOT = 'pscr',
24 MSG_DOWNLOAD_START = 'dlst',
25 MSG_DOWNLOAD_STOP = 'dlsp',
29 class ScreenshotWindow : public BWindow {
30 public:
31 ScreenshotWindow(BWindow* parent, BRect frame);
32 virtual ~ScreenshotWindow();
34 virtual bool QuitRequested();
36 virtual void MessageReceived(BMessage* message);
38 void SetOnCloseMessage(
39 const BMessenger& messenger,
40 const BMessage& message);
42 void SetPackage(const PackageInfoRef& package);
44 static void CleanupIcons();
46 private:
47 void _DownloadScreenshot();
49 void _SetWorkerThread(thread_id thread);
51 static int32 _DownloadThreadEntry(void* data);
52 void _DownloadThread();
54 void _ResizeToFitAndCenter();
55 void _UpdateToolBar();
57 private:
58 enum {
59 kProgressIndicatorDelay = 200000 // us
62 private:
63 BMessenger fOnCloseTarget;
64 BMessage fOnCloseMessage;
66 BToolBar* fToolBar;
67 BarberPole* fBarberPole;
68 bool fBarberPoleShown;
69 BStringView* fIndexView;
71 BitmapRef fScreenshot;
72 BitmapView* fScreenshotView;
74 int32 fCurrentScreenshotIndex; // atomic
76 PackageInfoRef fPackage;
77 bool fDownloadPending;
79 BLocker fLock;
80 thread_id fWorkerThread;
84 #endif // SCREENSHOT_WINDOW_H