HtmlInput ownership.
This commit is contained in:
18
src/form.cc
18
src/form.cc
@ -147,7 +147,7 @@ public: //BUG: for now everything is public
|
||||
std::optional< std::string > init_str; /* note: some overloading - for buttons, init_str
|
||||
is simply the value of the button; for text
|
||||
entries, it is the initial value */
|
||||
DilloHtmlSelect *select;
|
||||
std::unique_ptr< DilloHtmlSelect > select;
|
||||
bool init_val; /* only meaningful for buttons */
|
||||
std::string file_data; /* only meaningful for file inputs.
|
||||
TODO: may become a list... */
|
||||
@ -160,7 +160,6 @@ private:
|
||||
public:
|
||||
DilloHtmlInput (DilloHtmlInputType type, Embed *embed,
|
||||
const std::optional< std::string > &name, const std::optional< std::string > &init_str, bool init_val);
|
||||
~DilloHtmlInput ();
|
||||
void appendValuesTo(std::vector< std::string > &values, bool is_active_submit);
|
||||
void reset();
|
||||
void setEnabled(bool enabled) {if (embed) embed->setEnabled(enabled); };
|
||||
@ -216,8 +215,8 @@ class DilloHtmlSelect {
|
||||
private:
|
||||
lout::misc::SimpleVector<DilloHtmlOptbase *> *opts;
|
||||
DilloHtmlSelect ();
|
||||
~DilloHtmlSelect ();
|
||||
public:
|
||||
~DilloHtmlSelect ();
|
||||
DilloHtmlOptbase *getCurrentOpt ();
|
||||
void addOpt (DilloHtmlOptbase *opt);
|
||||
void ensureSelection ();
|
||||
@ -775,7 +774,7 @@ void Html_tag_close_select(DilloHtml *html)
|
||||
|
||||
auto input = Html_get_current_input(*html);
|
||||
if (input) {
|
||||
DilloHtmlSelect *select = input->select;
|
||||
DilloHtmlSelect *select = input->select.get();
|
||||
if (input->type == DILLO_HTML_INPUT_SELECT) {
|
||||
// option menu interface requires that something be selected */
|
||||
select->ensureSelection ();
|
||||
@ -1632,7 +1631,7 @@ DilloHtmlInput::DilloHtmlInput (DilloHtmlInputType type2, Embed *embed2,
|
||||
switch (type) {
|
||||
case DILLO_HTML_INPUT_SELECT:
|
||||
case DILLO_HTML_INPUT_SEL_LIST:
|
||||
select = new DilloHtmlSelect;
|
||||
select.reset( new DilloHtmlSelect );
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -1640,15 +1639,6 @@ DilloHtmlInput::DilloHtmlInput (DilloHtmlInputType type2, Embed *embed2,
|
||||
reset ();
|
||||
}
|
||||
|
||||
/*
|
||||
* Destructor
|
||||
*/
|
||||
DilloHtmlInput::~DilloHtmlInput ()
|
||||
{
|
||||
if (select)
|
||||
delete select;
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to a receiver.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user