2 * Copyright 2006, Haiku.
3 * Distributed under the terms of the MIT License.
6 * Stephan Aßmus <superstippi@gmx.de>
13 #include <InterfaceDefs.h>
15 #include <MessageFilter.h>
17 class EscapeFilter
: public BMessageFilter
{
19 EscapeFilter(Panel
* target
)
20 : BMessageFilter(B_ANY_DELIVERY
, B_ANY_SOURCE
),
24 virtual ~EscapeFilter()
27 virtual filter_result
Filter(BMessage
* message
, BHandler
** target
)
29 filter_result result
= B_DISPATCH_MESSAGE
;
30 switch (message
->what
) {
32 case B_UNMAPPED_KEY_DOWN
: {
34 if (message
->FindInt32("raw_char", (int32
*)&key
) >= B_OK
) {
35 if (key
== B_ESCAPE
) {
36 result
= B_SKIP_MESSAGE
;
52 Panel::Panel(BRect frame
, const char* title
,
53 window_type type
, uint32 flags
,
55 : BWindow(frame
, title
, type
, flags
, workspace
)
61 Panel::Panel(BRect frame
, const char* title
,
62 window_look look
, window_feel feel
,
63 uint32 flags
, uint32 workspace
)
64 : BWindow(frame
, title
, look
, feel
, flags
, workspace
)
78 PostMessage(B_QUIT_REQUESTED
);
83 Panel::_InstallFilter()
85 AddCommonFilter(new EscapeFilter(this));