1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-26 18:35:20 +00:00

Remove unneeded MWScrollView

This commit is contained in:
scrawl 2014-05-18 10:30:03 +02:00
parent 150b920ef1
commit 90ec19c3ac
3 changed files with 7 additions and 34 deletions

View File

@ -26,7 +26,7 @@ namespace MWGui
if (mClient == 0)
mClient = this;
mScrollView = mClient->createWidgetReal<MWGui::Widgets::MWScrollView>(
mScrollView = mClient->createWidgetReal<MyGUI::ScrollView>(
"MW_ScrollView", MyGUI::FloatCoord(0.0, 0.0, 1.0, 1.0),
MyGUI::Align::Top | MyGUI::Align::Left | MyGUI::Align::Stretch, getName() + "_ScrollView");
}
@ -51,7 +51,7 @@ namespace MWGui
const int _scrollBarWidth = 20; // fetch this from skin?
const int scrollBarWidth = scrollbarShown ? _scrollBarWidth : 0;
const int spacing = 3;
size_t scrollbarPosition = mScrollView->getScrollPosition();
size_t viewPosition = -mScrollView->getViewOffset().top;
while (mScrollView->getChildCount())
{
@ -96,10 +96,10 @@ namespace MWGui
if (!scrollbarShown && mItemHeight > mClient->getSize().height)
redraw(true);
size_t scrollbarRange = mScrollView->getScrollRange();
if(scrollbarPosition > scrollbarRange)
scrollbarPosition = scrollbarRange;
mScrollView->setScrollPosition(scrollbarPosition);
size_t viewRange = mScrollView->getCanvasSize().height;
if(viewPosition > viewRange)
viewPosition = viewRange;
mScrollView->setViewOffset(MyGUI::IntPoint(0, -viewPosition));
}
bool MWList::hasItem(const std::string& name)
@ -151,19 +151,5 @@ namespace MWGui
return mScrollView->findWidget (getName() + "_item_" + name);
}
size_t MWScrollView::getScrollPosition()
{
return getVScroll()->getScrollPosition();
}
void MWScrollView::setScrollPosition(size_t position)
{
getVScroll()->setScrollPosition(position);
}
size_t MWScrollView::getScrollRange()
{
return getVScroll()->getScrollRange();
}
}
}

View File

@ -7,18 +7,6 @@ namespace MWGui
{
namespace Widgets
{
/**
* \brief a custom ScrollView which has access to scrollbar properties
*/
class MWScrollView : public MyGUI::ScrollView
{
MYGUI_RTTI_DERIVED(MWScrollView)
public:
size_t getScrollPosition();
void setScrollPosition(size_t);
size_t getScrollRange();
};
/**
* \brief a very simple list widget that supports word-wrapping entries
* \note if the width or height of the list changes, you must call adjustSize() method
@ -70,7 +58,7 @@ namespace MWGui
void onItemSelected(MyGUI::Widget* _sender);
private:
MWGui::Widgets::MWScrollView* mScrollView;
MyGUI::ScrollView* mScrollView;
MyGUI::Widget* mClient;
std::vector<std::string> mItems;

View File

@ -158,7 +158,6 @@ namespace MWGui
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedButton>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ImageButton>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollView>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollBar>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<VideoWidget>("Widget");
MyGUI::FactoryManager::getInstance().registerFactory<BackgroundImage>("Widget");