* 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,
|
MainWindow::MainWindow(IconEditorApp* app, Document* document,
|
||||||
const BMessage* settings)
|
const BMessage* settings)
|
||||||
: BWindow(BRect(50, 50, 900, 750), "Icon-O-Matic",
|
: 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),
|
B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_ASYNCHRONOUS_CONTROLS),
|
||||||
|
#endif
|
||||||
fApp(app),
|
fApp(app),
|
||||||
fDocument(document),
|
fDocument(document),
|
||||||
fIcon(NULL)
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
* Stephan Aßmus <[email protected]>
|
|
||||||
* Ingo Weinhold <[email protected]>
|
* Ingo Weinhold <[email protected]>
|
||||||
|
* Stephan Aßmus <[email protected]>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ScrollView.h"
|
#include "ScrollView.h"
|
||||||
@@ -14,6 +14,9 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <Bitmap.h>
|
#include <Bitmap.h>
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
# include <LayoutUtils.h>
|
||||||
|
#endif
|
||||||
#include <Message.h>
|
#include <Message.h>
|
||||||
#include <ScrollBar.h>
|
#include <ScrollBar.h>
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
@@ -22,7 +25,7 @@
|
|||||||
#include "ScrollCornerBitmaps.h"
|
#include "ScrollCornerBitmaps.h"
|
||||||
|
|
||||||
|
|
||||||
// InternalScrollBar
|
// #pragma mark - InternalScrollBar
|
||||||
|
|
||||||
class InternalScrollBar : public BScrollBar {
|
class InternalScrollBar : public BScrollBar {
|
||||||
public:
|
public:
|
||||||
@@ -60,9 +63,7 @@ InternalScrollBar::ValueChanged(float value)
|
|||||||
fScrollView->_ScrollValueChanged(this, value);
|
fScrollView->_ScrollValueChanged(this, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #pragma mark -ScrollCorner
|
||||||
|
|
||||||
// ScrollCorner
|
|
||||||
|
|
||||||
class ScrollCorner : public BView {
|
class ScrollCorner : public BView {
|
||||||
public:
|
public:
|
||||||
@@ -255,9 +256,7 @@ ScrollCorner::SetDragging(bool dragging)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #pragma mark - ScrollView
|
||||||
|
|
||||||
// ScrollView
|
|
||||||
|
|
||||||
// constructor
|
// constructor
|
||||||
ScrollView::ScrollView(BView* child, uint32 scrollingFlags, BRect frame,
|
ScrollView::ScrollView(BView* child, uint32 scrollingFlags, BRect frame,
|
||||||
@@ -390,6 +389,49 @@ void ScrollView::WindowActivated(bool activated)
|
|||||||
Invalidate();
|
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
|
// ScrollingFlags
|
||||||
uint32
|
uint32
|
||||||
ScrollView::ScrollingFlags() const
|
ScrollView::ScrollingFlags() const
|
||||||
@@ -459,6 +501,17 @@ ScrollView::HVScrollCorner() const
|
|||||||
return fScrollCorner;
|
return fScrollCorner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// BorderSize
|
||||||
|
float
|
||||||
|
ScrollView::BorderSize() const
|
||||||
|
{
|
||||||
|
if (fScrollingFlags & SCROLL_NO_FRAME)
|
||||||
|
return 0.0;
|
||||||
|
return 2.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
// SetHSmallStep
|
// SetHSmallStep
|
||||||
void
|
void
|
||||||
ScrollView::SetHSmallStep(float hStep)
|
ScrollView::SetHSmallStep(float hStep)
|
||||||
@@ -506,6 +559,8 @@ ScrollView::VSmallStep() const
|
|||||||
return fVSmallStep;
|
return fVSmallStep;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
// DataRectChanged
|
// DataRectChanged
|
||||||
void
|
void
|
||||||
ScrollView::DataRectChanged(BRect /*oldDataRect*/, BRect /*newDataRect*/)
|
ScrollView::DataRectChanged(BRect /*oldDataRect*/, BRect /*newDataRect*/)
|
||||||
@@ -586,6 +641,8 @@ ScrollView::_ScrollCornerValueChanged(BPoint offset)
|
|||||||
SetScrollOffset(offset);
|
SetScrollOffset(offset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// #pragma mark -
|
||||||
|
|
||||||
// _Layout
|
// _Layout
|
||||||
//
|
//
|
||||||
// Relayouts all children (fChild, scroll bars).
|
// 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 FrameResized(float width, float height);
|
||||||
virtual void WindowActivated(bool activated);
|
virtual void WindowActivated(bool activated);
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
virtual BSize MinSize();
|
||||||
|
virtual BSize PreferredSize();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
uint32 ScrollingFlags() const;
|
uint32 ScrollingFlags() const;
|
||||||
void SetVisibleRectIsChildBounds(bool flag);
|
void SetVisibleRectIsChildBounds(bool flag);
|
||||||
bool VisibleRectIsChildBounds() const;
|
bool VisibleRectIsChildBounds() const;
|
||||||
@@ -60,6 +66,8 @@ class ScrollView : public BView, public Scroller {
|
|||||||
float HSmallStep() const;
|
float HSmallStep() const;
|
||||||
float VSmallStep() const;
|
float VSmallStep() const;
|
||||||
|
|
||||||
|
float BorderSize() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DataRectChanged(BRect oldDataRect,
|
virtual void DataRectChanged(BRect oldDataRect,
|
||||||
BRect newDataRect);
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -13,6 +13,9 @@
|
|||||||
|
|
||||||
#include <ClassInfo.h>
|
#include <ClassInfo.h>
|
||||||
#include <Clipboard.h>
|
#include <Clipboard.h>
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
# include <LayoutUtils.h>
|
||||||
|
#endif
|
||||||
#include <Menu.h>
|
#include <Menu.h>
|
||||||
#include <MenuItem.h>
|
#include <MenuItem.h>
|
||||||
#include <Message.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 -
|
// #pragma mark -
|
||||||
|
|
||||||
// TabFocus
|
// TabFocus
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku.
|
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -42,6 +42,12 @@ class PropertyListView : public BView,
|
|||||||
virtual void MouseDown(BPoint where);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
|
|
||||||
|
#ifdef __HAIKU__
|
||||||
|
virtual BSize MinSize();
|
||||||
|
virtual BSize MaxSize();
|
||||||
|
virtual BSize PreferredSize();
|
||||||
|
#endif
|
||||||
|
|
||||||
// Scrollable interface
|
// Scrollable interface
|
||||||
virtual void ScrollOffsetChanged(BPoint oldOffset,
|
virtual void ScrollOffsetChanged(BPoint oldOffset,
|
||||||
BPoint newOffset);
|
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.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku.
|
* Copyright 2006-2007, Haiku Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -22,9 +22,10 @@ class IconObjectListView : public PropertyListView,
|
|||||||
IconObjectListView();
|
IconObjectListView();
|
||||||
virtual ~IconObjectListView();
|
virtual ~IconObjectListView();
|
||||||
|
|
||||||
// PropertyListView interface
|
// BView interface
|
||||||
virtual void Draw(BRect updateRect);
|
virtual void Draw(BRect updateRect);
|
||||||
|
|
||||||
|
// PropertyListView interface
|
||||||
virtual void PropertyChanged(const Property* previous,
|
virtual void PropertyChanged(const Property* previous,
|
||||||
const Property* current);
|
const Property* current);
|
||||||
virtual void PasteProperties(const PropertyObject* object);
|
virtual void PasteProperties(const PropertyObject* object);
|
||||||
|
|||||||
Reference in New Issue
Block a user