fc23c09758
Add methods to get and set "Always on top", "Auto raise", and "auto hide" which are all booleans which control aspects of the Deskbar window to BDeskbar. Set the bool to the default value initially. Check if sending the message succeeds, if so check the reply which also fills out the bool. Don't check to see if reply succeeded because the bool will only be overwritten if it did. Follow the BDeskbar convention Is...() for getter, Set...() for setter e.g IsAlwaysOnTop() is the getter, SetAlwaysOnTop() is the setter. Define new message constants to call the newly created methods. Follow BDeskbar convention: 'gtla' is used for getter, 'stla' for setter. g/s for getter/setter, tla is an all-lowercase code unique to each getter/setter pair. Copy/paste these message constants into BarApp.h unchanged. Replace four letter codes with imported message constants in BarApp.cpp and BarWindow.cpp. Much nicer than using bare codes. The new BDeskbar methods are all handled by TBarApp. The getters send back a reply message containing the bool while the setters fall through to existing setter cases.
74 lines
1.6 KiB
C++
74 lines
1.6 KiB
C++
/*
|
|
* Copyright 2006-2009, Haiku, Inc. All rights reserved.
|
|
* Distributed under the terms of the MIT License.
|
|
*/
|
|
#ifndef _DESKBAR_H
|
|
#define _DESKBAR_H
|
|
|
|
|
|
#include <Rect.h>
|
|
|
|
|
|
class BMessenger;
|
|
class BView;
|
|
struct entry_ref;
|
|
|
|
|
|
enum deskbar_location {
|
|
B_DESKBAR_TOP,
|
|
B_DESKBAR_BOTTOM,
|
|
B_DESKBAR_LEFT_TOP,
|
|
B_DESKBAR_RIGHT_TOP,
|
|
B_DESKBAR_LEFT_BOTTOM,
|
|
B_DESKBAR_RIGHT_BOTTOM
|
|
};
|
|
|
|
|
|
class BDeskbar {
|
|
public:
|
|
BDeskbar();
|
|
~BDeskbar();
|
|
|
|
bool IsRunning() const;
|
|
|
|
// 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);
|
|
|
|
bool IsAlwaysOnTop() const;
|
|
status_t SetAlwaysOnTop(bool alwaysOnTop);
|
|
|
|
bool IsAutoRaise() const;
|
|
status_t SetAutoRaise(bool autoRaise);
|
|
|
|
bool IsAutoHide() const;
|
|
status_t SetAutoHide(bool autoHide);
|
|
|
|
// 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 methods
|
|
status_t AddItem(BView* archivableView,
|
|
int32* _id = NULL);
|
|
status_t AddItem(entry_ref* addOn, int32* _id = NULL);
|
|
status_t RemoveItem(int32 id);
|
|
status_t RemoveItem(const char* name);
|
|
|
|
private:
|
|
BMessenger* fMessenger;
|
|
uint32 _reserved[12];
|
|
};
|
|
|
|
|
|
#endif // _DESKBAR_H
|