Patch by Alex Wilson: Added archiving/unarchiving support to BSplitView.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@37612 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
0462f585c2
commit
12463fa891
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2006, Haiku, Inc. All rights reserved.
|
* Copyright 2006-2010, Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _SPLIT_VIEW_H
|
#ifndef _SPLIT_VIEW_H
|
||||||
@ -16,6 +16,7 @@ public:
|
|||||||
enum orientation orientation
|
enum orientation orientation
|
||||||
= B_HORIZONTAL,
|
= B_HORIZONTAL,
|
||||||
float spacing = 0.0f);
|
float spacing = 0.0f);
|
||||||
|
BSplitView(BMessage* from);
|
||||||
virtual ~BSplitView();
|
virtual ~BSplitView();
|
||||||
|
|
||||||
void SetInsets(float left, float top, float right,
|
void SetInsets(float left, float top, float right,
|
||||||
@ -59,6 +60,10 @@ public:
|
|||||||
virtual void SetLayout(BLayout* layout);
|
virtual void SetLayout(BLayout* layout);
|
||||||
// overridden to avoid use
|
// overridden to avoid use
|
||||||
|
|
||||||
|
virtual status_t Archive(BMessage* into, bool deep = true) const;
|
||||||
|
virtual status_t AllUnarchived(const BMessage* from);
|
||||||
|
static BArchivable* Instantiate(BMessage* from);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void DrawSplitter(BRect frame,
|
virtual void DrawSplitter(BRect frame,
|
||||||
const BRect& updateRect,
|
const BRect& updateRect,
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include <Archivable.h>
|
||||||
#include <ControlLook.h>
|
#include <ControlLook.h>
|
||||||
#include <Cursor.h>
|
#include <Cursor.h>
|
||||||
|
|
||||||
@ -23,6 +24,15 @@ BSplitView::BSplitView(enum orientation orientation, float spacing)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BSplitView::BSplitView(BMessage* from)
|
||||||
|
:
|
||||||
|
BView(BUnarchiver::PrepareArchive(from)),
|
||||||
|
fSplitLayout(NULL)
|
||||||
|
{
|
||||||
|
BUnarchiver(from).Finish();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BSplitView::~BSplitView()
|
BSplitView::~BSplitView()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@ -216,6 +226,37 @@ BSplitView::SetLayout(BLayout* layout)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BSplitView::Archive(BMessage* into, bool deep) const
|
||||||
|
{
|
||||||
|
return BView::Archive(into, deep);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
BSplitView::AllUnarchived(const BMessage* from)
|
||||||
|
{
|
||||||
|
status_t err = BView::AllUnarchived(from);
|
||||||
|
if (err == B_OK) {
|
||||||
|
fSplitLayout = dynamic_cast<BSplitLayout*>(GetLayout());
|
||||||
|
if (!fSplitLayout && GetLayout())
|
||||||
|
return B_BAD_TYPE;
|
||||||
|
else if (!fSplitLayout)
|
||||||
|
return B_ERROR;
|
||||||
|
}
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
BArchivable*
|
||||||
|
BSplitView::Instantiate(BMessage* from)
|
||||||
|
{
|
||||||
|
if (validate_instantiation(from, "BSplitView"))
|
||||||
|
return new BSplitView(from);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BSplitView::DrawSplitter(BRect frame, const BRect& updateRect,
|
BSplitView::DrawSplitter(BRect frame, const BRect& updateRect,
|
||||||
enum orientation orientation, bool pressed)
|
enum orientation orientation, bool pressed)
|
||||||
|
Loading…
Reference in New Issue
Block a user