Files
Yab2Cpp/src/YabView.h
Kacper Kasper 076496e45d Fix crashes and mismatched tabs in TabView.
* Default BTab uses view's name property as tab label, so
  SetLabel changes that value. However, view names are important
  for yab and this would cause inconsistencies in view lists yab
  stores for referencing them by name. Views attached to tabs would
  not be removed because there is no name "Tab1" in the index
  (there is "Test1", which is the view's original name).
  Later, when asking for view with the same name created later yab
  could get wrong view (if lucky) or crash (if unlucky).
  This commit fixes that by storing original name in YabView
  property, and using that for removing views from the hierarchy.
* Fixes #5.
2018-04-15 17:48:44 +02:00

48 lines
1.1 KiB
C++

#ifndef YABVIEW_H
#define YABVIEW_H
#include <String.h>
#include <View.h>
struct YabDrawing
{
int command;
double x1,y1,x2,y2,x3,y3,x4,y4;
int r,g,b,alpha;
const char* chardata;
pattern p;
BBitmap *bitmap;
BFont font;
};
class YabView : public BView
{
public:
YabView(BRect frame, const char *name, uint32 resizingMode, uint32 flags);
~YabView();
virtual void MessageReceived(BMessage *msg);
virtual void Draw(BRect updateRect);
virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message);
virtual void MouseUp(BPoint point);
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;
int mouseX;
int mouseY;
uint mouseLButton;
uint mouseMButton;
uint mouseRButton;
bool dropZone;
BString pressedKeys;
private:
int prevMouseStateInfo;
// TODO: revisit at a later time, more info in constructor
BString nameWAForTabView;
};
#endif