MyGUI
3.2.0
|
00001 00006 /* 00007 This file is part of MyGUI. 00008 00009 MyGUI is free software: you can redistribute it and/or modify 00010 it under the terms of the GNU Lesser General Public License as published by 00011 the Free Software Foundation, either version 3 of the License, or 00012 (at your option) any later version. 00013 00014 MyGUI is distributed in the hope that it will be useful, 00015 but WITHOUT ANY WARRANTY; without even the implied warranty of 00016 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00017 GNU Lesser General Public License for more details. 00018 00019 You should have received a copy of the GNU Lesser General Public License 00020 along with MyGUI. If not, see <http://www.gnu.org/licenses/>. 00021 */ 00022 #include "MyGUI_Precompiled.h" 00023 #include "MyGUI_MultiListItem.h" 00024 #include "MyGUI_MultiListBox.h" 00025 00026 namespace MyGUI 00027 { 00028 00029 MultiListItem::MultiListItem() 00030 { 00031 } 00032 00033 void MultiListItem::initialiseOverride() 00034 { 00035 Base::initialiseOverride(); 00036 } 00037 00038 void MultiListItem::shutdownOverride() 00039 { 00040 Base::shutdownOverride(); 00041 } 00042 00043 void MultiListItem::setCaption(const UString& _value) 00044 { 00045 MultiListBox* owner = getOwner(); 00046 if (owner != nullptr) 00047 owner->setColumnName(this, _value); 00048 else 00049 Base::setCaption(_value); 00050 } 00051 00052 const UString& MultiListItem::getCaption() 00053 { 00054 MultiListBox* owner = getOwner(); 00055 if (owner != nullptr) 00056 return owner->getColumnName(this); 00057 00058 return Base::getCaption(); 00059 } 00060 00061 void MultiListItem::setItemResizingPolicy(ResizingPolicy _value) 00062 { 00063 MultiListBox* owner = getOwner(); 00064 if (owner != nullptr) 00065 owner->setColumnResizingPolicy(this, _value); 00066 } 00067 00068 void MultiListItem::setItemWidth(int _value) 00069 { 00070 MultiListBox* owner = getOwner(); 00071 if (owner != nullptr) 00072 owner->setColumnWidth(this, _value); 00073 } 00074 00075 void MultiListItem::setPropertyOverride(const std::string& _key, const std::string& _value) 00076 { 00077 if (_key == "ItemResizingPolicy") 00078 setItemResizingPolicy(ResizingPolicy::parse(_value)); 00079 else if (_key == "ItemWidth") 00080 setItemWidth(utility::parseValue<int>(_value)); 00081 else 00082 { 00083 Base::setPropertyOverride(_key, _value); 00084 return; 00085 } 00086 eventChangeProperty(this, _key, _value); 00087 } 00088 00089 MultiListBox* MultiListItem::getOwner() 00090 { 00091 if (getParent() != nullptr) 00092 { 00093 if (getParent()->isType<MultiListBox>()) 00094 return getParent()->castType<MultiListBox>(); 00095 else if ((getParent()->getParent() != nullptr) && (getParent()->getParent()->getClientWidget() == getParent())) 00096 { 00097 if (getParent()->getParent()->isType<MultiListBox>()) 00098 return getParent()->getParent()->castType<MultiListBox>(); 00099 } 00100 } 00101 00102 return nullptr; 00103 } 00104 00105 } // namespace MyGUI