16 #include "TMethodArg.h"
17 #include "TMethodCall.h"
23 TList *lst =
new TList;
24 cl->GetMenuItems(lst);
29 Bool_t has_editor = kFALSE;
31 TClass *last_class =
nullptr;
33 while ((m = (TMethod *)iter()) !=
nullptr) {
35 Bool_t is_editor = kFALSE;
37 if (strcmp(m->GetClass()->GetName(),
"TH1") == 0) {
38 if (strcmp(m->GetName(),
"SetHighlight") == 0)
continue;
39 if (strcmp(m->GetName(),
"DrawPanel") == 0) is_editor = kTRUE;
40 }
else if (strcmp(m->GetClass()->GetName(),
"TGraph") == 0) {
41 if (strcmp(m->GetName(),
"SetHighlight") == 0)
continue;
42 if (strcmp(m->GetName(),
"DrawPanel") == 0) is_editor = kTRUE;
43 }
else if (strcmp(m->GetClass()->GetName(),
"TAttFill") == 0) {
44 if (strcmp(m->GetName(),
"SetFillAttributes") == 0) is_editor = kTRUE;
45 }
else if (strcmp(m->GetClass()->GetName(),
"TAttLine") == 0) {
46 if (strcmp(m->GetName(),
"SetLineAttributes") == 0) is_editor = kTRUE;
47 }
else if (strcmp(m->GetClass()->GetName(),
"TAttMarker") == 0) {
48 if (strcmp(m->GetName(),
"SetMarkerAttributes") == 0) is_editor = kTRUE;
49 }
else if (strcmp(m->GetClass()->GetName(),
"TAttText") == 0) {
50 if (strcmp(m->GetName(),
"SetTextAttributes") == 0) is_editor = kTRUE;
55 AddMenuItem(
"Editor",
"Attributes editor",
"Show:Editor", last_class ? last_class : m->GetClass());
61 last_class = m->GetClass();
63 if (m->IsMenuItem() == kMenuToggle) {
65 if (m->Getter() && strlen(m->Getter()) > 0) {
67 }
else if (strncmp(m->GetName(),
"Set", 3) == 0) {
68 getter = TString(m->GetName())(3, strlen(m->GetName()) - 3);
69 if (cl->GetMethodAllAny(TString(
"Has") + getter))
70 getter = TString(
"Has") + getter;
71 else if (cl->GetMethodAllAny(TString(
"Get") + getter))
72 getter = TString(
"Get") + getter;
73 else if (cl->GetMethodAllAny(TString(
"Is") + getter))
74 getter = TString(
"Is") + getter;
79 if ((getter.Length() > 0) && cl->GetMethodAllAny(getter)) {
82 TMethodCall *call =
new TMethodCall(cl, getter,
"");
84 if (call->ReturnType() == TMethodCall::kLong) {
86 call->Execute(obj, l);
88 AddChkMenuItem(m->GetName(), m->GetTitle(), l != 0, Form(
"%s(%s)", m->GetName(), (l != 0) ?
"0" :
"1"), m->GetClass());
97 TList *args = m->GetListOfMethodArgs();
99 if (!args || (args->GetSize() == 0)) {
100 AddMenuItem(m->GetName(), m->GetTitle(), Form(
"%s()", m->GetName()), m->GetClass());
103 item->
SetExec(Form(
"%s()", m->GetName()));
104 if (m->GetClass()) item->
SetClassName(m->GetClass()->GetName());
106 TIter args_iter(args);
107 TMethodArg *arg =
nullptr;
109 while ((arg = dynamic_cast<TMethodArg *>(args_iter())) !=
nullptr) {
110 const char *dflt = arg->GetDefault();
111 if (!dflt) dflt =
"";
112 item->
GetArgs().emplace_back(arg->GetName(), arg->GetTitle(), arg->GetFullTypeName(), dflt);