本文整理汇总了C++中MythUIType类的典型用法代码示例。如果您正苦于以下问题:C++ MythUIType类的具体用法?C++ MythUIType怎么用?C++ MythUIType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MythUIType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: i
void SubtitleScreen::OptimiseDisplayedArea(void)
{
if (!m_refreshArea)
return;
QRegion visible;
QListIterator<MythUIType *> i(m_ChildrenList);
while (i.hasNext())
{
MythUIType *img = i.next();
visible = visible.united(img->GetArea());
}
if (visible.isEmpty())
return;
QRect bounding = visible.boundingRect();
bounding = bounding.translated(m_safeArea.topLeft());
bounding = m_safeArea.intersected(bounding);
int left = m_safeArea.left() - bounding.left();
int top = m_safeArea.top() - bounding.top();
SetArea(MythRect(bounding));
i.toFront();;
while (i.hasNext())
{
MythUIType *img = i.next();
img->SetArea(img->GetArea().translated(left, top));
}
}
示例2: DisplayState
bool MythUIStateType::DisplayState(const QString &name)
{
if (name.isEmpty())
return false;
MythUIType *old = m_CurrentState;
QMap<QString, MythUIType *>::Iterator i = m_ObjectsByName.find(name.toLower());
if (i != m_ObjectsByName.end())
m_CurrentState = i.value();
else
m_CurrentState = NULL;
if (m_CurrentState != old)
{
if (m_ShowEmpty || m_CurrentState)
{
if (m_deferload && m_CurrentState)
m_CurrentState->LoadNow();
if (old)
old->SetVisible(false);
if (m_CurrentState)
m_CurrentState->SetVisible(true);
}
}
AdjustDependence();
return (m_CurrentState != NULL);
}
示例3: GetChild
/**
* \copydoc MythUIType::Finalize()
*/
void MythUIEditBar::Finalize(void)
{
MythUIType *position = GetChild("position");
if (position)
position->MoveToTop();
}
示例4: SetArea
/**
* \brief Copy this widgets state from another.
*/
void MythUIType::CopyFrom(MythUIType *base)
{
m_Visible = base->m_Visible;
m_Enabled = base->m_Enabled;
m_CanHaveFocus = base->m_CanHaveFocus;
m_focusOrder = base->m_focusOrder;
SetArea(base->m_Area);
m_MinArea = base->m_MinArea;
m_MinSize = base->m_MinSize;
m_Alpha = base->m_Alpha;
m_AlphaChangeMode = base->m_AlphaChangeMode;
m_AlphaChange = base->m_AlphaChange;
m_AlphaMin = base->m_AlphaMin;
m_AlphaMax = base->m_AlphaMax;
m_Moving = base->m_Moving;
m_XYDestination = base->m_XYDestination;
m_XYSpeed = base->m_XYSpeed;
m_deferload = base->m_deferload;
QList<MythUIType *>::Iterator it;
for (it = base->m_ChildrenList.begin(); it != base->m_ChildrenList.end();
++it)
{
MythUIType *child = GetChild((*it)->objectName());
if (child)
child->CopyFrom(*it);
else
(*it)->CreateCopy(this);
}
}
示例5: switch
bool MythScreenType::gestureEvent(MythGestureEvent *event)
{
bool handled = false;
if (event->gesture() == MythGestureEvent::Click)
{
switch (event->GetButton())
{
case MythGestureEvent::RightButton :
ShowMenu();
handled = true;
break;
default :
break;
}
}
if (!handled)
{
MythUIType *clicked = GetChildAt(event->GetPosition());
if (clicked && clicked->IsEnabled())
{
SetFocusWidget(clicked);
if (clicked->gestureEvent(event))
handled = true;
}
}
return handled;
}
示例6: GetChild
void MythUIScrollBar::Finalize()
{
MythUIType *slider = GetChild("slider");
if (slider)
m_sliderArea = slider->GetArea();
CalculatePosition();
}
示例7: GetNew
void MythUIEditBar::AddMark(MythUIShape *shape, MythUIImage *image,
int start, bool left)
{
MythUIType *add = GetNew(shape, image);
if (add)
{
if (left)
start -= add->GetArea().width();
add->SetPosition(start, add->GetArea().top());
}
}
示例8: it
/**
* \brief Reset the widget to it's original state, should not reset changes
* made by the theme
*/
void MythUIType::Reset()
{
// Reset all children
QMutableListIterator<MythUIType *> it(m_ChildrenList);
while (it.hasNext())
{
it.next();
MythUIType *type = it.value();
type->Reset();
}
}
示例9: it
void TeletextScreen::OptimiseDisplayedArea(void)
{
VideoOutput *vo = m_player->GetVideoOutput();
if (!vo)
return;
MythPainter *osd_painter = vo->GetOSDPainter();
if (!osd_painter)
return;
QHashIterator<int, QImage*> it(m_rowImages);
while (it.hasNext())
{
it.next();
MythImage* image = osd_painter->GetFormatImage();
if (!image || !it.value())
continue;
int row = it.key();
image->Assign(*(it.value()));
MythUIImage *uiimage = new MythUIImage(this, QString("ttrow%1")
.arg(row));
if (uiimage)
{
uiimage->SetImage(image);
uiimage->SetArea(MythRect(0, row * m_rowHeight,
m_safeArea.width(), m_rowHeight * 2));
}
}
QRegion visible;
QListIterator<MythUIType *> i(m_ChildrenList);
while (i.hasNext())
{
MythUIType *img = i.next();
visible = visible.united(img->GetArea());
}
if (visible.isEmpty())
return;
QRect bounding = visible.boundingRect();
bounding = bounding.translated(m_safeArea.topLeft());
bounding = m_safeArea.intersected(bounding);
int left = m_safeArea.left() - bounding.left();
int top = m_safeArea.top() - bounding.top();
SetArea(MythRect(bounding));
i.toFront();;
while (i.hasNext())
{
MythUIType *img = i.next();
img->SetArea(img->GetArea().translated(left, top));
}
}
示例10: Show
void MythUIScrollBar::CalculatePosition(void)
{
if (m_maximum > 0)
Show();
else
{
Hide();
return;
}
MythUIType *slider = GetChild("slider");
if (!slider)
{
LOG(VB_GENERAL, LOG_ERR, "Slider element doesn't exist");
return;
}
float percentage = (float)m_sliderPosition / m_maximum;
float relativeSize = (float)m_pageStep / (m_maximum + m_pageStep);
MythRect newSliderArea = slider->GetArea();
MythRect fillArea = GetArea();
QPoint endPos(newSliderArea.left(), newSliderArea.top());
if (m_layout == LayoutHorizontal)
{
int width = qMax((int)(fillArea.width() * relativeSize + 0.5),
m_sliderArea.width());
newSliderArea.setWidth(width);
endPos.setX((int)((fillArea.width() - width) * percentage + 0.5));
}
else
{
int height = qMax((int)(fillArea.height() * relativeSize + 0.5),
m_sliderArea.height());
newSliderArea.setHeight(height);
endPos.setY((int)((fillArea.height() - height) * percentage + 0.5));
}
slider->SetArea(newSliderArea);
slider->SetPosition(endPos);
if (m_hideDelay > 0)
{
if (m_timerId)
killTimer(m_timerId);
m_timerId = startTimer(m_hideDelay);
AdjustAlpha(1, 10, 0, 255);
}
}
示例11: QString
void ZMEvents::setGridLayout(int layout)
{
if (layout < 1 || layout > 3)
layout = 1;
if (layout == m_layout)
return;
if (m_eventGrid)
m_eventGrid->Reset();
m_layout = layout;
// iterate though the children showing/hiding them as appropriate
QString name;
QString layoutName = QString("layout%1").arg(layout);
QList<MythUIType *> *children = GetAllChildren();
for (int x = 0; x < children->size(); x++)
{
MythUIType *type = children->at(x);
name = type->objectName();
if (name.startsWith("layout"))
{
if (name.startsWith(layoutName))
type->SetVisible(true);
else
type->SetVisible(false);
}
}
// get the correct grid
m_eventGrid = dynamic_cast<MythUIButtonList *> (GetChild(layoutName + "_eventlist"));
if (m_eventGrid)
{
connect(m_eventGrid, SIGNAL(itemSelected( MythUIButtonListItem*)),
this, SLOT(eventChanged(MythUIButtonListItem*)));
connect(m_eventGrid, SIGNAL(itemClicked( MythUIButtonListItem*)),
this, SLOT(playPressed()));
connect(m_eventGrid, SIGNAL(itemVisible(MythUIButtonListItem*)),
this, SLOT(eventVisible(MythUIButtonListItem*)));
updateUIList();
BuildFocusList();
SetFocusWidget(m_eventGrid);
}
else
{
示例12: GetChild
void MythUIStateType::CopyFrom(MythUIType *base)
{
MythUIStateType *st = dynamic_cast<MythUIStateType *>(base);
if (!st)
return;
m_ShowEmpty = st->m_ShowEmpty;
MythUIType::CopyFrom(base);
QMap<QString, MythUIType *>::iterator i;
for (i = st->m_ObjectsByName.begin(); i != st->m_ObjectsByName.end(); ++i)
{
MythUIType *other = i.value();
QString key = i.key();
MythUIType *newtype = GetChild(other->objectName());
AddObject(key, newtype);
newtype->SetVisible(false);
}
QMap<int, MythUIType *>::iterator j;
for (j = st->m_ObjectsByState.begin(); j != st->m_ObjectsByState.end(); ++j)
{
MythUIType *other = j.value();
int key = j.key();
MythUIType *newtype = GetChild(other->objectName());
AddObject((StateType)key, newtype);
newtype->SetVisible(false);
}
}
示例13: GetArea
/** \brief Return the first MythUIType which accepts focus found at the given
* coordinates
*
* \param p QPoint coordinates
* \param recursive Whether to perform a recursive search
*
* \return The widget at these coordinates
*/
MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive,
bool focusable) const
{
if (GetArea().contains(p))
{
if (!IsVisible() || !IsEnabled())
return NULL;
if (m_ChildrenList.isEmpty())
return NULL;
/* check all children */
QList<MythUIType *>::const_iterator it;
for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it)
{
if (!(*it))
continue;
// If this point doesn't fall within the child's area then move on
// This requires that the area is actually accurate and in some
// cases this still isn't true
if (!(*it)->GetArea().contains(p - GetArea().topLeft()))
continue;
MythUIType *child = *it;
if (recursive && (focusable && !child->CanTakeFocus()))
child = child->GetChildAt(p - GetArea().topLeft(), recursive,
focusable);
if (child)
{
// NOTE: Assumes no selectible ui type will contain another
// selectible ui type.
if (focusable && !child->CanTakeFocus())
continue;
return child;
}
}
}
return NULL;
}
示例14: GetArea
/** \brief Return the first MythUIType which accepts focus found at the given
* coordinates
*
* \param p QPoint coordinates
* \param recursive Whether to perform a recursive search
*
* \return The widget at these coordinates
*/
MythUIType *MythUIType::GetChildAt(const QPoint &p, bool recursive,
bool focusable) const
{
if (GetArea().contains(p))
{
if (!IsVisible() || !IsEnabled())
return NULL;
if (m_ChildrenList.isEmpty())
return NULL;
/* check all children */
QList<MythUIType *>::const_iterator it;
for (it = m_ChildrenList.end() - 1; it != m_ChildrenList.begin() - 1; --it)
{
if (!(*it))
continue;
MythUIType *child = NULL;
if ((*it)->GetArea().contains(p - GetArea().topLeft()))
child = *it;
if (!child && recursive)
child = (*it)->GetChildAt(p - GetArea().topLeft(), recursive,
focusable);
if (child)
{
// NOTE: Assumes no selectible ui type will contain another
// selectible ui type.
if (focusable && !child->CanTakeFocus())
continue;
return child;
}
}
}
return NULL;
}
示例15: SetFocusWidget
bool MythScreenType::SetFocusWidget(MythUIType *widget)
{
if (!widget || !widget->IsVisible())
{
QMap<int, MythUIType *>::iterator it = m_FocusWidgetList.begin();
MythUIType *current;
while (it != m_FocusWidgetList.end())
{
current = *it;
if (current->CanTakeFocus() && current->IsVisible())
{
widget = current;
break;
}
++it;
}
}
if (!widget)
return false;
if (m_CurrentFocusWidget == widget)
return true;
MythUIText *helpText = dynamic_cast<MythUIText *>(GetChild("helptext"));
if (helpText)
helpText->Reset();
if (m_CurrentFocusWidget)
m_CurrentFocusWidget->LoseFocus();
m_CurrentFocusWidget = widget;
m_CurrentFocusWidget->TakeFocus();
if (helpText && !widget->GetHelpText().isEmpty())
helpText->SetText(widget->GetHelpText());
return true;
}