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; }
void DoCreateButton( Modeler* pmodeler, TRef<ButtonPane>& pbuttonPane, const ZString& str, const WinPoint& offset, Pane* ppane ) { TRef<ButtonFacePane> pface = CreateButtonFacePane( pmodeler->LoadSurface(str, false), ButtonFaceUp | ButtonFaceDown ); pbuttonPane = CreateButton(pface); pbuttonPane->SetOffset(offset); ppane->InsertAtTop(pbuttonPane); }
TRef<IObject> Apply(ObjectStack& stack) { TRef<Image> pimage; CastTo(pimage, (Value*)(IObject*)stack.Pop()); TRef<Number> pnumberFaces; CastTo(pnumberFaces, (IObject*)stack.Pop()); TRef<Boolean> pboolToggle; CastTo(pboolToggle, (IObject*)stack.Pop()); DWORD dwFaces = (DWORD)pnumberFaces->GetValue(); return CreateTrekButton( CreateButtonFacePane( pimage->GetSurface(), dwFaces ), pboolToggle->GetValue(), (dwFaces & ButtonFaceCheckedDown) ? mouseclickSound : positiveButtonClickSound ); }
TRef<IObject> Apply(ObjectStack& stack) { TRef<Image> pimage; CastTo(pimage, (Value*)(IObject*)stack.Pop()); TRef<Number> pnumberFaces; CastTo(pnumberFaces, (IObject*)stack.Pop()); TRef<Boolean> pboolToggle; CastTo(pboolToggle, (IObject*)stack.Pop()); TRef<Number> pnumberClickSoundId; CastTo(pnumberClickSoundId, (IObject*)stack.Pop()); TRef<ButtonPane> pbutton = CreateButton( CreateButtonFacePane( pimage->GetSurface(), (DWORD)pnumberFaces->GetValue() ), pboolToggle->GetValue() ); pbutton->GetMouseEnterWhileEnabledEventSource()->AddSink(new SoundIDEventSink(mouseoverSound)); pbutton->GetEventSource()->AddSink(new SoundIDEventSink((SoundID)pnumberClickSoundId->GetValue())); //pbutton->GetRightEventSource()->AddSink(new SoundIDEventSink((SoundID)pnumberClickSoundId->GetValue())); //Imago NYI 7/10/09 return pbutton; }