Tracker: style fixes to ContainerWindow
This commit is contained in:
@@ -167,7 +167,7 @@ ActivateWindowFilter(BMessage*, BHandler** target, BMessageFilter*)
|
|||||||
|
|
||||||
// activate the window if no PoseView or DraggableContainerIcon had been
|
// activate the window if no PoseView or DraggableContainerIcon had been
|
||||||
// pressed (those will activate the window themselves, if necessary)
|
// pressed (those will activate the window themselves, if necessary)
|
||||||
if (view
|
if (view != NULL
|
||||||
&& !dynamic_cast<BPoseView*>(view)
|
&& !dynamic_cast<BPoseView*>(view)
|
||||||
&& !dynamic_cast<DraggableContainerIcon*>(view)
|
&& !dynamic_cast<DraggableContainerIcon*>(view)
|
||||||
&& view->Window())
|
&& view->Window())
|
||||||
@@ -310,7 +310,7 @@ AddMimeTypeString(BObjectList<BString> &list, Model* model)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - DraggableContainerIcon
|
||||||
|
|
||||||
|
|
||||||
DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char* name,
|
DraggableContainerIcon::DraggableContainerIcon(BRect rect, const char* name,
|
||||||
@@ -519,7 +519,7 @@ DraggableContainerIcon::Draw(BRect updateRect)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - BContainerWindow
|
||||||
|
|
||||||
|
|
||||||
BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
|
BContainerWindow::BContainerWindow(LockingList<BWindow>* list,
|
||||||
@@ -1064,7 +1064,7 @@ BContainerWindow::RestoreStateCommon()
|
|||||||
WindowStateNodeOpener opener(this, false);
|
WindowStateNodeOpener opener(this, false);
|
||||||
|
|
||||||
bool isDesktop = dynamic_cast<BDeskWindow*>(this) != NULL;
|
bool isDesktop = dynamic_cast<BDeskWindow*>(this) != NULL;
|
||||||
if (!TargetModel()->IsRoot() && opener.Node()) {
|
if (!TargetModel()->IsRoot() && opener.Node() != NULL) {
|
||||||
// don't pick up background image for root disks
|
// don't pick up background image for root disks
|
||||||
// to do this, would have to have a unique attribute for the
|
// to do this, would have to have a unique attribute for the
|
||||||
// disks window that doesn't collide with the desktop
|
// disks window that doesn't collide with the desktop
|
||||||
@@ -1115,7 +1115,7 @@ BContainerWindow::UpdateBackgroundImage()
|
|||||||
bool isDesktop = dynamic_cast<BDeskWindow*>(this) != NULL;
|
bool isDesktop = dynamic_cast<BDeskWindow*>(this) != NULL;
|
||||||
WindowStateNodeOpener opener(this, false);
|
WindowStateNodeOpener opener(this, false);
|
||||||
|
|
||||||
if (!TargetModel()->IsRoot() && opener.Node()) {
|
if (!TargetModel()->IsRoot() && opener.Node() != NULL) {
|
||||||
fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage,
|
fBackgroundImage = BackgroundImage::Refresh(fBackgroundImage,
|
||||||
opener.Node(), isDesktop, PoseView());
|
opener.Node(), isDesktop, PoseView());
|
||||||
}
|
}
|
||||||
@@ -1225,7 +1225,7 @@ BContainerWindow::SaveState(bool hide)
|
|||||||
{
|
{
|
||||||
if (SaveStateIsEnabled()) {
|
if (SaveStateIsEnabled()) {
|
||||||
WindowStateNodeOpener opener(this, true);
|
WindowStateNodeOpener opener(this, true);
|
||||||
if (opener.StreamNode())
|
if (opener.StreamNode() != NULL)
|
||||||
SaveWindowState(opener.StreamNode());
|
SaveWindowState(opener.StreamNode());
|
||||||
|
|
||||||
if (hide)
|
if (hide)
|
||||||
@@ -1729,6 +1729,7 @@ BContainerWindow::MessageReceived(BMessage* message)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
_inherited::MessageReceived(message);
|
_inherited::MessageReceived(message);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -1742,13 +1743,15 @@ BContainerWindow::MessageReceived(BMessage* message)
|
|||||||
FSUndo();
|
FSUndo();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
//case B_REDO: // only defined in Dano/Zeta/OpenBeOS
|
//case B_REDO:
|
||||||
|
// only defined in Dano/Zeta/OpenBeOS
|
||||||
case kRedo:
|
case kRedo:
|
||||||
FSRedo();
|
FSRedo();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
_inherited::MessageReceived(message);
|
_inherited::MessageReceived(message);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3185,10 +3188,10 @@ BContainerWindow::UpdateMenu(BMenu* menu, UpdateMenuContext context)
|
|||||||
EnableNamedMenuItem(menu, B_SELECT_ALL, count > 0);
|
EnableNamedMenuItem(menu, B_SELECT_ALL, count > 0);
|
||||||
|
|
||||||
BMenuItem* item = menu->FindItem(B_TRANSLATE("New"));
|
BMenuItem* item = menu->FindItem(B_TRANSLATE("New"));
|
||||||
if (item) {
|
if (item != NULL) {
|
||||||
TemplatesMenu* templateMenu = dynamic_cast<TemplatesMenu*>
|
TemplatesMenu* templateMenu = dynamic_cast<TemplatesMenu*>
|
||||||
(item->Submenu());
|
(item->Submenu());
|
||||||
if (templateMenu)
|
if (templateMenu != NULL)
|
||||||
templateMenu->UpdateMenuState();
|
templateMenu->UpdateMenuState();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -3661,9 +3664,10 @@ BContainerWindow::NeedsDefaultStateSetup()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
WindowStateNodeOpener opener(this, false);
|
WindowStateNodeOpener opener(this, false);
|
||||||
if (!opener.StreamNode())
|
if (opener.StreamNode() == NULL) {
|
||||||
// can't read state, give up
|
// can't read state, give up
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !NodeHasSavedState(opener.Node());
|
return !NodeHasSavedState(opener.Node());
|
||||||
}
|
}
|
||||||
@@ -3736,7 +3740,7 @@ BContainerWindow::SetUpDefaultState()
|
|||||||
|
|
||||||
WindowStateNodeOpener opener(this, true);
|
WindowStateNodeOpener opener(this, true);
|
||||||
// this is our destination node, whatever it is for this window
|
// this is our destination node, whatever it is for this window
|
||||||
if (!opener.StreamNode())
|
if (opener.StreamNode() == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!TargetModel()->IsRoot()) {
|
if (!TargetModel()->IsRoot()) {
|
||||||
@@ -3806,7 +3810,7 @@ BContainerWindow::SetUpDefaultState()
|
|||||||
void
|
void
|
||||||
BContainerWindow::RestoreWindowState(AttributeStreamNode* node)
|
BContainerWindow::RestoreWindowState(AttributeStreamNode* node)
|
||||||
{
|
{
|
||||||
if (node == NULL || dynamic_cast<BDeskWindow*>(this)) {
|
if (node == NULL || dynamic_cast<BDeskWindow*>(this) != NULL) {
|
||||||
// don't restore any window state if we are a desktop window
|
// don't restore any window state if we are a desktop window
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4218,14 +4222,15 @@ BContainerWindow::PopulateArrangeByMenu(BMenu* menu)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - WindowStateNodeOpener
|
||||||
|
|
||||||
|
|
||||||
WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow* window,
|
WindowStateNodeOpener::WindowStateNodeOpener(BContainerWindow* window,
|
||||||
bool forWriting)
|
bool forWriting)
|
||||||
: fModelOpener(NULL),
|
:
|
||||||
fNode(NULL),
|
fModelOpener(NULL),
|
||||||
fStreamNode(NULL)
|
fNode(NULL),
|
||||||
|
fStreamNode(NULL)
|
||||||
{
|
{
|
||||||
if (window->TargetModel() && window->TargetModel()->IsRoot()) {
|
if (window->TargetModel() && window->TargetModel()->IsRoot()) {
|
||||||
BDirectory dir;
|
BDirectory dir;
|
||||||
@@ -4314,12 +4319,13 @@ WindowStateNodeOpener::Node() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark - BackgroundView
|
||||||
|
|
||||||
|
|
||||||
BackgroundView::BackgroundView(BRect frame)
|
BackgroundView::BackgroundView(BRect frame)
|
||||||
: BView(frame, "", B_FOLLOW_ALL,
|
:
|
||||||
B_FRAME_EVENTS | B_WILL_DRAW | B_PULSE_NEEDED)
|
BView(frame, "", B_FOLLOW_ALL,
|
||||||
|
B_FRAME_EVENTS | B_WILL_DRAW | B_PULSE_NEEDED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4431,4 +4437,3 @@ BackgroundView::Pulse()
|
|||||||
if (window)
|
if (window)
|
||||||
window->PulseTaskLoop();
|
window->PulseTaskLoop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+247
-227
@@ -56,14 +56,17 @@ class Model;
|
|||||||
class ModelNodeLazyOpener;
|
class ModelNodeLazyOpener;
|
||||||
class SelectionWindow;
|
class SelectionWindow;
|
||||||
|
|
||||||
|
|
||||||
#define kDefaultFolderTemplate "DefaultFolderTemplate"
|
#define kDefaultFolderTemplate "DefaultFolderTemplate"
|
||||||
|
|
||||||
|
|
||||||
extern const char* kAddOnsMenuName;
|
extern const char* kAddOnsMenuName;
|
||||||
|
|
||||||
const window_feel kPrivateDesktopWindowFeel = window_feel(1024);
|
const window_feel kPrivateDesktopWindowFeel = window_feel(1024);
|
||||||
const window_look kPrivateDesktopWindowLook = window_look(4);
|
const window_look kPrivateDesktopWindowLook = window_look(4);
|
||||||
// this is a mirror of an app server private values
|
// this is a mirror of an app server private values
|
||||||
|
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
// flags that describe opening of the window
|
// flags that describe opening of the window
|
||||||
kRestoreWorkspace = 0x1,
|
kRestoreWorkspace = 0x1,
|
||||||
@@ -72,302 +75,308 @@ enum {
|
|||||||
kRestoreDecor = 0x4
|
kRestoreDecor = 0x4
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct AddonShortcut {
|
struct AddonShortcut {
|
||||||
Model* model;
|
Model* model;
|
||||||
char key;
|
char key;
|
||||||
char defaultKey;
|
char defaultKey;
|
||||||
uint32 modifiers;
|
uint32 modifiers;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BContainerWindow : public BWindow {
|
class BContainerWindow : public BWindow {
|
||||||
public:
|
public:
|
||||||
BContainerWindow(LockingList<BWindow>* windowList,
|
BContainerWindow(LockingList<BWindow>* windowList,
|
||||||
uint32 containerWindowFlags,
|
uint32 containerWindowFlags,
|
||||||
window_look look = B_DOCUMENT_WINDOW_LOOK,
|
window_look look = B_DOCUMENT_WINDOW_LOOK,
|
||||||
window_feel feel = B_NORMAL_WINDOW_FEEL,
|
window_feel feel = B_NORMAL_WINDOW_FEEL,
|
||||||
uint32 flags = B_WILL_ACCEPT_FIRST_CLICK
|
uint32 flags = B_WILL_ACCEPT_FIRST_CLICK
|
||||||
| B_NO_WORKSPACE_ACTIVATION,
|
| B_NO_WORKSPACE_ACTIVATION,
|
||||||
uint32 workspace = B_CURRENT_WORKSPACE);
|
uint32 workspace = B_CURRENT_WORKSPACE);
|
||||||
|
|
||||||
virtual ~BContainerWindow();
|
virtual ~BContainerWindow();
|
||||||
|
|
||||||
virtual void Init(const BMessage* message = NULL);
|
virtual void Init(const BMessage* message = NULL);
|
||||||
|
|
||||||
static BRect InitialWindowRect(window_feel);
|
static BRect InitialWindowRect(window_feel);
|
||||||
|
|
||||||
virtual void Minimize(bool minimize);
|
virtual void Minimize(bool minimize);
|
||||||
virtual void Quit();
|
virtual void Quit();
|
||||||
virtual bool QuitRequested();
|
virtual bool QuitRequested();
|
||||||
|
|
||||||
virtual void UpdateIfTrash(Model*);
|
virtual void UpdateIfTrash(Model*);
|
||||||
|
|
||||||
virtual void CreatePoseView(Model*);
|
virtual void CreatePoseView(Model*);
|
||||||
|
|
||||||
virtual void ShowContextMenu(BPoint, const entry_ref*, BView*);
|
virtual void ShowContextMenu(BPoint, const entry_ref*, BView*);
|
||||||
virtual uint32 ShowDropContextMenu(BPoint);
|
virtual uint32 ShowDropContextMenu(BPoint);
|
||||||
virtual void MenusBeginning();
|
virtual void MenusBeginning();
|
||||||
virtual void MenusEnded();
|
virtual void MenusEnded();
|
||||||
virtual void MessageReceived(BMessage*);
|
virtual void MessageReceived(BMessage*);
|
||||||
virtual void FrameResized(float, float);
|
virtual void FrameResized(float, float);
|
||||||
virtual void FrameMoved(BPoint);
|
virtual void FrameMoved(BPoint);
|
||||||
virtual void Zoom(BPoint, float, float);
|
virtual void Zoom(BPoint, float, float);
|
||||||
virtual void WorkspacesChanged(uint32, uint32);
|
virtual void WorkspacesChanged(uint32, uint32);
|
||||||
|
|
||||||
// virtuals that control setup of window
|
// virtuals that control setup of window
|
||||||
virtual bool ShouldAddMenus() const;
|
virtual bool ShouldAddMenus() const;
|
||||||
virtual bool ShouldAddScrollBars() const;
|
virtual bool ShouldAddScrollBars() const;
|
||||||
virtual bool ShouldAddCountView() const;
|
virtual bool ShouldAddCountView() const;
|
||||||
|
|
||||||
virtual void CheckScreenIntersect();
|
virtual void CheckScreenIntersect();
|
||||||
|
|
||||||
bool IsTrash() const;
|
bool IsTrash() const;
|
||||||
bool InTrash() const;
|
bool InTrash() const;
|
||||||
bool IsPrintersDir() const;
|
bool IsPrintersDir() const;
|
||||||
|
|
||||||
virtual bool IsShowing(const node_ref*) const;
|
virtual bool IsShowing(const node_ref*) const;
|
||||||
virtual bool IsShowing(const entry_ref*) const;
|
virtual bool IsShowing(const entry_ref*) const;
|
||||||
|
|
||||||
void ResizeToFit();
|
void ResizeToFit();
|
||||||
|
|
||||||
Model* TargetModel() const;
|
Model* TargetModel() const;
|
||||||
BPoseView* PoseView() const;
|
BPoseView* PoseView() const;
|
||||||
BNavigator* Navigator() const;
|
BNavigator* Navigator() const;
|
||||||
|
|
||||||
virtual void SelectionChanged();
|
virtual void SelectionChanged();
|
||||||
virtual void ViewModeChanged(uint32 oldMode, uint32 newMode);
|
virtual void ViewModeChanged(uint32 oldMode, uint32 newMode);
|
||||||
|
|
||||||
virtual void RestoreState();
|
virtual void RestoreState();
|
||||||
virtual void RestoreState(const BMessage &);
|
virtual void RestoreState(const BMessage &);
|
||||||
void RestoreStateCommon();
|
void RestoreStateCommon();
|
||||||
virtual void SaveState(bool hide = true);
|
virtual void SaveState(bool hide = true);
|
||||||
virtual void SaveState(BMessage &) const;
|
virtual void SaveState(BMessage &) const;
|
||||||
void UpdateTitle();
|
void UpdateTitle();
|
||||||
|
|
||||||
bool StateNeedsSaving() const;
|
bool StateNeedsSaving() const;
|
||||||
bool SaveStateIsEnabled() const;
|
bool SaveStateIsEnabled() const;
|
||||||
void SetSaveStateEnabled(bool);
|
void SetSaveStateEnabled(bool);
|
||||||
|
|
||||||
void UpdateBackgroundImage();
|
void UpdateBackgroundImage();
|
||||||
|
|
||||||
static status_t GetLayoutState(BNode*, BMessage*);
|
static status_t GetLayoutState(BNode*, BMessage*);
|
||||||
static status_t SetLayoutState(BNode*, const BMessage*);
|
static status_t SetLayoutState(BNode*, const BMessage*);
|
||||||
// calls for inheriting window size, attribute layout, etc.
|
// calls for inheriting window size, attribute layout, etc.
|
||||||
// deprecated
|
// deprecated
|
||||||
|
|
||||||
virtual void AddMimeTypesToMenu(BMenu*);
|
virtual void AddMimeTypesToMenu(BMenu*);
|
||||||
void AddMimeTypesToMenu();
|
void AddMimeTypesToMenu();
|
||||||
virtual void MarkAttributeMenu(BMenu*);
|
virtual void MarkAttributeMenu(BMenu*);
|
||||||
void MarkAttributeMenu();
|
void MarkAttributeMenu();
|
||||||
void MarkArrangeByMenu(BMenu*);
|
void MarkArrangeByMenu(BMenu*);
|
||||||
BMenuItem* NewAttributeMenuItem(const char* label, const char* name,
|
BMenuItem* NewAttributeMenuItem(const char* label, const char* name,
|
||||||
int32 type, float width, int32 align, bool editable,
|
int32 type, float width, int32 align, bool editable,
|
||||||
bool statField);
|
bool statField);
|
||||||
BMenuItem* NewAttributeMenuItem(const char* label, const char* name,
|
BMenuItem* NewAttributeMenuItem(const char* label, const char* name,
|
||||||
int32 type, const char* displayAs, float width, int32 align,
|
int32 type, const char* displayAs, float width, int32 align,
|
||||||
bool editable, bool statField);
|
bool editable, bool statField);
|
||||||
virtual void NewAttributeMenu(BMenu*);
|
virtual void NewAttributeMenu(BMenu*);
|
||||||
|
|
||||||
void HideAttributeMenu();
|
void HideAttributeMenu();
|
||||||
void ShowAttributeMenu();
|
void ShowAttributeMenu();
|
||||||
PiggybackTaskLoop* DelayedTaskLoop();
|
PiggybackTaskLoop* DelayedTaskLoop();
|
||||||
// use for RunLater queueing
|
// use for RunLater queueing
|
||||||
void PulseTaskLoop();
|
void PulseTaskLoop();
|
||||||
// called by some view that has pulse, either BackgroundView
|
// called by some view that has pulse, either BackgroundView
|
||||||
// or BPoseView
|
// or BPoseView
|
||||||
|
|
||||||
static bool DefaultStateSourceNode(const char* name, BNode* result,
|
static bool DefaultStateSourceNode(const char* name, BNode* result,
|
||||||
bool createNew = false, bool createFolder = true);
|
bool createNew = false, bool createFolder = true);
|
||||||
|
|
||||||
// add-on iteration
|
// add-on iteration
|
||||||
void EachAddon(bool (*)(const Model*, const char*, uint32 shortcut,
|
void EachAddon(bool (*)(const Model*, const char*, uint32 shortcut,
|
||||||
uint32 modifiers, bool primary, void*), void*,
|
uint32 modifiers, bool primary, void*), void*,
|
||||||
BObjectList<BString> &);
|
BObjectList<BString> &);
|
||||||
|
|
||||||
BPopUpMenu* ContextMenu();
|
BPopUpMenu* ContextMenu();
|
||||||
|
|
||||||
// drag&drop support
|
// drag&drop support
|
||||||
status_t DragStart(const BMessage*);
|
status_t DragStart(const BMessage*);
|
||||||
void DragStop();
|
void DragStop();
|
||||||
bool Dragging() const;
|
bool Dragging() const;
|
||||||
BMessage* DragMessage() const;
|
BMessage* DragMessage() const;
|
||||||
|
|
||||||
void ShowSelectionWindow();
|
void ShowSelectionWindow();
|
||||||
|
|
||||||
void ShowNavigator(bool);
|
void ShowNavigator(bool);
|
||||||
void SetSingleWindowBrowseShortcuts(bool);
|
void SetSingleWindowBrowseShortcuts(bool);
|
||||||
|
|
||||||
void SetPathWatchingEnabled(bool);
|
void SetPathWatchingEnabled(bool);
|
||||||
bool IsPathWatchingEnabled(void) const;
|
bool IsPathWatchingEnabled(void) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual BPoseView* NewPoseView(Model*, BRect, uint32);
|
virtual BPoseView* NewPoseView(Model*, BRect, uint32);
|
||||||
// instantiate a different flavor of BPoseView for different
|
// instantiate a different flavor of BPoseView for different
|
||||||
// ContainerWindows
|
// ContainerWindows
|
||||||
|
|
||||||
virtual void RestoreWindowState(AttributeStreamNode*);
|
virtual void RestoreWindowState(AttributeStreamNode*);
|
||||||
virtual void RestoreWindowState(const BMessage &);
|
virtual void RestoreWindowState(const BMessage &);
|
||||||
virtual void SaveWindowState(AttributeStreamNode*);
|
virtual void SaveWindowState(AttributeStreamNode*);
|
||||||
virtual void SaveWindowState(BMessage&) const;
|
virtual void SaveWindowState(BMessage&) const;
|
||||||
|
|
||||||
virtual bool NeedsDefaultStateSetup();
|
virtual bool NeedsDefaultStateSetup();
|
||||||
virtual void SetUpDefaultState();
|
virtual void SetUpDefaultState();
|
||||||
// these two virtuals control setting up a new folder that
|
// these two virtuals control setting up a new folder that
|
||||||
// does not have any state settings yet with the default
|
// does not have any state settings yet with the default
|
||||||
|
|
||||||
virtual void AddMenus();
|
virtual void AddMenus();
|
||||||
virtual void AddShortcuts();
|
virtual void AddShortcuts();
|
||||||
// add equivalents of the menu shortcuts to the menuless
|
// add equivalents of the menu shortcuts to the menuless
|
||||||
// desktop window
|
// desktop window
|
||||||
virtual void AddFileMenu(BMenu* menu);
|
virtual void AddFileMenu(BMenu* menu);
|
||||||
virtual void AddWindowMenu(BMenu* menu);
|
virtual void AddWindowMenu(BMenu* menu);
|
||||||
|
|
||||||
virtual void AddContextMenus();
|
virtual void AddContextMenus();
|
||||||
|
|
||||||
virtual void AddFileContextMenus(BMenu*);
|
virtual void AddFileContextMenus(BMenu*);
|
||||||
virtual void AddWindowContextMenus(BMenu*);
|
virtual void AddWindowContextMenus(BMenu*);
|
||||||
virtual void AddVolumeContextMenus(BMenu*);
|
virtual void AddVolumeContextMenus(BMenu*);
|
||||||
virtual void AddDropContextMenus(BMenu*);
|
virtual void AddDropContextMenus(BMenu*);
|
||||||
virtual void AddTrashContextMenus(BMenu*);
|
virtual void AddTrashContextMenus(BMenu*);
|
||||||
|
|
||||||
virtual void RepopulateMenus();
|
virtual void RepopulateMenus();
|
||||||
void PopulateArrangeByMenu(BMenu*);
|
void PopulateArrangeByMenu(BMenu*);
|
||||||
|
|
||||||
virtual void SetCutItem(BMenu*);
|
virtual void SetCutItem(BMenu*);
|
||||||
virtual void SetCopyItem(BMenu*);
|
virtual void SetCopyItem(BMenu*);
|
||||||
virtual void SetPasteItem(BMenu*);
|
virtual void SetPasteItem(BMenu*);
|
||||||
virtual void SetArrangeMenu(BMenu*);
|
virtual void SetArrangeMenu(BMenu*);
|
||||||
virtual void SetCloseItem(BMenu*);
|
virtual void SetCloseItem(BMenu*);
|
||||||
virtual void SetupNavigationMenu(const entry_ref*, BMenu*);
|
virtual void SetupNavigationMenu(const entry_ref*, BMenu*);
|
||||||
virtual void SetupMoveCopyMenus(const entry_ref*, BMenu*);
|
virtual void SetupMoveCopyMenus(const entry_ref*, BMenu*);
|
||||||
virtual void PopulateMoveCopyNavMenu(BNavMenu*, uint32,
|
virtual void PopulateMoveCopyNavMenu(BNavMenu*, uint32,
|
||||||
const entry_ref*, bool);
|
const entry_ref*, bool);
|
||||||
|
|
||||||
virtual void SetupOpenWithMenu(BMenu*);
|
virtual void SetupOpenWithMenu(BMenu*);
|
||||||
virtual void SetUpEditQueryItem(BMenu*);
|
virtual void SetUpEditQueryItem(BMenu*);
|
||||||
virtual void SetUpDiskMenu(BMenu*);
|
virtual void SetUpDiskMenu(BMenu*);
|
||||||
|
|
||||||
virtual void BuildAddOnMenu(BMenu*);
|
virtual void BuildAddOnMenu(BMenu*);
|
||||||
void BuildMimeTypeList(BObjectList<BString>& mimeTypes);
|
void BuildMimeTypeList(BObjectList<BString>& mimeTypes);
|
||||||
|
|
||||||
enum UpdateMenuContext {
|
enum UpdateMenuContext {
|
||||||
kMenuBarContext,
|
kMenuBarContext,
|
||||||
kPosePopUpContext,
|
kPosePopUpContext,
|
||||||
kWindowPopUpContext
|
kWindowPopUpContext
|
||||||
};
|
};
|
||||||
|
|
||||||
virtual void UpdateMenu(BMenu* menu, UpdateMenuContext context);
|
virtual void UpdateMenu(BMenu* menu, UpdateMenuContext context);
|
||||||
|
|
||||||
BMenu* AddMimeMenu(const BMimeType& mimeType, bool isSuperType,
|
BMenu* AddMimeMenu(const BMimeType& mimeType, bool isSuperType,
|
||||||
BMenu* menu, int32 start);
|
BMenu* menu, int32 start);
|
||||||
|
|
||||||
BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, int32,
|
BHandler* ResolveSpecifier(BMessage*, int32, BMessage*, int32,
|
||||||
const char*);
|
const char*);
|
||||||
|
|
||||||
bool EachAddon(BPath &path,
|
bool EachAddon(BPath &path,
|
||||||
bool (*)(const Model*, const char*, uint32, bool, void*),
|
bool (*)(const Model*, const char*, uint32, bool, void*),
|
||||||
BObjectList<Model>*, void*, BObjectList<BString> &);
|
BObjectList<Model>*, void*, BObjectList<BString> &);
|
||||||
void LoadAddOn(BMessage*);
|
void LoadAddOn(BMessage*);
|
||||||
|
|
||||||
BPopUpMenu* fFileContextMenu;
|
BPopUpMenu* fFileContextMenu;
|
||||||
BPopUpMenu* fWindowContextMenu;
|
BPopUpMenu* fWindowContextMenu;
|
||||||
BPopUpMenu* fDropContextMenu;
|
BPopUpMenu* fDropContextMenu;
|
||||||
BPopUpMenu* fVolumeContextMenu;
|
BPopUpMenu* fVolumeContextMenu;
|
||||||
BPopUpMenu* fTrashContextMenu;
|
BPopUpMenu* fTrashContextMenu;
|
||||||
BSlowContextMenu* fDragContextMenu;
|
BSlowContextMenu* fDragContextMenu;
|
||||||
BMenuItem* fMoveToItem;
|
BMenuItem* fMoveToItem;
|
||||||
BMenuItem* fCopyToItem;
|
BMenuItem* fCopyToItem;
|
||||||
BMenuItem* fCreateLinkItem;
|
BMenuItem* fCreateLinkItem;
|
||||||
BMenuItem* fOpenWithItem;
|
BMenuItem* fOpenWithItem;
|
||||||
ModelMenuItem* fNavigationItem;
|
ModelMenuItem* fNavigationItem;
|
||||||
BMenuBar* fMenuBar;
|
BMenuBar* fMenuBar;
|
||||||
BNavigator* fNavigator;
|
BNavigator* fNavigator;
|
||||||
BPoseView* fPoseView;
|
BPoseView* fPoseView;
|
||||||
LockingList<BWindow>* fWindowList;
|
LockingList<BWindow>* fWindowList;
|
||||||
BMenu* fAttrMenu;
|
BMenu* fAttrMenu;
|
||||||
BMenu* fWindowMenu;
|
BMenu* fWindowMenu;
|
||||||
BMenu* fFileMenu;
|
BMenu* fFileMenu;
|
||||||
BMenu* fArrangeByMenu;
|
BMenu* fArrangeByMenu;
|
||||||
|
|
||||||
SelectionWindow* fSelectionWindow;
|
SelectionWindow* fSelectionWindow;
|
||||||
|
|
||||||
PiggybackTaskLoop* fTaskLoop;
|
PiggybackTaskLoop* fTaskLoop;
|
||||||
|
|
||||||
bool fIsTrash;
|
bool fIsTrash;
|
||||||
bool fInTrash;
|
bool fInTrash;
|
||||||
bool fIsPrinters;
|
bool fIsPrinters;
|
||||||
|
|
||||||
uint32 fContainerWindowFlags;
|
uint32 fContainerWindowFlags;
|
||||||
BackgroundImage* fBackgroundImage;
|
BackgroundImage* fBackgroundImage;
|
||||||
|
|
||||||
static LockingList<struct AddonShortcut>* fAddonsList;
|
static LockingList<struct AddonShortcut>* fAddonsList;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BRect fSavedZoomRect;
|
BRect fSavedZoomRect;
|
||||||
BRect fPreviousBounds;
|
BRect fPreviousBounds;
|
||||||
|
|
||||||
static BRect sNewWindRect;
|
static BRect sNewWindRect;
|
||||||
|
|
||||||
BPopUpMenu* fContextMenu;
|
BPopUpMenu* fContextMenu;
|
||||||
BMessage* fDragMessage;
|
BMessage* fDragMessage;
|
||||||
BObjectList<BString>* fCachedTypesList;
|
BObjectList<BString>* fCachedTypesList;
|
||||||
bool fWaitingForRefs;
|
bool fWaitingForRefs;
|
||||||
|
|
||||||
bool fStateNeedsSaving;
|
bool fStateNeedsSaving;
|
||||||
bool fSaveStateIsEnabled;
|
bool fSaveStateIsEnabled;
|
||||||
|
|
||||||
bool fIsWatchingPath;
|
bool fIsWatchingPath;
|
||||||
|
|
||||||
typedef BWindow _inherited;
|
typedef BWindow _inherited;
|
||||||
|
|
||||||
friend int32 show_context_menu(void*);
|
friend int32 show_context_menu(void*);
|
||||||
friend class BackgroundView;
|
friend class BackgroundView;
|
||||||
|
|
||||||
void _UpdateSelectionMIMEInfo();
|
void _UpdateSelectionMIMEInfo();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class WindowStateNodeOpener {
|
class WindowStateNodeOpener {
|
||||||
// this class manages opening and closing the proper node for
|
// this class manages opening and closing the proper node for
|
||||||
// state restoring / saving; the constructor knows how to decide whether
|
// state restoring / saving; the constructor knows how to decide whether
|
||||||
// to use a special directory for root, etc.
|
// to use a special directory for root, etc.
|
||||||
// setter calls used when no attributes can be read from a node and
|
// setter calls used when no attributes can be read from a node and
|
||||||
// defaults are to be substituted
|
// defaults are to be substituted
|
||||||
public:
|
public:
|
||||||
WindowStateNodeOpener(BContainerWindow* window, bool forWriting);
|
WindowStateNodeOpener(BContainerWindow* window, bool forWriting);
|
||||||
virtual ~WindowStateNodeOpener();
|
virtual ~WindowStateNodeOpener();
|
||||||
|
|
||||||
void SetTo(const BDirectory*);
|
void SetTo(const BDirectory*);
|
||||||
void SetTo(const BEntry* entry, bool forWriting);
|
void SetTo(const BEntry* entry, bool forWriting);
|
||||||
void SetTo(Model*, bool forWriting);
|
void SetTo(Model*, bool forWriting);
|
||||||
|
|
||||||
AttributeStreamNode* StreamNode() const;
|
AttributeStreamNode* StreamNode() const;
|
||||||
BNode* Node() const;
|
BNode* Node() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ModelNodeLazyOpener* fModelOpener;
|
ModelNodeLazyOpener* fModelOpener;
|
||||||
BNode* fNode;
|
BNode* fNode;
|
||||||
AttributeStreamNode* fStreamNode;
|
AttributeStreamNode* fStreamNode;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class BackgroundView : public BView {
|
class BackgroundView : public BView {
|
||||||
// background view placed in a BContainerWindow, under the pose view
|
// background view placed in a BContainerWindow, under the pose view
|
||||||
public:
|
public:
|
||||||
BackgroundView(BRect);
|
BackgroundView(BRect);
|
||||||
virtual void AttachedToWindow();
|
virtual void AttachedToWindow();
|
||||||
virtual void FrameResized(float, float);
|
virtual void FrameResized(float, float);
|
||||||
virtual void Draw(BRect);
|
virtual void Draw(BRect);
|
||||||
|
|
||||||
void PoseViewFocused(bool);
|
void PoseViewFocused(bool);
|
||||||
virtual void Pulse();
|
virtual void Pulse();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void WindowActivated(bool);
|
virtual void WindowActivated(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
typedef BView _inherited;
|
typedef BView _inherited;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
int CompareLabels(const BMenuItem*, const BMenuItem*);
|
int CompareLabels(const BMenuItem*, const BMenuItem*);
|
||||||
|
|
||||||
|
|
||||||
// inlines ---------
|
// inlines ---------
|
||||||
|
|
||||||
inline BNavigator*
|
inline BNavigator*
|
||||||
@@ -376,74 +385,84 @@ BContainerWindow::Navigator() const
|
|||||||
return fNavigator;
|
return fNavigator;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline BPoseView*
|
inline BPoseView*
|
||||||
BContainerWindow::PoseView() const
|
BContainerWindow::PoseView() const
|
||||||
{
|
{
|
||||||
return fPoseView;
|
return fPoseView;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
BContainerWindow::IsTrash() const
|
BContainerWindow::IsTrash() const
|
||||||
{
|
{
|
||||||
return fIsTrash;
|
return fIsTrash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
BContainerWindow::InTrash() const
|
BContainerWindow::InTrash() const
|
||||||
{
|
{
|
||||||
return fInTrash;
|
return fInTrash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
BContainerWindow::IsPrintersDir() const
|
BContainerWindow::IsPrintersDir() const
|
||||||
{
|
{
|
||||||
return fIsPrinters;
|
return fIsPrinters;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
BContainerWindow::SetUpDiskMenu(BMenu*)
|
BContainerWindow::SetUpDiskMenu(BMenu*)
|
||||||
{
|
{
|
||||||
// nothing at this level
|
// nothing at this level
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline BPopUpMenu*
|
inline BPopUpMenu*
|
||||||
BContainerWindow::ContextMenu()
|
BContainerWindow::ContextMenu()
|
||||||
{
|
{
|
||||||
return fContextMenu;
|
return fContextMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline bool
|
inline bool
|
||||||
BContainerWindow::Dragging() const
|
BContainerWindow::Dragging() const
|
||||||
{
|
{
|
||||||
return fDragMessage && fCachedTypesList;
|
return fDragMessage && fCachedTypesList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
inline BMessage*
|
inline BMessage*
|
||||||
BContainerWindow::DragMessage() const
|
BContainerWindow::DragMessage() const
|
||||||
{
|
{
|
||||||
return fDragMessage;
|
return fDragMessage;
|
||||||
}
|
}
|
||||||
inline
|
|
||||||
bool
|
|
||||||
|
inline bool
|
||||||
BContainerWindow::SaveStateIsEnabled() const
|
BContainerWindow::SaveStateIsEnabled() const
|
||||||
{
|
{
|
||||||
return fSaveStateIsEnabled;
|
return fSaveStateIsEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
void
|
inline void
|
||||||
BContainerWindow::SetSaveStateEnabled(bool value)
|
BContainerWindow::SetSaveStateEnabled(bool value)
|
||||||
{
|
{
|
||||||
fSaveStateIsEnabled = value;
|
fSaveStateIsEnabled = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline
|
|
||||||
bool
|
inline bool
|
||||||
BContainerWindow::IsPathWatchingEnabled() const
|
BContainerWindow::IsPathWatchingEnabled() const
|
||||||
{
|
{
|
||||||
return fIsWatchingPath;
|
return fIsWatchingPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
filter_result ActivateWindowFilter(BMessage* message, BHandler** target,
|
filter_result ActivateWindowFilter(BMessage* message, BHandler** target,
|
||||||
BMessageFilter* messageFilter);
|
BMessageFilter* messageFilter);
|
||||||
|
|
||||||
@@ -451,4 +470,5 @@ filter_result ActivateWindowFilter(BMessage* message, BHandler** target,
|
|||||||
|
|
||||||
using namespace BPrivate;
|
using namespace BPrivate;
|
||||||
|
|
||||||
#endif
|
|
||||||
|
#endif // _CONTAINER_WINDOW_H
|
||||||
|
|||||||
Reference in New Issue
Block a user