TRef<IObject> Apply(ObjectStack& stack) { TRef<StringValue> pstring; CastTo(pstring, (IObject*)stack.Pop()); TRef<ColorValue> pcolor; CastTo(pcolor, (IObject*)stack.Pop()); TRef<PointValue> ppointSize; WinPoint ptSize; if (stack.GetCount() > 0) { CastTo(ppointSize, (IObject*)stack.Pop()); ptSize = WinPoint( (int)ppointSize->GetValue().X(), (int)ppointSize->GetValue().Y() ); } Justification justification = JustifyLeft(); if (stack.GetCount() > 0) { TRef<Number> pjustify = Number::Cast((IObject*)stack.Pop()); justification.SetWord((DWORD)pjustify->GetValue()); } TRef<IEngineFont> pfont = TrekResources::SmallFont(); if (stack.GetCount() > 0) { TRef<FontValue> pfontLocal; CastTo(pfontLocal, (IObject*)stack.Pop()); pfont = pfontLocal->GetValue(); } bool bRightClip = false; if (stack.GetCount() > 0) bRightClip = GetBoolean((IObject*)stack.Pop()); TRef<StringValuePane> ppane; if (ppointSize) { if (bRightClip) justification = JustifyLeftClipRight(); ppane = new StringValuePane(pstring, pcolor, pfont, ptSize, justification); } else ppane = new StringValuePane(pstring, pcolor, pfont); return (Pane*)ppane; }
TRef<IObject> Apply(ObjectStack& stack) { TRef<Image> pimage; CastTo(pimage, (Value*)(IObject*)stack.Pop()); TRef<Number> pnumberFaces; CastTo(pnumberFaces, (IObject*)stack.Pop()); bool bActAsTabs = false; TVector<int> m_vecColumns; ParseIntVector((IObject*)stack.Pop(), m_vecColumns); if (stack.GetCount() > 0) { TRef<Boolean> pbooleanActAsTabs; CastTo(pbooleanActAsTabs, (IObject*)stack.Pop()); bActAsTabs = pbooleanActAsTabs->GetValue(); } TRef<ButtonBarPane> pbuttonbar = CreateButtonBarPane( pimage->GetSurface(), (DWORD)pnumberFaces->GetValue(), m_vecColumns, bActAsTabs ); pbuttonbar->GetMouseEnterWhileEnabledEventSource()->AddSink(new SoundIDEventSink(mouseoverSound)); pbuttonbar->GetEventSource()->AddSink(new SoundIDEventSink(mouseclickSound)); return pbuttonbar; }
TRef<IObject> Apply(ObjectStack& stack) { TRef<Number> pnumber; CastTo(pnumber, (IObject*)stack.Pop()); TRef<IObjectList> plist; CastTo(plist, (IObject*)stack.Pop()); TRef<SwitchValuePane> ppane = new SwitchValuePane(pnumber); plist->GetFirst(); while (plist->GetCurrent() != NULL) { IObjectPair* ppair; CastTo(ppair, plist->GetCurrent()); TRef<Pane> ppaneChild; CastTo(ppaneChild, (Pane*)ppair->GetFirst()); TRef<Number> pnumberChildID = Number::Cast(ppair->GetSecond()); ppane->InsertPane(ppaneChild, (int)pnumberChildID->GetValue()); plist->GetNext(); } if (stack.GetCount() > 0) { TRef<Pane> ppaneDefault; CastTo(ppaneDefault, (Pane*)(IObject*)stack.Pop()); ppane->SetDefaultPane(ppaneDefault); } return (Pane*)ppane; }
TRef<IObject> Apply(ObjectStack& stack) { TVector<int> m_vecColumns; ParseIntVector((IObject*)stack.Pop(), m_vecColumns); TVector<ZString> m_vecColumnsNames; ParseStringVector((IObject*)stack.Pop(), m_vecColumnsNames); TRef<Number> pnumberFaces; CastTo(pnumberFaces, (IObject*)stack.Pop()); bool bActAsTabs = false; if (stack.GetCount() > 0) { TRef<Boolean> pbooleanActAsTabs; CastTo(pbooleanActAsTabs, (IObject*)stack.Pop()); bActAsTabs = pbooleanActAsTabs->GetValue(); } TRef<ButtonBarPane> pbuttonbar = CreateButtonBarPane(bActAsTabs,false); int count = m_vecColumns.GetCount(); int xprev = 0; for (int index = 0; index < count; index++) { int x = m_vecColumns[index]; WinPoint p = TrekResources::SmallFont()->GetTextExtent(m_vecColumnsNames[index]); TRef<StringPane> s1 = new StringPane( m_vecColumnsNames[index], TrekResources::SmallFont(), WinPoint(x-xprev,p.Y()), JustifyLeft()); TRef<StringPane> s2 = new StringPane( m_vecColumnsNames[index], TrekResources::SmallBoldFont(), WinPoint(x-xprev,p.Y()), JustifyLeft()); s1->SetOpaque(true); s1->SetTextColor(Color::White()); s2->SetOpaque(true); s2->SetTextColor(Color::Yellow()); pbuttonbar->InsertButton(CreateButton(CreateButtonFacePane(s1,s2)),index); xprev = x; } pbuttonbar->GetMouseEnterWhileEnabledEventSource()->AddSink(new SoundIDEventSink(mouseoverSound)); pbuttonbar->GetEventSource()->AddSink(new SoundIDEventSink(mouseclickSound)); return pbuttonbar; }