* the main window is now using the min/max size from the layout system
* added Min/MaxSize() implementations to PropertyListView and ScrollView, which fixes the instable layout (upper list views shrinking towards the top whenever views are added/removed in the property list) git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22267 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -83,7 +83,12 @@ enum {
|
||||
MainWindow::MainWindow(IconEditorApp* app, Document* document,
|
||||
const BMessage* settings)
|
||||
: BWindow(BRect(50, 50, 900, 750), "Icon-O-Matic",
|
||||
#ifdef __HAIKU__
|
||||
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||
B_ASYNCHRONOUS_CONTROLS | B_AUTO_UPDATE_SIZE_LIMITS),
|
||||
#else
|
||||
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
|
||||
#endif
|
||||
fApp(app),
|
||||
fDocument(document),
|
||||
fIcon(NULL)
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku.
|
||||
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Stephan Aßmus <[email protected]>
|
||||
* Ingo Weinhold <[email protected]>
|
||||
* Stephan Aßmus <[email protected]>
|
||||
*/
|
||||
|
||||
#include "ScrollView.h"
|
||||
@@ -14,6 +14,9 @@
|
||||
#include <string.h>
|
||||
|
||||
#include <Bitmap.h>
|
||||
#ifdef __HAIKU__
|
||||
# include <LayoutUtils.h>
|
||||
#endif
|
||||
#include <Message.h>
|
||||
#include <ScrollBar.h>
|
||||
#include <Window.h>
|
||||
@@ -22,7 +25,7 @@
|
||||
#include "ScrollCornerBitmaps.h"
|
||||
|
||||
|
||||
// InternalScrollBar
|
||||
// #pragma mark - InternalScrollBar
|
||||
|
||||
class InternalScrollBar : public BScrollBar {
|
||||
public:
|
||||
@@ -60,9 +63,7 @@ InternalScrollBar::ValueChanged(float value)
|
||||
fScrollView->_ScrollValueChanged(this, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ScrollCorner
|
||||
// #pragma mark -ScrollCorner
|
||||
|
||||
class ScrollCorner : public BView {
|
||||
public:
|
||||
@@ -255,9 +256,7 @@ ScrollCorner::SetDragging(bool dragging)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ScrollView
|
||||
// #pragma mark - ScrollView
|
||||
|
||||
// constructor
|
||||
ScrollView::ScrollView(BView* child, uint32 scrollingFlags, BRect frame,
|
||||
@@ -390,6 +389,49 @@ void ScrollView::WindowActivated(bool activated)
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
#ifdef __HAIKU__
|
||||
|
||||
// MinSize
|
||||
BSize
|
||||
ScrollView::MinSize()
|
||||
{
|
||||
BSize size = (fChild ? fChild->MinSize() : BSize(-1, -1));
|
||||
|
||||
if (fVVisible)
|
||||
size.width += B_V_SCROLL_BAR_WIDTH;
|
||||
if (fHVisible)
|
||||
size.height += B_H_SCROLL_BAR_HEIGHT;
|
||||
|
||||
float borderSize = BorderSize();
|
||||
size.width += 2 * borderSize;
|
||||
size.height += 2 * borderSize;
|
||||
|
||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
||||
}
|
||||
|
||||
// PreferredSize
|
||||
BSize
|
||||
ScrollView::PreferredSize()
|
||||
{
|
||||
// TODO: This is not yet correct.
|
||||
BSize size = (fChild ? fChild->PreferredSize() : BSize(-1, -1));
|
||||
|
||||
if (fVVisible)
|
||||
size.width += B_V_SCROLL_BAR_WIDTH;
|
||||
if (fHVisible)
|
||||
size.height += B_H_SCROLL_BAR_HEIGHT;
|
||||
|
||||
float borderSize = BorderSize();
|
||||
size.width += 2 * borderSize;
|
||||
size.height += 2 * borderSize;
|
||||
|
||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), size);
|
||||
}
|
||||
|
||||
#endif // __HAIKU__
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// ScrollingFlags
|
||||
uint32
|
||||
ScrollView::ScrollingFlags() const
|
||||
@@ -459,6 +501,17 @@ ScrollView::HVScrollCorner() const
|
||||
return fScrollCorner;
|
||||
}
|
||||
|
||||
// BorderSize
|
||||
float
|
||||
ScrollView::BorderSize() const
|
||||
{
|
||||
if (fScrollingFlags & SCROLL_NO_FRAME)
|
||||
return 0.0;
|
||||
return 2.0;
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// SetHSmallStep
|
||||
void
|
||||
ScrollView::SetHSmallStep(float hStep)
|
||||
@@ -506,6 +559,8 @@ ScrollView::VSmallStep() const
|
||||
return fVSmallStep;
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// DataRectChanged
|
||||
void
|
||||
ScrollView::DataRectChanged(BRect /*oldDataRect*/, BRect /*newDataRect*/)
|
||||
@@ -586,6 +641,8 @@ ScrollView::_ScrollCornerValueChanged(BPoint offset)
|
||||
SetScrollOffset(offset);
|
||||
}
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// _Layout
|
||||
//
|
||||
// Relayouts all children (fChild, scroll bars).
|
||||
|
||||
@@ -41,6 +41,12 @@ class ScrollView : public BView, public Scroller {
|
||||
virtual void FrameResized(float width, float height);
|
||||
virtual void WindowActivated(bool activated);
|
||||
|
||||
#ifdef __HAIKU__
|
||||
virtual BSize MinSize();
|
||||
virtual BSize PreferredSize();
|
||||
#endif
|
||||
|
||||
|
||||
uint32 ScrollingFlags() const;
|
||||
void SetVisibleRectIsChildBounds(bool flag);
|
||||
bool VisibleRectIsChildBounds() const;
|
||||
@@ -60,6 +66,8 @@ class ScrollView : public BView, public Scroller {
|
||||
float HSmallStep() const;
|
||||
float VSmallStep() const;
|
||||
|
||||
float BorderSize() const;
|
||||
|
||||
protected:
|
||||
virtual void DataRectChanged(BRect oldDataRect,
|
||||
BRect newDataRect);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku.
|
||||
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -13,6 +13,9 @@
|
||||
|
||||
#include <ClassInfo.h>
|
||||
#include <Clipboard.h>
|
||||
#ifdef __HAIKU__
|
||||
# include <LayoutUtils.h>
|
||||
#endif
|
||||
#include <Menu.h>
|
||||
#include <MenuItem.h>
|
||||
#include <Message.h>
|
||||
@@ -250,6 +253,34 @@ PropertyListView::MessageReceived(BMessage* message)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __HAIKU__
|
||||
|
||||
BSize
|
||||
PropertyListView::MinSize()
|
||||
{
|
||||
// We need a stable min size: the BView implementation uses
|
||||
// GetPreferredSize(), which by default just returns the current size.
|
||||
return BLayoutUtils::ComposeSize(ExplicitMinSize(), BSize(10, 10));
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
PropertyListView::MaxSize()
|
||||
{
|
||||
return BView::MaxSize();
|
||||
}
|
||||
|
||||
|
||||
BSize
|
||||
PropertyListView::PreferredSize()
|
||||
{
|
||||
// We need a stable preferred size: the BView implementation uses
|
||||
// GetPreferredSize(), which by default just returns the current size.
|
||||
return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), BSize(100, 50));
|
||||
}
|
||||
|
||||
#endif // __HAIKU__
|
||||
|
||||
// #pragma mark -
|
||||
|
||||
// TabFocus
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku.
|
||||
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -42,6 +42,12 @@ class PropertyListView : public BView,
|
||||
virtual void MouseDown(BPoint where);
|
||||
virtual void MessageReceived(BMessage* message);
|
||||
|
||||
#ifdef __HAIKU__
|
||||
virtual BSize MinSize();
|
||||
virtual BSize MaxSize();
|
||||
virtual BSize PreferredSize();
|
||||
#endif
|
||||
|
||||
// Scrollable interface
|
||||
virtual void ScrollOffsetChanged(BPoint oldOffset,
|
||||
BPoint newOffset);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku.
|
||||
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2006, Haiku.
|
||||
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@@ -22,9 +22,10 @@ class IconObjectListView : public PropertyListView,
|
||||
IconObjectListView();
|
||||
virtual ~IconObjectListView();
|
||||
|
||||
// PropertyListView interface
|
||||
// BView interface
|
||||
virtual void Draw(BRect updateRect);
|
||||
|
||||
// PropertyListView interface
|
||||
virtual void PropertyChanged(const Property* previous,
|
||||
const Property* current);
|
||||
virtual void PasteProperties(const PropertyObject* object);
|
||||
|
||||
Reference in New Issue
Block a user