BDeskbar: Style fixes

Update Copyright in cpp, add myself, alphabetize, standardize
Pointer style in cpp
Update some comments
Some 80 char stuff
pragma section headers
whitespace
This commit is contained in:
John Scipione
2017-11-26 20:40:00 -08:00
parent b1b84675f0
commit f8811591e1
2 changed files with 46 additions and 28 deletions
+10 -7
View File
@@ -8,6 +8,7 @@
#include <Rect.h>
class BMessenger;
class BView;
struct entry_ref;
@@ -22,6 +23,7 @@ enum deskbar_location {
B_DESKBAR_RIGHT_BOTTOM
};
class BDeskbar {
public:
BDeskbar();
@@ -29,24 +31,24 @@ public:
bool IsRunning() const;
// Location member functions
// Location methods
BRect Frame() const;
deskbar_location Location(bool* _isExpanded = NULL) const;
status_t SetLocation(deskbar_location location,
bool expanded = false);
// Other state methods
bool IsExpanded() const;
status_t Expand(bool expand);
// Item querying member functions
status_t GetItemInfo(int32 id,
const char** _name) const;
status_t GetItemInfo(const char* name,
int32* _id) const;
// Item querying methods
status_t GetItemInfo(int32 id, const char** _name) const;
status_t GetItemInfo(const char* name, int32* _id) const;
bool HasItem(int32 id) const;
bool HasItem(const char* name) const;
uint32 CountItems() const;
// Item modification member functions
// Item modification methods
status_t AddItem(BView* archivableView,
int32* _id = NULL);
status_t AddItem(entry_ref* addOn, int32* _id = NULL);
@@ -58,4 +60,5 @@ private:
uint32 _reserved[12];
};
#endif // _DESKBAR_H
+25 -10
View File
@@ -1,11 +1,12 @@
/*
* Copyright 2001-2005, Haiku.
* Copyright 2001-2017 Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License.
*
* Authors:
* Jeremy Rand ([email protected])
* Jérôme Duval
* Axel Dörfler
* Jeremy Rand, [email protected]
* John Scipione, [email protected]
*/
@@ -19,6 +20,7 @@
#include <string.h>
// ToDo: in case the BDeskbar methods are called from a Deskbar add-on,
// they will currently deadlock most of the time (only those that do
// not need a reply will work).
@@ -28,6 +30,7 @@
// The API in this file should be considered as part of OpenTracker - but
// should work with all versions of Tracker available for Haiku.
static const char* kDeskbarSignature = "application/x-vnd.Be-TSKB";
static const uint32 kMsgAddView = 'icon';
@@ -62,11 +65,12 @@ get_deskbar_frame(BRect *frame)
}
// #pragma mark -
// #pragma mark - BDeskbar
BDeskbar::BDeskbar()
: fMessenger(new BMessenger(kDeskbarSignature))
:
fMessenger(new BMessenger(kDeskbarSignature))
{
}
@@ -84,6 +88,9 @@ BDeskbar::IsRunning() const
}
// #pragma mark - Item querying methods
BRect
BDeskbar::Frame() const
{
@@ -115,8 +122,7 @@ BDeskbar::Location(bool *_isExpanded) const
if (reply.FindInt32("location", &value) == B_OK)
location = static_cast<deskbar_location>(value);
if (_isExpanded
&& reply.FindBool("expanded", _isExpanded) != B_OK)
if (_isExpanded && reply.FindBool("expanded", _isExpanded) != B_OK)
*_isExpanded = true;
}
@@ -135,16 +141,20 @@ BDeskbar::SetLocation(deskbar_location location, bool expanded)
}
// #pragma mark - Other state methods
bool
BDeskbar::IsExpanded(void) const
BDeskbar::IsExpanded() const
{
BMessage request(kMsgIsExpanded);
BMessage reply;
bool isExpanded;
if (fMessenger->SendMessage(&request, &reply) != B_OK
|| reply.FindBool("expanded", &isExpanded) != B_OK)
|| reply.FindBool("expanded", &isExpanded) != B_OK) {
isExpanded = true;
}
return isExpanded;
}
@@ -160,6 +170,9 @@ BDeskbar::Expand(bool expand)
}
// #pragma mark - Item querying methods
status_t
BDeskbar::GetItemInfo(int32 id, const char** _name) const
{
@@ -184,6 +197,7 @@ BDeskbar::GetItemInfo(int32 id, const char **_name) const
result = B_NO_MEMORY;
}
}
return result;
}
@@ -247,6 +261,9 @@ BDeskbar::CountItems(void) const
}
// #pragma mark - Item querying methods
status_t
BDeskbar::AddItem(BView* view, int32* _id)
{
@@ -315,6 +332,4 @@ BDeskbar::RemoveItem(const char *name)
// message was sent to the Deskbar
return fMessenger->SendMessage(&request);
}