-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDialog.cpp
42 lines (33 loc) · 909 Bytes
/
Dialog.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Copyright 2013, Kacper Kasper, [email protected]
* Copyright 2010, Milos Pejovic
* All rights reserved. Distributed under the terms of the MIT License.
*/
#include "Dialog.h"
#include "IconPanel.h"
#include "utils.h"
void
Dialog::CenterOnScreen()
{
center_on_screen(this);
}
Dialog::Dialog(BString const & title, BString const & windowIcon,
float width, float height)
:
BWindow(BRect(0, 0, width, height), title.String(), B_TITLED_WINDOW,
B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS)
{
SetLayout(new BGroupLayout(B_HORIZONTAL, 0));
if (windowIcon.Length() > 0) {
IconPanel *iconPanel = new IconPanel(windowIcon);
AddChild(iconPanel);
GetLayout()->ItemAt(0)->SetExplicitMaxSize(
BSize(kBorderWidth + kBorderMargin, B_SIZE_UNLIMITED));
}
}
bool
Dialog::QuitRequested()
{
be_app->PostMessage(MSG_CANCEL_CLICKED);
return true;
}