2006-08-26 20:21:15 +04:00
|
|
|
/*
|
2010-07-08 19:40:49 +04:00
|
|
|
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
|
2006-08-26 20:21:15 +04:00
|
|
|
* Distributed under the terms of the MIT License.
|
|
|
|
*/
|
|
|
|
#ifndef _LAYOUT_ITEM_H
|
|
|
|
#define _LAYOUT_ITEM_H
|
|
|
|
|
2010-07-08 20:04:41 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
#include <Alignment.h>
|
2010-07-08 19:40:49 +04:00
|
|
|
#include <Archivable.h>
|
2006-08-26 20:21:15 +04:00
|
|
|
#include <Rect.h>
|
|
|
|
#include <Size.h>
|
|
|
|
|
2010-07-08 20:04:41 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
class BLayout;
|
|
|
|
class BView;
|
|
|
|
|
2010-07-08 20:04:41 +04:00
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
class BLayoutItem : public BArchivable {
|
2006-08-26 20:21:15 +04:00
|
|
|
public:
|
|
|
|
BLayoutItem();
|
2010-07-08 19:40:49 +04:00
|
|
|
BLayoutItem(BMessage* from);
|
2006-08-26 20:21:15 +04:00
|
|
|
virtual ~BLayoutItem();
|
|
|
|
|
|
|
|
BLayout* Layout() const;
|
2015-04-15 00:28:45 +03:00
|
|
|
bool RemoveSelf();
|
2006-08-26 20:21:15 +04:00
|
|
|
|
|
|
|
virtual BSize MinSize() = 0;
|
|
|
|
virtual BSize MaxSize() = 0;
|
|
|
|
virtual BSize PreferredSize() = 0;
|
|
|
|
virtual BAlignment Alignment() = 0;
|
|
|
|
|
|
|
|
virtual void SetExplicitMinSize(BSize size) = 0;
|
|
|
|
virtual void SetExplicitMaxSize(BSize size) = 0;
|
|
|
|
virtual void SetExplicitPreferredSize(BSize size) = 0;
|
2012-11-04 13:45:51 +04:00
|
|
|
void SetExplicitSize(BSize size);
|
2006-08-26 20:21:15 +04:00
|
|
|
virtual void SetExplicitAlignment(BAlignment alignment) = 0;
|
|
|
|
|
|
|
|
virtual bool IsVisible() = 0;
|
|
|
|
virtual void SetVisible(bool visible) = 0;
|
|
|
|
|
|
|
|
virtual BRect Frame() = 0;
|
|
|
|
virtual void SetFrame(BRect frame) = 0;
|
|
|
|
|
|
|
|
virtual bool HasHeightForWidth();
|
|
|
|
virtual void GetHeightForWidth(float width, float* min,
|
|
|
|
float* max, float* preferred);
|
|
|
|
|
|
|
|
virtual BView* View();
|
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
virtual void InvalidateLayout(bool children = false);
|
|
|
|
virtual void Relayout(bool immediate = false);
|
2006-08-26 20:21:15 +04:00
|
|
|
|
|
|
|
void* LayoutData() const;
|
|
|
|
void SetLayoutData(void* data);
|
|
|
|
|
|
|
|
void AlignInFrame(BRect frame);
|
2010-07-08 19:40:49 +04:00
|
|
|
|
|
|
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
2010-07-08 20:04:41 +04:00
|
|
|
|
2011-11-01 00:57:30 +04:00
|
|
|
virtual status_t Perform(perform_code d, void* arg);
|
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
protected:
|
2011-12-02 07:45:50 +04:00
|
|
|
// archiving methods
|
|
|
|
virtual status_t AllArchived(BMessage* into) const;
|
|
|
|
virtual status_t AllUnarchived(const BMessage* from);
|
2006-08-26 20:21:15 +04:00
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
// hook methods
|
2011-10-23 02:41:44 +04:00
|
|
|
virtual void LayoutInvalidated(bool children);
|
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
virtual void AttachedToLayout();
|
|
|
|
virtual void DetachedFromLayout(BLayout* layout);
|
|
|
|
|
|
|
|
virtual void AncestorVisibilityChanged(bool shown);
|
|
|
|
|
|
|
|
private:
|
2011-12-02 07:45:50 +04:00
|
|
|
void SetLayout(BLayout* layout);
|
|
|
|
|
2011-11-02 10:29:33 +04:00
|
|
|
virtual void _ReservedLayoutItem1();
|
|
|
|
virtual void _ReservedLayoutItem2();
|
|
|
|
virtual void _ReservedLayoutItem3();
|
|
|
|
virtual void _ReservedLayoutItem4();
|
|
|
|
virtual void _ReservedLayoutItem5();
|
|
|
|
virtual void _ReservedLayoutItem6();
|
|
|
|
virtual void _ReservedLayoutItem7();
|
|
|
|
virtual void _ReservedLayoutItem8();
|
|
|
|
virtual void _ReservedLayoutItem9();
|
|
|
|
virtual void _ReservedLayoutItem10();
|
|
|
|
|
2011-12-02 09:47:46 +04:00
|
|
|
// forbidden methods
|
|
|
|
BLayoutItem(const BLayoutItem&);
|
|
|
|
void operator =(const BLayoutItem&);
|
|
|
|
|
2010-08-17 22:43:41 +04:00
|
|
|
friend class BLayout;
|
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
BLayout* fLayout;
|
|
|
|
void* fLayoutData;
|
2011-11-02 10:29:33 +04:00
|
|
|
|
|
|
|
uint32 _reserved[5];
|
2006-08-26 20:21:15 +04:00
|
|
|
};
|
|
|
|
|
2010-07-08 20:04:41 +04:00
|
|
|
|
2006-08-26 20:21:15 +04:00
|
|
|
#endif // _LAYOUT_ITEM_H
|