BTRFS: Implement BTree::Path and change _Find.
[haiku.git] / src / apps / switcher / Switcher.cpp
blob929c3023f745d382d1bfa9eb0565fc813ab5d992
1 /*
2 * Copyright 2011, Axel Dörfler, axeld@pinc-software.de.
3 * Distributed under the terms of the MIT License.
4 */
7 #include "Switcher.h"
9 #include <stdlib.h>
11 #include <Application.h>
12 #include <Catalog.h>
14 #include "CaptureWindow.h"
15 #include "PanelWindow.h"
18 #undef B_TRANSLATION_CONTEXT
19 #define B_TRANSLATION_CONTEXT "Switcher"
22 const char* kSignature = "application/x-vnd.Haiku-Switcher";
25 Switcher::Switcher()
27 BApplication(kSignature),
28 fOccupiedLocations(0)
33 Switcher::~Switcher()
38 void
39 Switcher::ReadyToRun()
41 CaptureWindow* window = new CaptureWindow();
42 window->Run();
44 fCaptureMessenger = window;
48 void
49 Switcher::MessageReceived(BMessage* message)
51 switch (message->what) {
52 case kMsgLocationTrigger:
54 uint32 location = (uint32)message->FindInt32("location");
55 if ((location & fOccupiedLocations) == 0) {
56 // TODO: make function configurable
57 uint32 which = kShowApplicationWindows;
58 if ((location & (kTopEdge | kBottomEdge)) != 0)
59 which = kShowApplications;
61 new PanelWindow(location, which,
62 (team_id)message->FindInt32("team"));
63 fOccupiedLocations |= location;
65 break;
68 case kMsgLocationFree:
70 uint32 location;
71 if (message->FindInt32("location", (int32*)&location) == B_OK)
72 fOccupiedLocations &= ~location;
73 break;
76 case kMsgHideWhenMouseMovedOut:
77 fCaptureMessenger.SendMessage(message);
78 break;
80 default:
81 BApplication::MessageReceived(message);
82 break;
87 // #pragma mark -
90 int
91 main(int /*argc*/, char** /*argv*/)
93 Switcher app;
94 app.Run();
96 return 0;