scrollbar store reference to pane

This commit is contained in:
2025-02-23 09:46:35 -06:00
committed by Celtic Minstrel
parent a01c9d6e2a
commit 5d3dd844ba
3 changed files with 4 additions and 1 deletions

View File

@@ -27,7 +27,7 @@ enum eScrollStyle {
/// using the methods to get the scrollbar's position.
/// Alternatively, it can be used as a slider control.
class cScrollbar : public cControl, public iEventListener, public iDrawable {
std::string name;
cControl* pane;
int pos, max, pgsz;
std::string link;
// Make sure this is equal to the number of constants in eScrollStyle
@@ -66,6 +66,7 @@ class cScrollbar : public cControl, public iEventListener, public iDrawable {
public:
/// @copydoc cDialog::init()
static void init();
inline void setPane(cControl* pane) { this->pane = pane; }
bool parseAttribute(ticpp::Attribute& attr, std::string tagName, std::string fname) override;
void validatePostParse(ticpp::Element& who, std::string fname, const std::set<std::string>& attrs, const std::multiset<std::string>& nodes) override;
location getPreferredSize() const override;

View File

@@ -17,6 +17,7 @@
#include <climits>
cScrollPane::cScrollPane(cDialog& parent) : cContainer(CTRL_PANE, parent), scroll(parent) {
scroll.setPane(this);
recalcRect();
}

View File

@@ -25,6 +25,7 @@ class cScrollPane : public cContainer {
public:
/// Create a new scroll pane
explicit cScrollPane(cDialog& parent);
inline cScrollbar& getScroll() { return scroll; }
bool parseAttribute(ticpp::Attribute& attr, std::string tagName, std::string fname) override;
bool parseContent(ticpp::Node& content, int n, std::string tagName, std::string fname, std::string& text) override;
void validatePostParse(ticpp::Element& who, std::string fname, const std::set<std::string>& attrs, const std::multiset<std::string>& nodes) override;