Tracker: Style fixes to NavMenu.h

Pointer style, whitespace.

Convert TrackingHookData from a class to a struct (all members public)
This commit is contained in:
John Scipione 2014-07-22 22:23:02 -04:00
parent 2660268936
commit 0cf10e9dce

View File

@ -49,6 +49,7 @@ All rights reserved.
template<class T> class BObjectList; template<class T> class BObjectList;
class BMenuItem; class BMenuItem;
namespace BPrivate { namespace BPrivate {
class Model; class Model;
@ -57,94 +58,94 @@ class ModelMenuItem;
class EntryListBase; class EntryListBase;
class TrackingHookData { struct TrackingHookData {
public: TrackingHookData()
TrackingHookData() :
: fTrackingHook(NULL),
fTrackingHook(NULL), fDragMessage(NULL)
fDragMessage(NULL) {
{ }
}
bool (*fTrackingHook)(BMenu *, void *); bool (*fTrackingHook)(BMenu*, void*);
BMessenger fTarget; BMessenger fTarget;
const BMessage *fDragMessage; const BMessage* fDragMessage;
}; };
class BNavMenu : public BSlowMenu { class BNavMenu : public BSlowMenu {
public: public:
BNavMenu(const char* title, uint32 message, const BHandler *, BNavMenu(const char* title, uint32 message, const BHandler*,
BWindow *parentWindow = NULL, const BObjectList<BString> *list = NULL); BWindow* parentWindow = NULL, const BObjectList<BString>* list = NULL);
BNavMenu(const char* title, uint32 message, const BMessenger &, BNavMenu(const char* title, uint32 message, const BMessenger&,
BWindow *parentWindow = NULL, const BObjectList<BString> *list = NULL); BWindow* parentWindow = NULL, const BObjectList<BString>* list = NULL);
// parentWindow, if specified, will be closed if nav menu item invoked // parentWindow, if specified, will be closed if nav menu item invoked
// with option held down // with option held down
virtual ~BNavMenu(); virtual ~BNavMenu();
virtual void AttachedToWindow(); virtual void AttachedToWindow();
virtual void DetachedFromWindow(); virtual void DetachedFromWindow();
void SetNavDir(const entry_ref *); void SetNavDir(const entry_ref*);
void ForceRebuild(); void ForceRebuild();
bool NeedsToRebuild() const; bool NeedsToRebuild() const;
// will cause menu to get rebuilt next time it is shown // will cause menu to get rebuilt next time it is shown
virtual void ResetTargets(); virtual void ResetTargets();
void SetTarget(const BMessenger &); void SetTarget(const BMessenger&);
BMessenger Target(); BMessenger Target();
void SetTypesList(const BObjectList<BString> *list); void SetTypesList(const BObjectList<BString>* list);
const BObjectList<BString> *TypesList() const; const BObjectList<BString>* TypesList() const;
void AddNavDir(const Model *model, uint32 what, BHandler *target, void AddNavDir(const Model* model, uint32 what, BHandler* target,
bool populateSubmenu); bool populateSubmenu);
void AddNavParentDir(const char *name, const Model *model, uint32 what, BHandler *target); void AddNavParentDir(const char* name, const Model* model, uint32 what,
void AddNavParentDir(const Model *model, uint32 what, BHandler *target); BHandler* target);
void SetShowParent(bool show); void AddNavParentDir(const Model* model, uint32 what, BHandler* target);
void SetShowParent(bool show);
static int32 GetMaxMenuWidth(); static int32 GetMaxMenuWidth();
static int CompareFolderNamesFirstOne(const BMenuItem *, const BMenuItem *); static int CompareFolderNamesFirstOne(const BMenuItem*, const BMenuItem*);
static int CompareOne(const BMenuItem *, const BMenuItem *); static int CompareOne(const BMenuItem*, const BMenuItem*);
static ModelMenuItem *NewModelItem(Model *, const BMessage *, const BMessenger &, static ModelMenuItem* NewModelItem(Model*, const BMessage*,
bool suppressFolderHierarchy=false, BContainerWindow * = NULL, const BMessenger&, bool suppressFolderHierarchy = false,
const BObjectList<BString> *typeslist = NULL, BContainerWindow* = NULL, const BObjectList<BString>* typeslist = NULL,
TrackingHookData *hook = NULL); TrackingHookData* hook = NULL);
TrackingHookData *InitTrackingHook(bool (*hookfunction)(BMenu *, void *), TrackingHookData* InitTrackingHook(bool (*hookfunction)(BMenu*, void*),
const BMessenger *target, const BMessage *dragMessage); const BMessenger* target, const BMessage* dragMessage);
protected: protected:
virtual bool StartBuildingItemList(); virtual bool StartBuildingItemList();
virtual bool AddNextItem(); virtual bool AddNextItem();
virtual void DoneBuildingItemList(); virtual void DoneBuildingItemList();
virtual void ClearMenuBuildingState(); virtual void ClearMenuBuildingState();
void BuildVolumeMenu(); void BuildVolumeMenu();
void AddOneItem(Model *); void AddOneItem(Model*);
void AddRootItemsIfNeeded(); void AddRootItemsIfNeeded();
void AddTrashItem(); void AddTrashItem();
static void SetTrackingHookDeep(BMenu *, bool (*)(BMenu *, void *), void *); static void SetTrackingHookDeep(BMenu*, bool (*)(BMenu*, void*), void*);
entry_ref fNavDir; entry_ref fNavDir;
BMessage fMessage; BMessage fMessage;
BMessenger fMessenger; BMessenger fMessenger;
BWindow *fParentWindow; BWindow* fParentWindow;
// menu building state // menu building state
uint8 fFlags; uint8 fFlags;
BObjectList<BMenuItem> *fItemList; BObjectList<BMenuItem>* fItemList;
EntryListBase *fContainer; EntryListBase* fContainer;
bool fIteratingDesktop; bool fIteratingDesktop;
BObjectList<BString> *fTypesList; BObjectList<BString>* fTypesList;
TrackingHookData fTrackingHook; TrackingHookData fTrackingHook;
}; };
// Spring Loaded Folder convenience routines // Spring Loaded Folder convenience routines
@ -165,4 +166,5 @@ _IMPEXP_TRACKER void SpringLoadedFolderCacheDragData(const BMessage *incoming,
using namespace BPrivate; using namespace BPrivate;
#endif // NAV_MENU_H #endif // NAV_MENU_H