Documentation fixes for BTab and BTabView
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2009, Haiku, Inc. All rights reserved.
|
* Copyright 2001-2009 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*/
|
*/
|
||||||
#ifndef _TAB_VIEW_H
|
#ifndef _TAB_VIEW_H
|
||||||
@@ -24,8 +24,7 @@ public:
|
|||||||
BTab(BMessage* archive);
|
BTab(BMessage* archive);
|
||||||
static BArchivable* Instantiate(BMessage* archive);
|
static BArchivable* Instantiate(BMessage* archive);
|
||||||
|
|
||||||
virtual status_t Archive(BMessage* archive,
|
virtual status_t Archive(BMessage* data, bool deep = true) const;
|
||||||
bool deep = true) const;
|
|
||||||
virtual status_t Perform(uint32 d, void* arg);
|
virtual status_t Perform(uint32 d, void* arg);
|
||||||
|
|
||||||
const char* Label() const;
|
const char* Label() const;
|
||||||
@@ -35,10 +34,10 @@ public:
|
|||||||
virtual void Select(BView* owner);
|
virtual void Select(BView* owner);
|
||||||
virtual void Deselect();
|
virtual void Deselect();
|
||||||
|
|
||||||
virtual void SetEnabled(bool enabled);
|
virtual void SetEnabled(bool enable);
|
||||||
bool IsEnabled() const;
|
bool IsEnabled() const;
|
||||||
|
|
||||||
void MakeFocus(bool inFocus = true);
|
void MakeFocus(bool focus = true);
|
||||||
bool IsFocus() const;
|
bool IsFocus() const;
|
||||||
|
|
||||||
// sets/gets the view to be displayed for this tab
|
// sets/gets the view to be displayed for this tab
|
||||||
@@ -86,7 +85,7 @@ public:
|
|||||||
| B_FRAME_EVENTS | B_NAVIGABLE);
|
| B_FRAME_EVENTS | B_NAVIGABLE);
|
||||||
BTabView(BRect frame, const char* name,
|
BTabView(BRect frame, const char* name,
|
||||||
button_width width = B_WIDTH_AS_USUAL,
|
button_width width = B_WIDTH_AS_USUAL,
|
||||||
uint32 resizingMode = B_FOLLOW_ALL,
|
uint32 resizeMask = B_FOLLOW_ALL,
|
||||||
uint32 flags = B_FULL_UPDATE_ON_RESIZE
|
uint32 flags = B_FULL_UPDATE_ON_RESIZE
|
||||||
| B_WILL_DRAW | B_NAVIGABLE_JUMP
|
| B_WILL_DRAW | B_NAVIGABLE_JUMP
|
||||||
| B_FRAME_EVENTS | B_NAVIGABLE);
|
| B_FRAME_EVENTS | B_NAVIGABLE);
|
||||||
@@ -106,9 +105,9 @@ public:
|
|||||||
|
|
||||||
virtual void MessageReceived(BMessage* message);
|
virtual void MessageReceived(BMessage* message);
|
||||||
virtual void KeyDown(const char* bytes, int32 numBytes);
|
virtual void KeyDown(const char* bytes, int32 numBytes);
|
||||||
virtual void MouseDown(BPoint point);
|
virtual void MouseDown(BPoint where);
|
||||||
virtual void MouseUp(BPoint point);
|
virtual void MouseUp(BPoint where);
|
||||||
virtual void MouseMoved(BPoint point, uint32 transit,
|
virtual void MouseMoved(BPoint where, uint32 transit,
|
||||||
const BMessage* dragMessage);
|
const BMessage* dragMessage);
|
||||||
virtual void Pulse();
|
virtual void Pulse();
|
||||||
|
|
||||||
@@ -129,15 +128,14 @@ public:
|
|||||||
virtual void SetResizingMode(uint32 mode);
|
virtual void SetResizingMode(uint32 mode);
|
||||||
|
|
||||||
virtual void ResizeToPreferred();
|
virtual void ResizeToPreferred();
|
||||||
virtual void GetPreferredSize(float* _width,
|
virtual void GetPreferredSize(float* _width, float* _height);
|
||||||
float* _height);
|
|
||||||
|
|
||||||
virtual BSize MinSize();
|
virtual BSize MinSize();
|
||||||
virtual BSize MaxSize();
|
virtual BSize MaxSize();
|
||||||
virtual BSize PreferredSize();
|
virtual BSize PreferredSize();
|
||||||
|
|
||||||
virtual void FrameMoved(BPoint newLocation);
|
virtual void FrameMoved(BPoint newPosition);
|
||||||
virtual void FrameResized(float width,float height);
|
virtual void FrameResized(float newWidth, float newHeight);
|
||||||
|
|
||||||
virtual BHandler* ResolveSpecifier(BMessage* message,
|
virtual BHandler* ResolveSpecifier(BMessage* message,
|
||||||
int32 index, BMessage* specifier,
|
int32 index, BMessage* specifier,
|
||||||
|
|||||||
+99
-158
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2001-2013, Haiku, Inc. All rights reserved.
|
* Copyright 2001-2013 Haiku, Inc. All rights reserved.
|
||||||
* Distributed under the terms of the MIT License.
|
* Distributed under the terms of the MIT License.
|
||||||
*
|
*
|
||||||
* Authors:
|
* Authors:
|
||||||
@@ -41,12 +41,13 @@ static property_info sPropertyList[] = {
|
|||||||
NULL, 0,
|
NULL, 0,
|
||||||
{ B_INT32_TYPE }
|
{ B_INT32_TYPE }
|
||||||
},
|
},
|
||||||
|
|
||||||
{}
|
{}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BTab::BTab(BView *tabView)
|
BTab::BTab(BView* tabView)
|
||||||
:
|
:
|
||||||
fEnabled(true),
|
fEnabled(true),
|
||||||
fSelected(false),
|
fSelected(false),
|
||||||
@@ -56,7 +57,7 @@ BTab::BTab(BView *tabView)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTab::BTab(BMessage *archive)
|
BTab::BTab(BMessage* archive)
|
||||||
:
|
:
|
||||||
BArchivable(archive),
|
BArchivable(archive),
|
||||||
fSelected(false),
|
fSelected(false),
|
||||||
@@ -84,8 +85,8 @@ BTab::~BTab()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BArchivable *
|
BArchivable*
|
||||||
BTab::Instantiate(BMessage *archive)
|
BTab::Instantiate(BMessage* archive)
|
||||||
{
|
{
|
||||||
if (validate_instantiation(archive, "BTab"))
|
if (validate_instantiation(archive, "BTab"))
|
||||||
return new BTab(archive);
|
return new BTab(archive);
|
||||||
@@ -95,27 +96,27 @@ BTab::Instantiate(BMessage *archive)
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BTab::Archive(BMessage *archive, bool deep) const
|
BTab::Archive(BMessage* data, bool deep) const
|
||||||
{
|
{
|
||||||
status_t err = BArchivable::Archive(archive, deep);
|
status_t result = BArchivable::Archive(data, deep);
|
||||||
if (err != B_OK)
|
if (result != B_OK)
|
||||||
return err;
|
return result;
|
||||||
|
|
||||||
if (!fEnabled)
|
if (!fEnabled)
|
||||||
err = archive->AddBool("_disable", false);
|
result = data->AddBool("_disable", false);
|
||||||
|
|
||||||
return err;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BTab::Perform(uint32 d, void *arg)
|
BTab::Perform(uint32 d, void* arg)
|
||||||
{
|
{
|
||||||
return BArchivable::Perform(d, arg);
|
return BArchivable::Perform(d, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const char *
|
const char*
|
||||||
BTab::Label() const
|
BTab::Label() const
|
||||||
{
|
{
|
||||||
if (fView)
|
if (fView)
|
||||||
@@ -126,7 +127,7 @@ BTab::Label() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::SetLabel(const char *label)
|
BTab::SetLabel(const char* label)
|
||||||
{
|
{
|
||||||
if (!label || !fView)
|
if (!label || !fView)
|
||||||
return;
|
return;
|
||||||
@@ -143,7 +144,7 @@ BTab::IsSelected() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::Select(BView *owner)
|
BTab::Select(BView* owner)
|
||||||
{
|
{
|
||||||
// TODO: Shouldn't we still maintain fSelected like in Deselect()?
|
// TODO: Shouldn't we still maintain fSelected like in Deselect()?
|
||||||
if (!owner || !View() || !owner->Window())
|
if (!owner || !View() || !owner->Window())
|
||||||
@@ -178,9 +179,9 @@ BTab::Deselect()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::SetEnabled(bool enabled)
|
BTab::SetEnabled(bool enable)
|
||||||
{
|
{
|
||||||
fEnabled = enabled;
|
fEnabled = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -192,9 +193,9 @@ BTab::IsEnabled() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::MakeFocus(bool inFocus)
|
BTab::MakeFocus(bool focus)
|
||||||
{
|
{
|
||||||
fFocus = inFocus;
|
fFocus = focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -206,7 +207,7 @@ BTab::IsFocus() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::SetView(BView *view)
|
BTab::SetView(BView* view)
|
||||||
{
|
{
|
||||||
if (!view || fView == view)
|
if (!view || fView == view)
|
||||||
return;
|
return;
|
||||||
@@ -219,7 +220,7 @@ BTab::SetView(BView *view)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView *
|
BView*
|
||||||
BTab::View() const
|
BTab::View() const
|
||||||
{
|
{
|
||||||
return fView;
|
return fView;
|
||||||
@@ -227,7 +228,7 @@ BTab::View() const
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::DrawFocusMark(BView *owner, BRect frame)
|
BTab::DrawFocusMark(BView* owner, BRect frame)
|
||||||
{
|
{
|
||||||
float width = owner->StringWidth(Label());
|
float width = owner->StringWidth(Label());
|
||||||
|
|
||||||
@@ -242,7 +243,7 @@ BTab::DrawFocusMark(BView *owner, BRect frame)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::DrawLabel(BView *owner, BRect frame)
|
BTab::DrawLabel(BView* owner, BRect frame)
|
||||||
{
|
{
|
||||||
be_control_look->DrawLabel(owner, Label(), frame, frame,
|
be_control_look->DrawLabel(owner, Label(), frame, frame,
|
||||||
ui_color(B_PANEL_BACKGROUND_COLOR),
|
ui_color(B_PANEL_BACKGROUND_COLOR),
|
||||||
@@ -252,93 +253,34 @@ BTab::DrawLabel(BView *owner, BRect frame)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTab::DrawTab(BView *owner, BRect frame, tab_position position, bool full)
|
BTab::DrawTab(BView* owner, BRect frame, tab_position position, bool full)
|
||||||
{
|
{
|
||||||
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR);
|
||||||
|
uint32 borders = BControlLook::B_TOP_BORDER
|
||||||
|
| BControlLook::B_BOTTOM_BORDER;
|
||||||
|
|
||||||
if (be_control_look != NULL) {
|
if (frame.left == owner->Bounds().left)
|
||||||
uint32 borders = BControlLook::B_TOP_BORDER
|
borders |= BControlLook::B_LEFT_BORDER;
|
||||||
| BControlLook::B_BOTTOM_BORDER;
|
|
||||||
if (frame.left == owner->Bounds().left)
|
|
||||||
borders |= BControlLook::B_LEFT_BORDER;
|
|
||||||
if (frame.right == owner->Bounds().right)
|
|
||||||
borders |= BControlLook::B_RIGHT_BORDER;
|
|
||||||
|
|
||||||
if (position == B_TAB_FRONT) {
|
if (frame.right == owner->Bounds().right)
|
||||||
frame.bottom += 1;
|
borders |= BControlLook::B_RIGHT_BORDER;
|
||||||
be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0,
|
|
||||||
borders);
|
|
||||||
} else {
|
|
||||||
be_control_look->DrawInactiveTab(owner, frame, frame, no_tint, 0,
|
|
||||||
borders);
|
|
||||||
}
|
|
||||||
|
|
||||||
DrawLabel(owner, frame);
|
if (position == B_TAB_FRONT) {
|
||||||
return;
|
frame.bottom += 1;
|
||||||
}
|
be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0,
|
||||||
|
borders);
|
||||||
rgb_color lightenmax = tint_color(no_tint, B_LIGHTEN_MAX_TINT);
|
|
||||||
rgb_color darken2 = tint_color(no_tint, B_DARKEN_2_TINT);
|
|
||||||
rgb_color darken3 = tint_color(no_tint, B_DARKEN_3_TINT);
|
|
||||||
rgb_color darken4 = tint_color(no_tint, B_DARKEN_4_TINT);
|
|
||||||
rgb_color darkenmax = tint_color(no_tint, B_DARKEN_MAX_TINT);
|
|
||||||
|
|
||||||
owner->SetHighColor(darkenmax);
|
|
||||||
owner->SetLowColor(no_tint);
|
|
||||||
// NOTE: "frame" goes from the beginning of the left slope to the beginning
|
|
||||||
// of the right slope - "lableFrame" is the frame between both slopes
|
|
||||||
BRect lableFrame = frame;
|
|
||||||
lableFrame.left = lableFrame.left + frame.Height() / 2.0;
|
|
||||||
DrawLabel(owner, lableFrame);
|
|
||||||
|
|
||||||
owner->SetDrawingMode(B_OP_OVER);
|
|
||||||
|
|
||||||
owner->BeginLineArray(12);
|
|
||||||
|
|
||||||
int32 slopeWidth = (int32)ceilf(frame.Height() / 2.0);
|
|
||||||
|
|
||||||
if (position != B_TAB_ANY) {
|
|
||||||
// full height left side
|
|
||||||
owner->AddLine(BPoint(frame.left, frame.bottom),
|
|
||||||
BPoint(frame.left + slopeWidth, frame.top), darken3);
|
|
||||||
owner->AddLine(BPoint(frame.left, frame.bottom + 1),
|
|
||||||
BPoint(frame.left + slopeWidth, frame.top + 1), lightenmax);
|
|
||||||
} else {
|
} else {
|
||||||
// upper half of left side
|
be_control_look->DrawInactiveTab(owner, frame, frame, no_tint, 0,
|
||||||
owner->AddLine(BPoint(frame.left + slopeWidth / 2,
|
borders);
|
||||||
frame.bottom - slopeWidth),
|
|
||||||
BPoint(frame.left + slopeWidth, frame.top), darken3);
|
|
||||||
owner->AddLine(BPoint(frame.left + slopeWidth / 2 + 2,
|
|
||||||
frame.bottom - slopeWidth - 1),
|
|
||||||
BPoint(frame.left + slopeWidth, frame.top + 1), lightenmax);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// lines along the top
|
DrawLabel(owner, frame);
|
||||||
owner->AddLine(BPoint(frame.left + slopeWidth, frame.top),
|
|
||||||
BPoint(frame.right, frame.top), darken3);
|
|
||||||
owner->AddLine(BPoint(frame.left + slopeWidth, frame.top + 1),
|
|
||||||
BPoint(frame.right, frame.top + 1), lightenmax);
|
|
||||||
|
|
||||||
if (full) {
|
|
||||||
// full height right side
|
|
||||||
owner->AddLine(BPoint(frame.right, frame.top),
|
|
||||||
BPoint(frame.right + slopeWidth + 2, frame.bottom), darken2);
|
|
||||||
owner->AddLine(BPoint(frame.right, frame.top + 1),
|
|
||||||
BPoint(frame.right + slopeWidth + 1, frame.bottom), darken4);
|
|
||||||
} else {
|
|
||||||
// upper half of right side
|
|
||||||
owner->AddLine(BPoint(frame.right, frame.top),
|
|
||||||
BPoint(frame.right + slopeWidth / 2 + 1,
|
|
||||||
frame.bottom - slopeWidth), darken2);
|
|
||||||
owner->AddLine(BPoint(frame.right, frame.top + 1),
|
|
||||||
BPoint(frame.right + slopeWidth / 2,
|
|
||||||
frame.bottom - slopeWidth), darken4);
|
|
||||||
}
|
|
||||||
|
|
||||||
owner->EndLineArray();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// #pragma mark - FBC padding and private methods
|
||||||
|
|
||||||
|
|
||||||
void BTab::_ReservedTab1() {}
|
void BTab::_ReservedTab1() {}
|
||||||
void BTab::_ReservedTab2() {}
|
void BTab::_ReservedTab2() {}
|
||||||
void BTab::_ReservedTab3() {}
|
void BTab::_ReservedTab3() {}
|
||||||
@@ -362,7 +304,7 @@ BTab &BTab::operator=(const BTab &)
|
|||||||
// #pragma mark - BTabView
|
// #pragma mark - BTabView
|
||||||
|
|
||||||
|
|
||||||
BTabView::BTabView(const char *name, button_width width, uint32 flags)
|
BTabView::BTabView(const char* name, button_width width, uint32 flags)
|
||||||
:
|
:
|
||||||
BView(name, flags)
|
BView(name, flags)
|
||||||
{
|
{
|
||||||
@@ -370,10 +312,10 @@ BTabView::BTabView(const char *name, button_width width, uint32 flags)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTabView::BTabView(BRect frame, const char *name, button_width width,
|
BTabView::BTabView(BRect frame, const char* name, button_width width,
|
||||||
uint32 resizingMode, uint32 flags)
|
uint32 resizeMask, uint32 flags)
|
||||||
:
|
:
|
||||||
BView(frame, name, resizingMode, flags)
|
BView(frame, name, resizeMask, flags)
|
||||||
{
|
{
|
||||||
_InitObject(false, width);
|
_InitObject(false, width);
|
||||||
}
|
}
|
||||||
@@ -388,7 +330,7 @@ BTabView::~BTabView()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTabView::BTabView(BMessage *archive)
|
BTabView::BTabView(BMessage* archive)
|
||||||
:
|
:
|
||||||
BView(BUnarchiver::PrepareArchive(archive)),
|
BView(BUnarchiver::PrepareArchive(archive)),
|
||||||
fTabList(new BList),
|
fTabList(new BList),
|
||||||
@@ -432,14 +374,14 @@ BTabView::BTabView(BMessage *archive)
|
|||||||
_InitContainerView(Flags() & B_SUPPORTS_LAYOUT);
|
_InitContainerView(Flags() & B_SUPPORTS_LAYOUT);
|
||||||
|
|
||||||
while (archive->FindMessage("_l_items", i, &tabMsg) == B_OK) {
|
while (archive->FindMessage("_l_items", i, &tabMsg) == B_OK) {
|
||||||
BArchivable *archivedTab = instantiate_object(&tabMsg);
|
BArchivable* archivedTab = instantiate_object(&tabMsg);
|
||||||
|
|
||||||
if (archivedTab) {
|
if (archivedTab) {
|
||||||
BTab *tab = dynamic_cast<BTab *>(archivedTab);
|
BTab* tab = dynamic_cast<BTab*>(archivedTab);
|
||||||
|
|
||||||
BMessage viewMsg;
|
BMessage viewMsg;
|
||||||
if (archive->FindMessage("_view_list", i, &viewMsg) == B_OK) {
|
if (archive->FindMessage("_view_list", i, &viewMsg) == B_OK) {
|
||||||
BArchivable *archivedView = instantiate_object(&viewMsg);
|
BArchivable* archivedView = instantiate_object(&viewMsg);
|
||||||
if (archivedView)
|
if (archivedView)
|
||||||
AddTab(dynamic_cast<BView*>(archivedView), tab);
|
AddTab(dynamic_cast<BView*>(archivedView), tab);
|
||||||
}
|
}
|
||||||
@@ -451,8 +393,8 @@ BTabView::BTabView(BMessage *archive)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BArchivable *
|
BArchivable*
|
||||||
BTabView::Instantiate(BMessage *archive)
|
BTabView::Instantiate(BMessage* archive)
|
||||||
{
|
{
|
||||||
if ( validate_instantiation(archive, "BTabView"))
|
if ( validate_instantiation(archive, "BTabView"))
|
||||||
return new BTabView(archive);
|
return new BTabView(archive);
|
||||||
@@ -466,28 +408,28 @@ BTabView::Archive(BMessage* archive, bool deep) const
|
|||||||
{
|
{
|
||||||
BArchiver archiver(archive);
|
BArchiver archiver(archive);
|
||||||
|
|
||||||
status_t ret = BView::Archive(archive, deep);
|
status_t result = BView::Archive(archive, deep);
|
||||||
|
|
||||||
if (ret == B_OK)
|
if (result == B_OK)
|
||||||
ret = archive->AddInt16("_but_width", fTabWidthSetting);
|
result = archive->AddInt16("_but_width", fTabWidthSetting);
|
||||||
if (ret == B_OK)
|
if (result == B_OK)
|
||||||
ret = archive->AddFloat("_high", fTabHeight);
|
result = archive->AddFloat("_high", fTabHeight);
|
||||||
if (ret == B_OK)
|
if (result == B_OK)
|
||||||
ret = archive->AddInt32("_sel", fSelection);
|
result = archive->AddInt32("_sel", fSelection);
|
||||||
if (ret == B_OK && fBorderStyle != B_FANCY_BORDER)
|
if (result == B_OK && fBorderStyle != B_FANCY_BORDER)
|
||||||
ret = archive->AddInt32("_border_style", fBorderStyle);
|
result = archive->AddInt32("_border_style", fBorderStyle);
|
||||||
|
|
||||||
if (ret == B_OK && deep) {
|
if (result == B_OK && deep) {
|
||||||
for (int32 i = 0; i < CountTabs(); i++) {
|
for (int32 i = 0; i < CountTabs(); i++) {
|
||||||
BTab* tab = TabAt(i);
|
BTab* tab = TabAt(i);
|
||||||
|
|
||||||
if ((ret = archiver.AddArchivable("_l_items", tab, deep)) != B_OK)
|
if ((result = archiver.AddArchivable("_l_items", tab, deep)) != B_OK)
|
||||||
break;
|
break;
|
||||||
ret = archiver.AddArchivable("_view_list", tab->View(), deep);
|
result = archiver.AddArchivable("_view_list", tab->View(), deep);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return archiver.Finish(ret);
|
return archiver.Finish(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -579,7 +521,7 @@ BTabView::AllDetached()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::MessageReceived(BMessage *message)
|
BTabView::MessageReceived(BMessage* message)
|
||||||
{
|
{
|
||||||
switch (message->what) {
|
switch (message->what) {
|
||||||
case B_GET_PROPERTY:
|
case B_GET_PROPERTY:
|
||||||
@@ -591,7 +533,7 @@ BTabView::MessageReceived(BMessage *message)
|
|||||||
BMessage specifier;
|
BMessage specifier;
|
||||||
int32 index;
|
int32 index;
|
||||||
int32 form;
|
int32 form;
|
||||||
const char *property;
|
const char* property;
|
||||||
if (message->GetCurrentSpecifier(&index, &specifier, &form, &property) == B_OK) {
|
if (message->GetCurrentSpecifier(&index, &specifier, &form, &property) == B_OK) {
|
||||||
if (strcmp(property, "Selection") == 0) {
|
if (strcmp(property, "Selection") == 0) {
|
||||||
if (message->what == B_GET_PROPERTY) {
|
if (message->what == B_GET_PROPERTY) {
|
||||||
@@ -651,7 +593,7 @@ BTabView::MessageReceived(BMessage *message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::KeyDown(const char *bytes, int32 numBytes)
|
BTabView::KeyDown(const char* bytes, int32 numBytes)
|
||||||
{
|
{
|
||||||
if (IsHidden())
|
if (IsHidden())
|
||||||
return;
|
return;
|
||||||
@@ -687,34 +629,34 @@ BTabView::KeyDown(const char *bytes, int32 numBytes)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::MouseDown(BPoint point)
|
BTabView::MouseDown(BPoint where)
|
||||||
{
|
{
|
||||||
if (point.y > fTabHeight)
|
if (where.y > fTabHeight)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (int32 i = 0; i < CountTabs(); i++) {
|
for (int32 i = 0; i < CountTabs(); i++) {
|
||||||
if (TabFrame(i).Contains(point)
|
if (TabFrame(i).Contains(where)
|
||||||
&& i != Selection()) {
|
&& i != Selection()) {
|
||||||
Select(i);
|
Select(i);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BView::MouseDown(point);
|
BView::MouseDown(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::MouseUp(BPoint point)
|
BTabView::MouseUp(BPoint where)
|
||||||
{
|
{
|
||||||
BView::MouseUp(point);
|
BView::MouseUp(where);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::MouseMoved(BPoint point, uint32 transit, const BMessage *message)
|
BTabView::MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage)
|
||||||
{
|
{
|
||||||
BView::MouseMoved(point, transit, message);
|
BView::MouseMoved(where, transit, dragMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -734,7 +676,7 @@ BTabView::Select(int32 index)
|
|||||||
if (index < 0 || index >= CountTabs())
|
if (index < 0 || index >= CountTabs())
|
||||||
index = Selection();
|
index = Selection();
|
||||||
|
|
||||||
BTab *tab = TabAt(Selection());
|
BTab* tab = TabAt(Selection());
|
||||||
|
|
||||||
if (tab)
|
if (tab)
|
||||||
tab->Deselect();
|
tab->Deselect();
|
||||||
@@ -786,16 +728,16 @@ BTabView::WindowActivated(bool active)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::MakeFocus(bool focused)
|
BTabView::MakeFocus(bool focus)
|
||||||
{
|
{
|
||||||
BView::MakeFocus(focused);
|
BView::MakeFocus(focus);
|
||||||
|
|
||||||
SetFocusTab(Selection(), focused);
|
SetFocusTab(Selection(), focus);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::SetFocusTab(int32 tab, bool focused)
|
BTabView::SetFocusTab(int32 tab, bool focus)
|
||||||
{
|
{
|
||||||
if (tab >= CountTabs())
|
if (tab >= CountTabs())
|
||||||
tab = 0;
|
tab = 0;
|
||||||
@@ -803,7 +745,7 @@ BTabView::SetFocusTab(int32 tab, bool focused)
|
|||||||
if (tab < 0)
|
if (tab < 0)
|
||||||
tab = CountTabs() - 1;
|
tab = CountTabs() - 1;
|
||||||
|
|
||||||
if (focused) {
|
if (focus) {
|
||||||
if (tab == fFocus)
|
if (tab == fFocus)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@@ -1080,9 +1022,9 @@ BTabView::ResizeToPreferred()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::GetPreferredSize(float *width, float *height)
|
BTabView::GetPreferredSize(float* _width, float* _height)
|
||||||
{
|
{
|
||||||
BView::GetPreferredSize(width, height);
|
BView::GetPreferredSize(_width, _height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1144,25 +1086,25 @@ BTabView::PreferredSize()
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::FrameMoved(BPoint newLocation)
|
BTabView::FrameMoved(BPoint newPosition)
|
||||||
{
|
{
|
||||||
BView::FrameMoved(newLocation);
|
BView::FrameMoved(newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::FrameResized(float width,float height)
|
BTabView::FrameResized(float newWidth, float newHeight)
|
||||||
{
|
{
|
||||||
BView::FrameResized(width, height);
|
BView::FrameResized(newWidth, newHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// #pragma mark -
|
// #pragma mark -
|
||||||
|
|
||||||
|
|
||||||
BHandler *
|
BHandler*
|
||||||
BTabView::ResolveSpecifier(BMessage *message, int32 index,
|
BTabView::ResolveSpecifier(BMessage* message, int32 index,
|
||||||
BMessage *specifier, int32 what, const char *property)
|
BMessage* specifier, int32 what, const char* property)
|
||||||
{
|
{
|
||||||
BPropertyInfo propInfo(sPropertyList);
|
BPropertyInfo propInfo(sPropertyList);
|
||||||
|
|
||||||
@@ -1174,7 +1116,7 @@ BTabView::ResolveSpecifier(BMessage *message, int32 index,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BTabView::GetSupportedSuites(BMessage *message)
|
BTabView::GetSupportedSuites(BMessage* message)
|
||||||
{
|
{
|
||||||
message->AddString("suites", "suite/vnd.Be-tab-view");
|
message->AddString("suites", "suite/vnd.Be-tab-view");
|
||||||
|
|
||||||
@@ -1189,7 +1131,7 @@ BTabView::GetSupportedSuites(BMessage *message)
|
|||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BTabView::AddTab(BView *target, BTab *tab)
|
BTabView::AddTab(BView* target, BTab* tab)
|
||||||
{
|
{
|
||||||
if (tab == NULL)
|
if (tab == NULL)
|
||||||
tab = new BTab(target);
|
tab = new BTab(target);
|
||||||
@@ -1208,13 +1150,13 @@ BTabView::AddTab(BView *target, BTab *tab)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTab *
|
BTab*
|
||||||
BTabView::RemoveTab(int32 index)
|
BTabView::RemoveTab(int32 index)
|
||||||
{
|
{
|
||||||
if (index < 0 || index >= CountTabs())
|
if (index < 0 || index >= CountTabs())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
BTab *tab = (BTab *)fTabList->RemoveItem(index);
|
BTab* tab = (BTab*)fTabList->RemoveItem(index);
|
||||||
if (tab == NULL)
|
if (tab == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
@@ -1237,10 +1179,10 @@ BTabView::RemoveTab(int32 index)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BTab *
|
BTab*
|
||||||
BTabView::TabAt(int32 index) const
|
BTabView::TabAt(int32 index) const
|
||||||
{
|
{
|
||||||
return (BTab *)fTabList->ItemAt(index);
|
return (BTab*)fTabList->ItemAt(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1299,7 +1241,7 @@ BTabView::Border() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView *
|
BView*
|
||||||
BTabView::ContainerView() const
|
BTabView::ContainerView() const
|
||||||
{
|
{
|
||||||
return fContainerView;
|
return fContainerView;
|
||||||
@@ -1313,10 +1255,10 @@ BTabView::CountTabs() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BView *
|
BView*
|
||||||
BTabView::ViewForTab(int32 tabIndex) const
|
BTabView::ViewForTab(int32 tabIndex) const
|
||||||
{
|
{
|
||||||
BTab *tab = TabAt(tabIndex);
|
BTab* tab = TabAt(tabIndex);
|
||||||
if (tab)
|
if (tab)
|
||||||
return tab->View();
|
return tab->View();
|
||||||
|
|
||||||
@@ -1493,4 +1435,3 @@ B_IF_GCC_2(_ReservedTabView1__8BTabView, _ZN8BTabView17_ReservedTabView1Ev)(
|
|||||||
{
|
{
|
||||||
tabView->BTabView::SetBorder(border);
|
tabView->BTabView::SetBorder(border);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user