TabView: Lots of style fixes.
This commit is contained in:
@@ -21,7 +21,7 @@ enum tab_position {
|
|||||||
|
|
||||||
class BTab : public BArchivable {
|
class BTab : public BArchivable {
|
||||||
public:
|
public:
|
||||||
BTab(BView* tabView = NULL);
|
BTab(BView* contentsView = NULL);
|
||||||
virtual ~BTab();
|
virtual ~BTab();
|
||||||
|
|
||||||
BTab(BMessage* archive);
|
BTab(BMessage* archive);
|
||||||
|
|||||||
@@ -48,12 +48,12 @@ static property_info sPropertyList[] = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
BTab::BTab(BView* tabView)
|
BTab::BTab(BView* contentsView)
|
||||||
:
|
:
|
||||||
fEnabled(true),
|
fEnabled(true),
|
||||||
fSelected(false),
|
fSelected(false),
|
||||||
fFocus(false),
|
fFocus(false),
|
||||||
fView(tabView),
|
fView(contentsView),
|
||||||
fTabView(NULL)
|
fTabView(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -78,7 +78,7 @@ BTab::BTab(BMessage* archive)
|
|||||||
|
|
||||||
BTab::~BTab()
|
BTab::~BTab()
|
||||||
{
|
{
|
||||||
if (!fView)
|
if (fView == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fSelected)
|
if (fSelected)
|
||||||
@@ -122,7 +122,7 @@ BTab::Perform(uint32 d, void* arg)
|
|||||||
const char*
|
const char*
|
||||||
BTab::Label() const
|
BTab::Label() const
|
||||||
{
|
{
|
||||||
if (fView)
|
if (fView != NULL)
|
||||||
return fView->Name();
|
return fView->Name();
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -132,7 +132,7 @@ BTab::Label() const
|
|||||||
void
|
void
|
||||||
BTab::SetLabel(const char* label)
|
BTab::SetLabel(const char* label)
|
||||||
{
|
{
|
||||||
if (!label || !fView)
|
if (label == NULL || fView == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fView->SetName(label);
|
fView->SetName(label);
|
||||||
@@ -154,12 +154,12 @@ BTab::Select(BView* owner)
|
|||||||
{
|
{
|
||||||
fSelected = true;
|
fSelected = true;
|
||||||
|
|
||||||
if (!owner || !View())
|
if (owner == NULL || fView == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// NOTE: Views are not added/removed, if there is layout,
|
// NOTE: Views are not added/removed, if there is layout,
|
||||||
// they are made visible/invisible in that case.
|
// they are made visible/invisible in that case.
|
||||||
if (!owner->GetLayout() && View()->Parent() == NULL)
|
if (owner->GetLayout() == NULL && fView->Parent() == NULL)
|
||||||
owner->AddChild(fView);
|
owner->AddChild(fView);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -167,16 +167,16 @@ BTab::Select(BView* owner)
|
|||||||
void
|
void
|
||||||
BTab::Deselect()
|
BTab::Deselect()
|
||||||
{
|
{
|
||||||
if (View()) {
|
if (fView != NULL) {
|
||||||
// NOTE: Views are not added/removed, if there is layout,
|
// NOTE: Views are not added/removed, if there is layout,
|
||||||
// they are made visible/invisible in that case.
|
// they are made visible/invisible in that case.
|
||||||
bool removeView = false;
|
bool removeView = false;
|
||||||
BView* container = View()->Parent();
|
BView* container = fView->Parent();
|
||||||
if (container)
|
if (container != NULL)
|
||||||
removeView =
|
removeView =
|
||||||
dynamic_cast<BCardLayout*>(container->GetLayout()) == NULL;
|
dynamic_cast<BCardLayout*>(container->GetLayout()) == NULL;
|
||||||
if (removeView)
|
if (removeView)
|
||||||
View()->RemoveSelf();
|
fView->RemoveSelf();
|
||||||
}
|
}
|
||||||
|
|
||||||
fSelected = false;
|
fSelected = false;
|
||||||
@@ -214,7 +214,7 @@ BTab::IsFocus() const
|
|||||||
void
|
void
|
||||||
BTab::SetView(BView* view)
|
BTab::SetView(BView* view)
|
||||||
{
|
{
|
||||||
if (!view || fView == view)
|
if (view == NULL || fView == view)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (fView != NULL) {
|
if (fView != NULL) {
|
||||||
@@ -692,16 +692,16 @@ BTabView::Select(int32 index)
|
|||||||
tab->Deselect();
|
tab->Deselect();
|
||||||
|
|
||||||
tab = TabAt(index);
|
tab = TabAt(index);
|
||||||
if (tab && ContainerView()) {
|
if (tab != NULL && fContainerView != NULL) {
|
||||||
if (index == 0)
|
if (index == 0)
|
||||||
fTabOffset = 0.0f;
|
fTabOffset = 0.0f;
|
||||||
tab->Select(ContainerView());
|
tab->Select(fContainerView);
|
||||||
fSelection = index;
|
fSelection = index;
|
||||||
|
|
||||||
// make the view visible through the layout if there is one
|
// make the view visible through the layout if there is one
|
||||||
BCardLayout* layout
|
BCardLayout* layout
|
||||||
= dynamic_cast<BCardLayout*>(fContainerView->GetLayout());
|
= dynamic_cast<BCardLayout*>(fContainerView->GetLayout());
|
||||||
if (layout)
|
if (layout != NULL)
|
||||||
layout->SetVisibleItem(index);
|
layout->SetVisibleItem(index);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1080,7 +1080,7 @@ BSize
|
|||||||
BTabView::PreferredSize()
|
BTabView::PreferredSize()
|
||||||
{
|
{
|
||||||
BSize size;
|
BSize size;
|
||||||
if (GetLayout())
|
if (GetLayout() != NULL)
|
||||||
size = GetLayout()->PreferredSize();
|
size = GetLayout()->PreferredSize();
|
||||||
else {
|
else {
|
||||||
size = _TabsMinSize();
|
size = _TabsMinSize();
|
||||||
@@ -1271,7 +1271,7 @@ BView*
|
|||||||
BTabView::ViewForTab(int32 tabIndex) const
|
BTabView::ViewForTab(int32 tabIndex) const
|
||||||
{
|
{
|
||||||
BTab* tab = TabAt(tabIndex);
|
BTab* tab = TabAt(tabIndex);
|
||||||
if (tab)
|
if (tab != NULL)
|
||||||
return tab->View();
|
return tab->View();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
@@ -1281,7 +1281,7 @@ BTabView::ViewForTab(int32 tabIndex) const
|
|||||||
void
|
void
|
||||||
BTabView::_InitObject(bool layouted, button_width width)
|
BTabView::_InitObject(bool layouted, button_width width)
|
||||||
{
|
{
|
||||||
if (!be_control_look)
|
if (be_control_look == NULL)
|
||||||
SetFont(be_bold_font);
|
SetFont(be_bold_font);
|
||||||
|
|
||||||
fTabList = new BList;
|
fTabList = new BList;
|
||||||
@@ -1312,17 +1312,17 @@ BTabView::_InitContainerView(bool layouted)
|
|||||||
bool needsLayout = false;
|
bool needsLayout = false;
|
||||||
bool createdContainer = false;
|
bool createdContainer = false;
|
||||||
if (layouted) {
|
if (layouted) {
|
||||||
if (!GetLayout()) {
|
if (GetLayout() == NULL) {
|
||||||
SetLayout(new(nothrow) BGroupLayout(B_HORIZONTAL));
|
SetLayout(new(nothrow) BGroupLayout(B_HORIZONTAL));
|
||||||
needsLayout = true;
|
needsLayout = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fContainerView) {
|
if (fContainerView == NULL) {
|
||||||
fContainerView = new BView("view container", B_WILL_DRAW);
|
fContainerView = new BView("view container", B_WILL_DRAW);
|
||||||
fContainerView->SetLayout(new(std::nothrow) BCardLayout());
|
fContainerView->SetLayout(new(std::nothrow) BCardLayout());
|
||||||
createdContainer = true;
|
createdContainer = true;
|
||||||
}
|
}
|
||||||
} else if (!fContainerView) {
|
} else if (fContainerView == NULL) {
|
||||||
fContainerView = new BView(Bounds(), "view container", B_FOLLOW_ALL,
|
fContainerView = new BView(Bounds(), "view container", B_FOLLOW_ALL,
|
||||||
B_WILL_DRAW);
|
B_WILL_DRAW);
|
||||||
createdContainer = true;
|
createdContainer = true;
|
||||||
@@ -1392,7 +1392,7 @@ BTabView::_LayoutContainerView(bool layouted)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
BGroupLayout* layout = dynamic_cast<BGroupLayout*>(GetLayout());
|
BGroupLayout* layout = dynamic_cast<BGroupLayout*>(GetLayout());
|
||||||
if (layout) {
|
if (layout != NULL) {
|
||||||
layout->SetInsets(borderWidth, borderWidth + TabHeight()
|
layout->SetInsets(borderWidth, borderWidth + TabHeight()
|
||||||
- topBorderOffset, borderWidth, borderWidth);
|
- topBorderOffset, borderWidth, borderWidth);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user