3 enum CodeObjectType { typeClass, typeData, typeMethod, typeEvent, typeProperty, typeNameSpace, typeDataType, typeEnumValue, typeDataPrivate, typeMethodPrivate, typePropertyPrivate };
5 // patch for GCC 4.4 bug (Can't make it static or the patch won't work)
6 /*static*/ int mystrlen(const char * s)
10 #define strlen mystrlen
12 class CodeObject : struct
21 BitmapResource bitmap;
24 ClassFunction function;
25 Button attachBtn, detachBtn, deleteBtn;
28 void OnDisplay(Surface surface, int x, int y, int width, CodeEditor editor, Alignment alignment, DataDisplayFlags displayFlags)
30 int indent = displayFlags.dropBox ? 0 : 10;
32 const char * name = object ? (object.name ? object.name : $"(unnamed)") : this.name;
33 int nameLen = strlen(name);
35 Bitmap icon = bitmap ? bitmap.bitmap : editor.icons[type].bitmap;
37 textOffset = this.indent * indent + (icon ? (/*icon.width + 4*/ 20) : 0);
38 if(overriden || object)
39 surface.TextFont(editor.boldFont.font);
41 surface.TextFont(editor.normalFont.font);
43 surface.WriteTextDots(alignment, x + textOffset, y + 2, width - textOffset, name, nameLen);
45 surface.Blit(icon, x + (20 - icon.width) / 2 + this.indent * indent,y + 2,0,0, icon.width, icon.height);
53 strcpy(text, object.instance._class.name);
55 surface.TextExtent(name, nameLen, &nameW, null);
57 surface.TextFont(editor.normalFont.font);
58 surface.WriteTextDots(left, x + textOffset + nameW + 10, y + 2, width - (x + textOffset + nameW + 10), text, len);
61 if(overriden == 2 /*&& codeObject.function*/)
64 const char * text = function ? function.declarator.symbol.string : "";
65 int len = strlen(text);
69 surface.TextExtent(name, nameLen, &nameW, null);
70 surface.TextExtent(text, len, &w, null);
72 start = x + textOffset + nameW + 10;
74 surface.WriteTextDots(right, start, y + 2, width - start - 16, text, len);
82 if(function && function.declarator && function.declarator.symbol && !function.declarator.symbol.type)
83 FreeClassFunction(function);
100 while(compatible = this.compatible.first)
102 ClassFunction function = compatible.data;
104 if(function && function.declarator && function.declarator.symbol && !function.declarator.symbol.type)
105 FreeClassFunction(function);
107 this.compatible.Delete(compatible);
112 const char * OnGetString(char * string, void * fieldData, bool * needClass)
114 return name ? name : "";
117 int OnCompare(CodeObject b)
120 if(type == typeEvent && b.type == typeMethod)
121 result = eventsUp ? -1 : 1;
122 else if(type == typeMethod && b.type == typeEvent)
123 result = eventsUp ? 1 : -1;
124 else if(name && b.name)
125 result = strcmpi(name, b.name);
126 else if(!name && b.name)
128 else if(name && !b.name)