1 | #include <Window.h>
|
---|
2 | #include <View.h>
|
---|
3 | #include <Bitmap.h>
|
---|
4 | #include <Screen.h>
|
---|
5 | #include <TranslationUtils.h>
|
---|
6 | #include <Application.h>
|
---|
7 |
|
---|
8 | #define kVBLlogoWidth 200
|
---|
9 | #define kVBLlogoHeight 200
|
---|
10 |
|
---|
11 |
|
---|
12 | class SplashScreen : public BWindow
|
---|
13 | {
|
---|
14 | public:
|
---|
15 | SplashScreen();
|
---|
16 | ~SplashScreen();
|
---|
17 | virtual void WindowActivated(bool active);
|
---|
18 | private:
|
---|
19 | BView *splashView;
|
---|
20 | BBitmap *splashBitmap;
|
---|
21 | };
|
---|
22 |
|
---|
23 | SplashScreen::SplashScreen()
|
---|
24 | : BWindow(BRect(0, 0, kVBLlogoWidth - 1, kVBLlogoHeight + 1), "SplashScreen", B_BORDERED_WINDOW,
|
---|
25 | B_NOT_CLOSABLE | B_NOT_RESIZABLE | B_NOT_MOVABLE | B_NOT_ZOOMABLE)
|
---|
26 | {
|
---|
27 | BScreen *theScreen = new BScreen(this);
|
---|
28 | BRect screenRect = theScreen->Frame();
|
---|
29 |
|
---|
30 | MoveTo(screenRect.Width() / 2 - Frame().Width() / 2, screenRect.Height() / 2 - Frame().Height() / 2);
|
---|
31 | delete theScreen;
|
---|
32 | }
|
---|
33 |
|
---|
34 | void SplashScreen::WindowActivated(bool active)
|
---|
35 | {
|
---|
36 | if (active)
|
---|
37 | {
|
---|
38 | BRect rect = Bounds();
|
---|
39 | splashView = new BView(rect, "splashview", B_FOLLOW_ALL_SIDES, B_WILL_DRAW);
|
---|
40 | AddChild(splashView);
|
---|
41 | splashBitmap = BTranslationUtils::GetBitmap("Marzi4.jpg");
|
---|
42 | splashView->SetViewBitmap(splashBitmap);
|
---|
43 | }
|
---|
44 | }
|
---|
45 |
|
---|
46 | SplashScreen::~SplashScreen()
|
---|
47 | {
|
---|
48 |
|
---|
49 | }
|
---|
50 |
|
---|
51 | class SplashApp : public BApplication
|
---|
52 | {
|
---|
53 | public:
|
---|
54 | SplashApp() : BApplication("application/SplashScreen")
|
---|
55 | {
|
---|
56 | SplashScreen* s = new SplashScreen();
|
---|
57 | s->Show();
|
---|
58 |
|
---|
59 | sleep(10);
|
---|
60 |
|
---|
61 | s->Lock();
|
---|
62 | s->Close();
|
---|
63 | }
|
---|
64 | };
|
---|
65 |
|
---|
66 | int main(void)
|
---|
67 | {
|
---|
68 | SplashApp* a = new SplashApp();
|
---|
69 | a->Run();
|
---|
70 |
|
---|
71 | delete a;
|
---|
72 |
|
---|
73 | return 0;
|
---|
74 | }
|
---|