> 4. Update dialog
> 5. Stop: listen to dialog

> Your help is greatly appreciated.
> 
> Greets, Edwin.
> 
> ps. is it Friday yet? ;-)

;-)

Edwin, you're talking about a controller/view split of the Spellchecker.

class ControlSpellChecker {
private:
        ViewBase * view_;
        SpellCheckerParams * params_;
public:
        ControlSpellChecker()
        {
                // connect show_spellchecker signal to show()
                // connect update_spellchecker signal to update()
        }
        void show()
        {
                if (!params_)
                        params_ = new SpellCheckerParams;
                view_->show();
        }
        void update()
        {
                if (!params_)
                        params_ = new SpellCheckerParams;
                view_->update();
        }
        void apply()
        {
                // The GUI-specific apply method modifies the local SpellCheckerParams
                view_->apply();

                // dispatch changes to the kernel
        }
        void hide()
        {
                // Disconnect signals?
                view_->hide();
                delete params_;
                params_ = 0;
        }
        SpellCheckerParams const & params()
        {
                // should always be initialised when called from the GUI
                lyx::Assert(params_);

                return *params_;
        }
};

class ViewSpellchecker : public ViewBase {
public:
        void show();
        void hide();
        void apply()
        {
                set(controller().params());
        }
        void ApplyButton()
        {
                // called when the Apply button is pressed
                controller().apply();
        }
};

Reply via email to