Rework parentage and naming of dialog controls.
All controls now store a reference to their direct parent, whether it be the dialog itself or a container control. Every dialog control now has a guaranteed parent, which abstracts away the three possible types of parents (dialog, container, and plain window). The control name is now stored in the control from the moment it is parsed from the XML. This means that it's set before the parseContent function, though after parseAttribute.
This commit is contained in:
@@ -245,7 +245,8 @@ int main(int argc, char* argv[]) {
|
||||
}
|
||||
|
||||
static void init_sbar(std::shared_ptr<cScrollbar>& sbar, const std::string& name, rectangle rect, rectangle events_rect, int max, int pgSz, int start = 0) {
|
||||
sbar.reset(new cScrollbar(mainPtr));
|
||||
static cParentless mainWin(mainPtr);
|
||||
sbar.reset(new cScrollbar(mainWin));
|
||||
sbar->setName(name);
|
||||
sbar->setBounds(rect);
|
||||
sbar->setMaximum(max);
|
||||
@@ -283,7 +284,8 @@ static void init_scrollbars() {
|
||||
}
|
||||
|
||||
static void init_btn(std::shared_ptr<cButton>& btn, eBtnType type, location loc) {
|
||||
btn.reset(new cButton(mainPtr));
|
||||
static cParentless mainWin(mainPtr);
|
||||
btn.reset(new cButton(mainWin));
|
||||
btn->setBtnType(type);
|
||||
btn->relocate(loc);
|
||||
btn->hide();
|
||||
|
@@ -1473,7 +1473,8 @@ void draw_map(bool need_refresh) {
|
||||
|
||||
the_rect = rectangle(mini_map);
|
||||
tileImage(mini_map, the_rect,bg[4]);
|
||||
cPict theGraphic(mini_map);
|
||||
cParentless mapWin(mini_map);
|
||||
cPict theGraphic(mapWin);
|
||||
theGraphic.setBounds(dlogpicrect);
|
||||
theGraphic.setPict(21, PIC_DLOG);
|
||||
theGraphic.setFormat(TXT_FRAME, FRM_NONE);
|
||||
|
Reference in New Issue
Block a user