mirror of
https://github.com/vcmi/vcmi.git
synced 2024-12-24 22:14:36 +02:00
Remove 'visible' property from images, replaced with enable/disabled
call
This commit is contained in:
parent
6dadcc2ca5
commit
0fd966818f
@ -310,8 +310,6 @@ std::shared_ptr<CPicture> InterfaceObjectConfigurable::buildPicture(const JsonNo
|
|||||||
auto image = ImagePath::fromJson(config["image"]);
|
auto image = ImagePath::fromJson(config["image"]);
|
||||||
auto position = readPosition(config["position"]);
|
auto position = readPosition(config["position"]);
|
||||||
auto pic = std::make_shared<CPicture>(image, position.x, position.y);
|
auto pic = std::make_shared<CPicture>(image, position.x, position.y);
|
||||||
if(!config["visible"].isNull())
|
|
||||||
pic->visible = config["visible"].Bool();
|
|
||||||
|
|
||||||
if ( config["playerColored"].Bool() && LOCPLINT)
|
if ( config["playerColored"].Bool() && LOCPLINT)
|
||||||
pic->colorize(LOCPLINT->playerID);
|
pic->colorize(LOCPLINT->playerID);
|
||||||
|
@ -22,10 +22,11 @@ ComboBox::DropDown::Item::Item(const JsonNode & config, ComboBox::DropDown & _dr
|
|||||||
{
|
{
|
||||||
build(config);
|
build(config);
|
||||||
|
|
||||||
if(auto w = widget<CPicture>("hoverImage"))
|
if(auto w = widget<CIntObject>("hoverImage"))
|
||||||
{
|
{
|
||||||
pos.w = w->pos.w;
|
pos.w = w->pos.w;
|
||||||
pos.h = w->pos.h;
|
pos.h = w->pos.h;
|
||||||
|
w->disable();
|
||||||
}
|
}
|
||||||
setRedrawParent(true);
|
setRedrawParent(true);
|
||||||
}
|
}
|
||||||
@ -42,14 +43,14 @@ void ComboBox::DropDown::Item::updateItem(int idx, const void * _item)
|
|||||||
|
|
||||||
void ComboBox::DropDown::Item::hover(bool on)
|
void ComboBox::DropDown::Item::hover(bool on)
|
||||||
{
|
{
|
||||||
auto h = widget<CPicture>("hoverImage");
|
auto h = widget<CIntObject>("hoverImage");
|
||||||
auto w = widget<CLabel>("labelName");
|
auto w = widget<CLabel>("labelName");
|
||||||
if(h && w)
|
if(h && w)
|
||||||
{
|
{
|
||||||
if(w->getText().empty())
|
if(w->getText().empty() || on == false)
|
||||||
h->visible = false;
|
h->disable();
|
||||||
else
|
else
|
||||||
h->visible = on;
|
h->enable();
|
||||||
}
|
}
|
||||||
redraw();
|
redraw();
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
|
|
||||||
CPicture::CPicture(std::shared_ptr<IImage> image, const Point & position)
|
CPicture::CPicture(std::shared_ptr<IImage> image, const Point & position)
|
||||||
: bg(image)
|
: bg(image)
|
||||||
, visible(true)
|
|
||||||
, needRefresh(false)
|
, needRefresh(false)
|
||||||
{
|
{
|
||||||
pos += position;
|
pos += position;
|
||||||
@ -53,7 +52,6 @@ CPicture::CPicture( const ImagePath & bmpname )
|
|||||||
|
|
||||||
CPicture::CPicture( const ImagePath & bmpname, const Point & position )
|
CPicture::CPicture( const ImagePath & bmpname, const Point & position )
|
||||||
: bg(GH.renderHandler().loadImage(bmpname))
|
: bg(GH.renderHandler().loadImage(bmpname))
|
||||||
, visible(true)
|
|
||||||
, needRefresh(false)
|
, needRefresh(false)
|
||||||
{
|
{
|
||||||
pos.x += position.x;
|
pos.x += position.x;
|
||||||
@ -81,13 +79,13 @@ CPicture::CPicture(std::shared_ptr<IImage> image, const Rect &SrcRect, int x, in
|
|||||||
|
|
||||||
void CPicture::show(Canvas & to)
|
void CPicture::show(Canvas & to)
|
||||||
{
|
{
|
||||||
if (visible && needRefresh)
|
if (needRefresh)
|
||||||
showAll(to);
|
showAll(to);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CPicture::showAll(Canvas & to)
|
void CPicture::showAll(Canvas & to)
|
||||||
{
|
{
|
||||||
if(bg && visible)
|
if(bg)
|
||||||
{
|
{
|
||||||
if (srcRect.has_value())
|
if (srcRect.has_value())
|
||||||
to.draw(bg, pos.topLeft(), *srcRect);
|
to.draw(bg, pos.topLeft(), *srcRect);
|
||||||
|
@ -34,10 +34,6 @@ public:
|
|||||||
/// If set to true, iamge will be redrawn on each frame
|
/// If set to true, iamge will be redrawn on each frame
|
||||||
bool needRefresh;
|
bool needRefresh;
|
||||||
|
|
||||||
/// If set to false, image will not be rendered
|
|
||||||
/// Deprecated, use CIntObject::disable()/enable() instead
|
|
||||||
bool visible;
|
|
||||||
|
|
||||||
std::shared_ptr<IImage> getSurface()
|
std::shared_ptr<IImage> getSurface()
|
||||||
{
|
{
|
||||||
return bg;
|
return bg;
|
||||||
|
@ -449,8 +449,16 @@ void CSpellWindow::setCurrentPage(int value)
|
|||||||
schoolPicture->visible = selectedTab!=4 && currentPage == 0;
|
schoolPicture->visible = selectedTab!=4 && currentPage == 0;
|
||||||
if(selectedTab != 4)
|
if(selectedTab != 4)
|
||||||
schoolPicture->setFrame(selectedTab, 0);
|
schoolPicture->setFrame(selectedTab, 0);
|
||||||
leftCorner->visible = currentPage != 0;
|
|
||||||
rightCorner->visible = (currentPage+1) < pagesWithinCurrentTab();
|
if (currentPage != 0)
|
||||||
|
leftCorner->enable();
|
||||||
|
else
|
||||||
|
leftCorner->disable();
|
||||||
|
|
||||||
|
if (currentPage + 1 < pagesWithinCurrentTab())
|
||||||
|
rightCorner->enable();
|
||||||
|
else
|
||||||
|
rightCorner->disable();
|
||||||
|
|
||||||
mana->setText(std::to_string(myHero->mana));//just in case, it will be possible to cast spell without closing book
|
mana->setText(std::to_string(myHero->mana));//just in case, it will be possible to cast spell without closing book
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user