Minor cleanup.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21304 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2007-06-03 12:36:39 +00:00
parent 1ad1713ad2
commit c1dac92abf
2 changed files with 27 additions and 44 deletions
+9 -9
View File
@@ -1,5 +1,5 @@
/* /*
* Copyright 2004-2006, Haiku, Inc. All Rights Reserved. * Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
* Distributed under the terms of the MIT License. * Distributed under the terms of the MIT License.
* *
* Authors: * Authors:
@@ -33,9 +33,9 @@ DirectoryRefFilter::Filter(const entry_ref *ref, BNode* node, struct stat *st,
DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger *target, DirectoryFilePanel::DirectoryFilePanel(file_panel_mode mode, BMessenger *target,
const entry_ref *startDirectory, uint32 nodeFlavors, const entry_ref *startDirectory, uint32 nodeFlavors,
bool allowMultipleSelection, BMessage *message, BRefFilter *filter, bool allowMultipleSelection, BMessage *message, BRefFilter *filter,
bool modal, bool hideWhenDone) bool modal, bool hideWhenDone)
: BFilePanel(mode, target, startDirectory, nodeFlavors, : BFilePanel(mode, target, startDirectory, nodeFlavors,
allowMultipleSelection, message, filter, modal, hideWhenDone), allowMultipleSelection, message, filter, modal, hideWhenDone),
fCurrentButton(NULL) fCurrentButton(NULL)
@@ -60,13 +60,13 @@ DirectoryFilePanel::Show()
rect.top = rect.bottom - 35; rect.top = rect.bottom - 35;
rect.bottom -= 10; rect.bottom -= 10;
} }
rect.right = rect.left -= 30; rect.right = rect.left -= 30;
float directory_width = be_plain_font->StringWidth("Select current") + 20; float width = be_plain_font->StringWidth("Select current") + 20;
rect.left = (directory_width > 75) ? (rect.right - directory_width) : (rect.right - 75); rect.left = width > 75 ? rect.right - width : rect.right - 75;
fCurrentButton = new BButton(rect, "directoryButton", "Select current", fCurrentButton = new BButton(rect, "directoryButton", "Select current",
new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); new BMessage(MSG_DIRECTORY), B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM);
background->AddChild(fCurrentButton); background->AddChild(fCurrentButton);
fCurrentButton->SetTarget(Messenger()); fCurrentButton->SetTarget(Messenger());
@@ -81,7 +81,7 @@ DirectoryFilePanel::Show()
void void
DirectoryFilePanel::SelectionChanged(void) DirectoryFilePanel::SelectionChanged()
{ {
Window()->Lock(); Window()->Lock();
+18 -35
View File
@@ -1,36 +1,18 @@
/*****************************************************************************/ /*
// Expander * Copyright 2004-2007, Haiku, Inc. All Rights Reserved.
// Written by Jérôme Duval * Distributed under the terms of the MIT License.
// *
// DirectoryFilePanel.h * Authors:
// * Jérôme Duval
// Copyright (c) 2004 OpenBeOS Project */
// #ifndef _DIRECTORY_FILE_PANEL_H
// Permission is hereby granted, free of charge, to any person obtaining a #define _DIRECTORY_FILE_PANEL_H
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense,
// and/or sell copies of the Software, and to permit persons to whom the
// Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
// DEALINGS IN THE SOFTWARE.
/*****************************************************************************/
#ifndef _DirectoryFilePanel_h
#define _DirectoryFilePanel_h
#include <FilePanel.h> #include <FilePanel.h>
#include <Button.h> #include <Button.h>
const uint32 MSG_DIRECTORY = 'mDIR'; const uint32 MSG_DIRECTORY = 'mDIR';
@@ -41,20 +23,21 @@ class DirectoryRefFilter : public BRefFilter {
const char *filetype); const char *filetype);
}; };
class DirectoryFilePanel : public BFilePanel { class DirectoryFilePanel : public BFilePanel {
public: public:
DirectoryFilePanel(file_panel_mode mode = B_OPEN_PANEL, DirectoryFilePanel(file_panel_mode mode = B_OPEN_PANEL,
BMessenger *target = 0, const entry_ref *start_directory = 0, BMessenger *target = NULL, const entry_ref *startDirectory = NULL,
uint32 node_flavors = 0, bool allow_multiple_selection = true, uint32 nodeFlavors = 0, bool allowMultipleSelection = true,
BMessage *message = 0, BRefFilter * = 0, BMessage *message = NULL, BRefFilter *filter = NULL,
bool modal = false, bool hide_when_done = true); bool modal = false, bool hideWhenDone = true);
virtual ~DirectoryFilePanel() {}; virtual ~DirectoryFilePanel() {};
virtual void SelectionChanged(void);
virtual void SelectionChanged();
virtual void Show(); virtual void Show();
// overrides non-virtual BFilePanel::Show()
protected: protected:
BButton *fCurrentButton; BButton *fCurrentButton;
}; };
#endif #endif // _DIRECTORY_FILE_PANEL_H