Merge pull request #6 from KapiX/tabview-fix

Fix crashes and mismatched tabs in TabView.
This commit is contained in:
Jim Saxton 2018-04-19 11:48:02 -07:00 committed by GitHub
commit 44c8183cc1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 6 deletions

View File

@ -392,7 +392,7 @@ int YabInterface::CloseWindow(const char* view)
{
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(is_kind_of(child, YabBitmapView))
@ -409,7 +409,7 @@ int YabInterface::CloseWindow(const char* view)
{
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(viewList->GetView(subchild->Name()))
@ -3385,7 +3385,7 @@ void YabInterface::WindowClear(const char* window)
{
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(is_kind_of(child, YabBitmapView))
@ -3400,7 +3400,7 @@ void YabInterface::WindowClear(const char* window)
{
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(viewList->GetView(subchild->Name()))
@ -3465,7 +3465,7 @@ void YabInterface::RemoveView(BView *myView)
{
YabView *t = (YabView*)((YabTabView*)child)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(is_kind_of(child, YabBitmapView))
@ -3480,7 +3480,7 @@ void YabInterface::RemoveView(BView *myView)
{
YabView *t = (YabView*)((YabTabView*)subchild)->TabAt(i)->View();
RemoveView(t);
viewList->DelView(t->Name());
viewList->DelView(t->NameForTabView());
}
}
if(viewList->GetView(subchild->Name()))

View File

@ -48,6 +48,11 @@ YabView::YabView(BRect frame, const char *name, uint32 resizingMode, uint32 flag
dropZone = false;
pressedKeys.SetTo("");
SetDrawingMode(B_OP_COPY);
// BTab uses view Name() as displayed label storage, so SetLabel changes it
// this interferes with yab method of referencing views by name
// to be removed
nameWAForTabView = name;
}
YabView::~YabView()

View File

@ -27,6 +27,7 @@ class YabView : public BView
virtual void MouseDown(BPoint point);
virtual void KeyUp(const char *bytes, int32 numBytes);
virtual void KeyDown(const char *bytes, int32 numBytes);
const char* NameForTabView() { return nameWAForTabView; }
BList *drawList;
int mouseMovedInfo;
int mouseStateInfo;
@ -39,6 +40,8 @@ class YabView : public BView
BString pressedKeys;
private:
int prevMouseStateInfo;
// TODO: revisit at a later time, more info in constructor
BString nameWAForTabView;
};
#endif