mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-04-16 17:42:31 +00:00
Merge branch 'master' of https://github.com/zinnschlag/openmw
This commit is contained in:
commit
4f6133c7a0
@ -300,6 +300,8 @@ configure_file(${OpenMW_SOURCE_DIR}/files/openmw.cfg
|
|||||||
if (NOT WIN32 AND NOT APPLE)
|
if (NOT WIN32 AND NOT APPLE)
|
||||||
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
|
configure_file(${OpenMW_SOURCE_DIR}/files/openmw.desktop
|
||||||
"${OpenMW_BINARY_DIR}/openmw.desktop")
|
"${OpenMW_BINARY_DIR}/openmw.desktop")
|
||||||
|
configure_file(${OpenMW_SOURCE_DIR}/files/opencs.desktop
|
||||||
|
"${OpenMW_BINARY_DIR}/opencs.desktop")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Compiler settings
|
# Compiler settings
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
#include "list.hpp"
|
#include "list.hpp"
|
||||||
|
|
||||||
#include <MyGUI_ScrollView.h>
|
|
||||||
#include <MyGUI_Gui.h>
|
#include <MyGUI_Gui.h>
|
||||||
#include <MyGUI_Button.h>
|
#include <MyGUI_Button.h>
|
||||||
#include <MyGUI_ImageBox.h>
|
#include <MyGUI_ImageBox.h>
|
||||||
|
#include <MyGUI_ScrollBar.h>
|
||||||
|
|
||||||
using namespace MWGui;
|
using namespace MWGui;
|
||||||
using namespace MWGui::Widgets;
|
using namespace MWGui::Widgets;
|
||||||
@ -23,7 +23,7 @@ void MWList::initialiseOverride()
|
|||||||
if (mClient == 0)
|
if (mClient == 0)
|
||||||
mClient = this;
|
mClient = this;
|
||||||
|
|
||||||
mScrollView = mClient->createWidgetReal<MyGUI::ScrollView>(
|
mScrollView = mClient->createWidgetReal<MWGui::Widgets::MWScrollView>(
|
||||||
"MW_ScrollView", MyGUI::FloatCoord(0.0, 0.0, 1.0, 1.0),
|
"MW_ScrollView", MyGUI::FloatCoord(0.0, 0.0, 1.0, 1.0),
|
||||||
MyGUI::Align::Top | MyGUI::Align::Left | MyGUI::Align::Stretch, getName() + "_ScrollView");
|
MyGUI::Align::Top | MyGUI::Align::Left | MyGUI::Align::Stretch, getName() + "_ScrollView");
|
||||||
}
|
}
|
||||||
@ -48,6 +48,7 @@ void MWList::redraw(bool scrollbarShown)
|
|||||||
const int _scrollBarWidth = 24; // fetch this from skin?
|
const int _scrollBarWidth = 24; // fetch this from skin?
|
||||||
const int scrollBarWidth = scrollbarShown ? _scrollBarWidth : 0;
|
const int scrollBarWidth = scrollbarShown ? _scrollBarWidth : 0;
|
||||||
const int spacing = 3;
|
const int spacing = 3;
|
||||||
|
size_t scrollbarPosition = mScrollView->getScrollPosition();
|
||||||
|
|
||||||
while (mScrollView->getChildCount())
|
while (mScrollView->getChildCount())
|
||||||
{
|
{
|
||||||
@ -88,6 +89,11 @@ void MWList::redraw(bool scrollbarShown)
|
|||||||
|
|
||||||
if (!scrollbarShown && mItemHeight > mClient->getSize().height)
|
if (!scrollbarShown && mItemHeight > mClient->getSize().height)
|
||||||
redraw(true);
|
redraw(true);
|
||||||
|
|
||||||
|
size_t scrollbarRange = mScrollView->getScrollRange();
|
||||||
|
if(scrollbarPosition > scrollbarRange)
|
||||||
|
scrollbarPosition = scrollbarRange;
|
||||||
|
mScrollView->setScrollPosition(scrollbarPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MWList::hasItem(const std::string& name)
|
bool MWList::hasItem(const std::string& name)
|
||||||
@ -138,3 +144,17 @@ MyGUI::Widget* MWList::getItemWidget(const std::string& name)
|
|||||||
{
|
{
|
||||||
return mScrollView->findWidget (getName() + "_item_" + name);
|
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();
|
||||||
|
}
|
||||||
|
@ -2,16 +2,24 @@
|
|||||||
#define MWGUI_LIST_HPP
|
#define MWGUI_LIST_HPP
|
||||||
|
|
||||||
#include <MyGUI_Widget.h>
|
#include <MyGUI_Widget.h>
|
||||||
|
#include <MyGUI_ScrollView.h>
|
||||||
namespace MyGUI
|
|
||||||
{
|
|
||||||
class ScrollView;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
namespace Widgets
|
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
|
* \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
|
* \note if the width or height of the list changes, you must call adjustSize() method
|
||||||
@ -63,7 +71,7 @@ namespace MWGui
|
|||||||
void onItemSelected(MyGUI::Widget* _sender);
|
void onItemSelected(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
MyGUI::ScrollView* mScrollView;
|
MWGui::Widgets::MWScrollView* mScrollView;
|
||||||
MyGUI::Widget* mClient;
|
MyGUI::Widget* mClient;
|
||||||
|
|
||||||
std::vector<std::string> mItems;
|
std::vector<std::string> mItems;
|
||||||
|
@ -132,6 +132,7 @@ WindowManager::WindowManager(
|
|||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedButton>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::AutoSizedButton>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ImageButton>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ImageButton>("Widget");
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::ExposedWindow>("Widget");
|
||||||
|
MyGUI::FactoryManager::getInstance().registerFactory<MWGui::Widgets::MWScrollView>("Widget");
|
||||||
|
|
||||||
MyGUI::FactoryManager::getInstance().registerFactory<ResourceImageSetPointerFix>("Resource", "ResourceImageSetPointer");
|
MyGUI::FactoryManager::getInstance().registerFactory<ResourceImageSetPointerFix>("Resource", "ResourceImageSetPointer");
|
||||||
MyGUI::ResourceManager::getInstance().load("core.xml");
|
MyGUI::ResourceManager::getInstance().load("core.xml");
|
||||||
|
9
files/opencs.desktop
Normal file
9
files/opencs.desktop
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Type=Application
|
||||||
|
Name=OpenMW Content Editor
|
||||||
|
GenericName=Content Editor
|
||||||
|
Comment=A replacement for the Morrowind Construction Set.
|
||||||
|
TryExec=opencs
|
||||||
|
Exec=opencs
|
||||||
|
Icon=opencs
|
||||||
|
Categories=Game;RolePlaying;
|
Loading…
x
Reference in New Issue
Block a user