* Fix 'missing braces around initializer for 'property_info'' warning
* Style cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37361 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -11,6 +11,9 @@
|
|||||||
* Pier Luigi Fiorini, [email protected]
|
* Pier Luigi Fiorini, [email protected]
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include "NotificationWindow.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#include <Alert.h>
|
#include <Alert.h>
|
||||||
@@ -23,16 +26,20 @@
|
|||||||
#include "AppGroupView.h"
|
#include "AppGroupView.h"
|
||||||
#include "AppUsage.h"
|
#include "AppUsage.h"
|
||||||
#include "BorderView.h"
|
#include "BorderView.h"
|
||||||
#include "NotificationWindow.h"
|
|
||||||
|
|
||||||
property_info main_prop_list[] = {
|
property_info main_prop_list[] = {
|
||||||
{ "message", {B_GET_PROPERTY, 0}, {B_INDEX_SPECIFIER, 0}, "get a message"},
|
{"message", {B_GET_PROPERTY, 0}, {B_INDEX_SPECIFIER, 0}, "get a message"},
|
||||||
{ "message", {B_COUNT_PROPERTIES, 0}, {B_DIRECT_SPECIFIER, 0}, "count messages"},
|
{"message", {B_COUNT_PROPERTIES, 0}, {B_DIRECT_SPECIFIER, 0},
|
||||||
{ "message", {B_CREATE_PROPERTY, 0}, {B_DIRECT_SPECIFIER, 0}, "create a message"},
|
"count messages"},
|
||||||
{ "message", {B_SET_PROPERTY, 0}, {B_INDEX_SPECIFIER, 0 }, "modify a message" },
|
{"message", {B_CREATE_PROPERTY, 0}, {B_DIRECT_SPECIFIER, 0},
|
||||||
0
|
"create a message"},
|
||||||
|
{"message", {B_SET_PROPERTY, 0}, {B_INDEX_SPECIFIER, 0},
|
||||||
|
"modify a message"},
|
||||||
|
{0}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const float kCloseSize = 8;
|
const float kCloseSize = 8;
|
||||||
const float kExpandSize = 8;
|
const float kExpandSize = 8;
|
||||||
const float kPenSize = 1;
|
const float kPenSize = 1;
|
||||||
@@ -142,12 +149,14 @@ NotificationWindow::MessageReceived(BMessage* message)
|
|||||||
messageOkay = false;
|
messageOkay = false;
|
||||||
if (message->FindString("title", &title) != B_OK)
|
if (message->FindString("title", &title) != B_OK)
|
||||||
messageOkay = false;
|
messageOkay = false;
|
||||||
if (message->FindString("app", &app) != B_OK && message->FindString("appTitle", &app) != B_OK)
|
if (message->FindString("app", &app) != B_OK
|
||||||
|
&& message->FindString("appTitle", &app) != B_OK)
|
||||||
messageOkay = false;
|
messageOkay = false;
|
||||||
|
|
||||||
if (messageOkay) {
|
if (messageOkay) {
|
||||||
NotificationView* view = new NotificationView(this, (notification_type)type, app,
|
NotificationView* view = new NotificationView(this,
|
||||||
title, content, new BMessage(*message));
|
(notification_type)type, app, title, content,
|
||||||
|
new BMessage(*message));
|
||||||
|
|
||||||
appfilter_t::iterator fIt = fAppFilters.find(app);
|
appfilter_t::iterator fIt = fAppFilters.find(app);
|
||||||
bool allow = false;
|
bool allow = false;
|
||||||
@@ -170,14 +179,14 @@ NotificationWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
if (allow) {
|
if (allow) {
|
||||||
appview_t::iterator aIt = fAppViews.find(app);
|
appview_t::iterator aIt = fAppViews.find(app);
|
||||||
AppGroupView *group = NULL;
|
AppGroupView* group = NULL;
|
||||||
if (aIt == fAppViews.end()) {
|
if (aIt == fAppViews.end()) {
|
||||||
group = new AppGroupView(this, app);
|
group = new AppGroupView(this, app);
|
||||||
fAppViews[app] = group;
|
fAppViews[app] = group;
|
||||||
fBorder->AddChild(group);
|
fBorder->AddChild(group);
|
||||||
} else {
|
} else
|
||||||
group = aIt->second;
|
group = aIt->second;
|
||||||
};
|
|
||||||
group->AddInfo(view);
|
group->AddInfo(view);
|
||||||
|
|
||||||
ResizeAll();
|
ResizeAll();
|
||||||
@@ -220,8 +229,8 @@ NotificationWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
|
|
||||||
BHandler*
|
BHandler*
|
||||||
NotificationWindow::ResolveSpecifier(BMessage *msg, int32 index,
|
NotificationWindow::ResolveSpecifier(BMessage* msg, int32 index,
|
||||||
BMessage *spec, int32 form, const char *prop)
|
BMessage* spec, int32 form, const char* prop)
|
||||||
{
|
{
|
||||||
BPropertyInfo prop_info(main_prop_list);
|
BPropertyInfo prop_info(main_prop_list);
|
||||||
BHandler* handler = NULL;
|
BHandler* handler = NULL;
|
||||||
@@ -279,7 +288,6 @@ NotificationWindow::Timeout()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
infoview_layout
|
infoview_layout
|
||||||
NotificationWindow::Layout()
|
NotificationWindow::Layout()
|
||||||
{
|
{
|
||||||
@@ -307,7 +315,7 @@ NotificationWindow::ResizeAll()
|
|||||||
bool shouldHide = true;
|
bool shouldHide = true;
|
||||||
|
|
||||||
for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
|
for (aIt = fAppViews.begin(); aIt != fAppViews.end(); aIt++) {
|
||||||
AppGroupView *app = aIt->second;
|
AppGroupView* app = aIt->second;
|
||||||
if (app->HasChildren()) {
|
if (app->HasChildren()) {
|
||||||
shouldHide = false;
|
shouldHide = false;
|
||||||
break;
|
break;
|
||||||
@@ -365,43 +373,43 @@ NotificationWindow::PopupAnimation(float width, float height)
|
|||||||
case B_DESKBAR_TOP:
|
case B_DESKBAR_TOP:
|
||||||
// Put it just under, top right corner
|
// Put it just under, top right corner
|
||||||
sx = frame.right;
|
sx = frame.right;
|
||||||
sy = frame.bottom+pad;
|
sy = frame.bottom + pad;
|
||||||
y = sy;
|
y = sy;
|
||||||
x = sx-width-pad;
|
x = sx - width - pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_BOTTOM:
|
case B_DESKBAR_BOTTOM:
|
||||||
// Put it just above, lower left corner
|
// Put it just above, lower left corner
|
||||||
sx = frame.right;
|
sx = frame.right;
|
||||||
sy = frame.top-height-pad;
|
sy = frame.top - height - pad;
|
||||||
y = sy;
|
y = sy;
|
||||||
x = sx - width-pad;
|
x = sx - width - pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_LEFT_TOP:
|
case B_DESKBAR_LEFT_TOP:
|
||||||
// Put it just to the right of the deskbar
|
// Put it just to the right of the deskbar
|
||||||
sx = frame.right+pad;
|
sx = frame.right + pad;
|
||||||
sy = frame.top-height;
|
sy = frame.top - height;
|
||||||
x = sx;
|
x = sx;
|
||||||
y = frame.top+pad;
|
y = frame.top + pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_RIGHT_TOP:
|
case B_DESKBAR_RIGHT_TOP:
|
||||||
// Put it just to the left of the deskbar
|
// Put it just to the left of the deskbar
|
||||||
sx = frame.left-width-pad;
|
sx = frame.left - width - pad;
|
||||||
sy = frame.top-height;
|
sy = frame.top - height;
|
||||||
x = sx;
|
x = sx;
|
||||||
y = frame.top+pad;
|
y = frame.top + pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_LEFT_BOTTOM:
|
case B_DESKBAR_LEFT_BOTTOM:
|
||||||
// Put it to the right of the deskbar.
|
// Put it to the right of the deskbar.
|
||||||
sx = frame.right+pad;
|
sx = frame.right + pad;
|
||||||
sy = frame.bottom;
|
sy = frame.bottom;
|
||||||
x = sx;
|
x = sx;
|
||||||
y = sy-height-pad;
|
y = sy - height - pad;
|
||||||
break;
|
break;
|
||||||
case B_DESKBAR_RIGHT_BOTTOM:
|
case B_DESKBAR_RIGHT_BOTTOM:
|
||||||
// Put it to the left of the deskbar.
|
// Put it to the left of the deskbar.
|
||||||
sx = frame.left-width-pad;
|
sx = frame.left - width - pad;
|
||||||
sy = frame.bottom;
|
sy = frame.bottom;
|
||||||
y = sy-height-pad;
|
y = sy - height - pad;
|
||||||
x = sx;
|
x = sx;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -412,7 +420,7 @@ NotificationWindow::PopupAnimation(float width, float height)
|
|||||||
|
|
||||||
if (IsHidden() && fViews.size() != 0)
|
if (IsHidden() && fViews.size() != 0)
|
||||||
Show();
|
Show();
|
||||||
//Activate();// it hides floaters from apps :-(
|
// Activate();// it hides floaters from apps :-(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user