Use the handy B_CLOSE_ON_ESCAPE flag instead of fishing for the escape key in

DispatchMessage().


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32419 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-08-15 17:02:21 +00:00
parent 4e4ff20294
commit e8cbd8db5d
2 changed files with 3 additions and 19 deletions

View File

@ -21,7 +21,9 @@ const uint32 MSG_FIND_HIDE = 'Fhid';
FindWindow::FindWindow (BRect frame, BMessenger messenger , BString &str,
bool findSelection, bool matchWord, bool matchCase, bool forwardSearch)
: BWindow(frame, "Find", B_FLOATING_WINDOW, B_NOT_RESIZABLE|B_NOT_ZOOMABLE),
:
BWindow(frame, "Find", B_FLOATING_WINDOW,
B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_CLOSE_ON_ESCAPE),
fFindDlgMessenger(messenger)
{
AddShortcut((ulong)'W', (ulong)B_COMMAND_KEY, new BMessage(MSG_FIND_HIDE));
@ -138,23 +140,6 @@ FindWindow::MessageReceived(BMessage *msg)
}
void
FindWindow::DispatchMessage(BMessage *message, BHandler *handler)
{
if (message->what == B_KEY_DOWN) {
int8 key;
if (message->FindInt8("byte", 0, &key) == B_OK) {
if (key == B_ESCAPE) {
message->MakeEmpty();
message->what = B_QUIT_REQUESTED;
}
}
}
BWindow::DispatchMessage(message, handler);
}
void
FindWindow::Quit()
{

View File

@ -29,7 +29,6 @@ class FindWindow : public BWindow {
virtual void Quit();
virtual void MessageReceived(BMessage *msg);
virtual void DispatchMessage(BMessage* message, BHandler* handler);
private:
void _SendFindMessage();