All controls store their name/keyO
This commit is contained in:
@@ -245,6 +245,7 @@ void cDialog::loadFromFile(const DialogDefn& file){
|
||||
}
|
||||
}
|
||||
prevCtrl = *inserted;
|
||||
prevCtrl.second->setName(prevCtrl.first);
|
||||
// Needed to correctly resolve relative positioning
|
||||
inserted->second->recalcRect();
|
||||
}
|
||||
@@ -464,6 +465,7 @@ bool cDialog::add(cControl* what, rectangle ctrl_frame, std::string key){
|
||||
if(controls.find(key) != controls.end()) return false;
|
||||
what->setBounds(ctrl_frame);
|
||||
controls.insert(std::make_pair(key,what));
|
||||
what->setName(key);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ bool cContainer::parseChildControl(ticpp::Element& elem, std::map<std::string,cC
|
||||
}
|
||||
}
|
||||
prevCtrl = *inserted;
|
||||
prevCtrl.second->setName(prevCtrl.first);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -149,6 +149,7 @@ protected:
|
||||
/// @throw xMissingAttr if a required attribute is missing
|
||||
/// @throw xMissingElem if a required attribute is either missing or present in insufficient quantity
|
||||
virtual void validatePostParse(ticpp::Element& who, std::string fname, const std::set<std::string>& attrs, const std::multiset<std::string>& nodes);
|
||||
std::string name;
|
||||
public:
|
||||
/// Attach a keyboard shortcut to a control. Pressing the keyboard shortcut is equivalent to clicking the control.
|
||||
/// @param key The desired keyboard shortcut.
|
||||
@@ -181,6 +182,8 @@ public:
|
||||
if(old_handler.empty()) return nullptr;
|
||||
return boost::any_cast<typename event_fcn<t>::type>(old_handler);
|
||||
}
|
||||
inline std::string getName() { return name; }
|
||||
inline void setName(std::string value) { name = value; }
|
||||
/// Attach a click handler to this control.
|
||||
/// @param f The click handler to attach.
|
||||
/// @throw xHandlerNotSupported if this control does not support click handlers. Most controls do support click handlers.
|
||||
|
||||
@@ -41,10 +41,6 @@ bool cScrollbar::isScrollable() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void cScrollbar::setName(std::string name) {
|
||||
this->name = name;
|
||||
}
|
||||
|
||||
void cScrollbar::setPosition(long newPos, bool record) {
|
||||
if(record && recording){
|
||||
std::map<std::string,std::string> info;
|
||||
|
||||
@@ -105,7 +105,6 @@ public:
|
||||
/// Get the scrollbar style.
|
||||
/// @return The style
|
||||
eScrollStyle getStyle() const;
|
||||
void setName(std::string name);
|
||||
/// Set the scrollbar thumb's current position.
|
||||
/// @param to The new position.
|
||||
void setPosition(long to, bool record = false);
|
||||
|
||||
Reference in New Issue
Block a user