本文整理汇总了C++中IWidget类的典型用法代码示例。如果您正苦于以下问题:C++ IWidget类的具体用法?C++ IWidget怎么用?C++ IWidget使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IWidget类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ASSERT_NULL
void WidgetContainer::OnInputPointerMove(const EventInputPointer *ev)
{
ASSERT_NULL(ev);
WidgetIterator it = vWidget.begin();
WidgetIterator end = vWidget.end();
for (; it != end; ++it)
{
IWidget *w = (*it);
ASSERT_NULL(w);
bEventConsumed = FALSE;
if (w->IsDisabled())
continue;
if (w->GetObjectType() == Seed::ObjectGuiWidgetContainer)
{
WidgetContainer *wc = reinterpret_cast<WidgetContainer *>(w);
wc->OnInputPointerMove(ev);
bEventConsumed = wc->IsEventConsumed();
if (bEventConsumed)
break;
}
bEventConsumed = this->UpdateStates(ev, w);
//if (UpdateStates(ev, w))
if (bEventConsumed)
break;
}
}
示例2: SetSizeOf
void
SetSizeOf(IWidget& wgt, const Size& s)
{
wgt.GetRenderer().SetSize(s);
wgt.GetView().SetSize(s);
CallEvent<Resize>(wgt, UIEventArgs(wgt));
}
示例3: main
int main()
{
LinuxFactory* linuxFactory = new (LinuxFactory);
IFactory* ifactory = &linuxFactory->ifactory;
IWidget* iwidget = ifactory->createWidget(ifactory);
iwidget->show(iwidget);
IButton* ibutton = ifactory->createButton(ifactory);
ibutton->click(ibutton);
delete (LinuxWidget, container_of(iwidget, LinuxWidget, iwidget));
delete (LinuxButton, container_of(ibutton, LinuxButton, ibutton));
MacFactory* macFactory = new (MacFactory);
ifactory = &macFactory->ifactory;
iwidget = ifactory->createWidget(ifactory);
iwidget->show(iwidget);
ibutton = ifactory->createButton(ifactory);
ibutton->click(ibutton);
delete (MacWidget, container_of(iwidget, MacWidget, iwidget));
delete (MacButton, container_of(ibutton, MacButton, ibutton));
WindowsFactory* windowsFactory = new (WindowsFactory);
ifactory = &windowsFactory->ifactory;
iwidget = ifactory->createWidget(ifactory);
iwidget->show(iwidget);
ibutton = ifactory->createButton(ifactory);
ibutton->click(ibutton);
delete (WindowsWidget, container_of(iwidget, WindowsWidget, iwidget));
delete (WindowsButton, container_of(ibutton, WindowsButton, ibutton));
delete (LinuxFactory, linuxFactory);
delete (MacFactory, macFactory);
delete (WindowsFactory, windowsFactory);
return 0;
}
示例4: deregisterDrawable
//-----------------------------------------------------------------
void
MenuOptions::prepareMenu()
{
if (m_container) {
deregisterDrawable(m_container);
delete m_container;
m_container = NULL;
}
Labels labels(Path::dataReadPath("script/labels.lua"));
IWidget *soundBox = createSoundPanel(labels);
IWidget *musicBox = createMusicPanel(labels);
VBox *vbox = new VBox();
vbox->addWidget(soundBox);
vbox->addWidget(new WiSpace(0, 10));
vbox->addWidget(musicBox);
vbox->addWidget(new WiSpace(0, 10));
vbox->addWidget(createLangPanel(labels));
vbox->addWidget(new WiSpace(0, 5));
vbox->addWidget(createSpeechPanel(labels));
vbox->addWidget(new WiSpace(0, 5));
vbox->addWidget(createSubtitlesPanel(labels));
IWidget *backButton = createBackButton(labels);
m_statusBar = createStatusBar(musicBox->getW() - backButton->getW());
HBox *backBox = new HBox();
backBox->addWidget(m_statusBar);
backBox->addWidget(backButton);
vbox->addWidget(backBox);
m_container = vbox;
registerDrawable(m_container);
}
示例5: main
int main(void)
{
IWidget* aWidget;
aWidget = new ILoveGeraldine(new BorderDecorator(new ScrollDecorator(new BorderDecorator(new TextField(80, 24)))));
aWidget->draw();
delete aWidget;
}
示例6: WiButton
//-----------------------------------------------------------------
IWidget *
MenuOptions::createBackButton(const Labels &labels)
{
IWidget *button = new WiButton(
new WiPicture(Path::dataReadPath("images/menu/back.png")),
new SimpleMsg(this, "quit"));
button->setTip(labels.getLabel("menu_back"));
return button;
}
示例7: InvalidateChildren
void
InvalidateChildren(IWidget& wgt, const Rect& bounds)
{
Rect r(wgt.GetRenderer().CommitInvalidation(bounds));
for(auto pr(wgt.GetChildren()); pr.first != pr.second; ++pr.first)
{
auto& child(*pr.first);
InvalidateChildren(child, Rect(r - GetLocationOf(child)));
}
}
示例8: Update
void WidgetContainer::Update(f32 dt)
{
WidgetIterator it = vWidget.begin();
WidgetIterator end = vWidget.end();
for (; it != end; ++it)
{
IWidget *w = (*it);
ASSERT_NULL(w);
w->Update(dt);
}
std::sort(vWidget.begin(), vWidget.end(), ITransformable2DDescendingPrioritySort());
}
示例9: SetDisabled
INLINE void WidgetContainer::SetDisabled(BOOL b)
{
IWidget::SetDisabled(b);
WidgetIterator it = vWidget.begin();
WidgetIterator end = vWidget.end();
for (; it != end; ++it)
{
IWidget *w = (*it);
ASSERT_NULL(w);
w->SetDisabled(b);
}
}
示例10: Render
INLINE void WidgetContainer::Render()
{
WidgetIterator it = vWidget.begin();
WidgetIterator end = vWidget.end();
for (; it != end; ++it)
{
IWidget *w = (*it);
ASSERT_NULL(w);
w->Render();
}
if (pConfiguration->bDebugContainer)
pRendererDevice->DrawRect(this->GetX(), this->GetY(), this->GetWidth(), this->GetHeight(), PIXEL_COLOR(255, 0, 255, 255));
}
示例11: PaintChild
void
PaintChild(IWidget& wgt, PaintEventArgs&& e)
{
auto& sender(e.GetSender());
if(Clip(e.ClipArea, Rect(e.Location += GetLocationOf(sender),
GetSizeOf(sender))))
wgt.GetRenderer().Paint(sender, std::move(e));
}
示例12: onTouchDown
void onTouchDown(int x, int y)
{
Point pt(x,y);
if ( m_activeButton )
{
m_activeButton->onTouchUp( Point(-1,-1) );
m_activeButton = NULL;
}
IWidget* wdgt = m_activePane ? m_activePane->hitTest(pt) : NULL;
if ( wdgt != NULL )
{
m_activeButton = wdgt;
m_activeButton->onTouchDown(pt);
}
}
示例13: AddChild
void LayoutBox::AddChild (IWidget& child, Align align)
{
BaseWidget::AddChild (child);
items_.Add (&child, align);
if (child.IsFocusable ())
focusables_.Add (&child);
GeneratePosition ();
}
示例14: RemoveChild
void LayoutBox::RemoveChild (IWidget& child)
{
BaseWidget::RemoveChild (child);
items_.Remove (&child);
if (child.IsFocusable ())
focusables_.Remove (&child);
GeneratePosition ();
}
示例15: HandleOnPriorityEvent
bool LayoutBox::HandleOnPriorityEvent (const GuiEvent& guiEvent)
{
if (guiEvent.type == sf::Event::KeyPressed)
{
if (guiEvent.key.code == sf::Keyboard::Tab)
{
if (focusables_.Count () == 0 || !isFocused_)
return false;
IWidget* child;
uint cycle = focusedChild_;
// if current focussable is a layout, give it control for tab
if (focusables_[cycle]->OnPriorityEvent (guiEvent))
return true;
focusedChild_ = (focusedChild_ + 1) % focusables_.Count ();
//Performed a cycle, give control to the parent
if (focusedChild_ == 0)
{
child = focusables_[focusedChild_];
child->SetFocused (true);
eventHandlers_.Remove (child);
eventHandlers_.AddFront (child);
isFocused_ = true; //to make cycle
return false;
}
child = focusables_[focusedChild_];
child->SetFocused (true);
eventHandlers_.Remove (child);
eventHandlers_.AddFront (child);
return true;
}
return false;
}
return false;
}