#ifndef INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX #define INCLUDED_VCL_INC_JSDIALOG_JSDIALOG_HXX #include #include #include #include #include #include #include #include class JSDialogSender { VclPtr m_aOwnedToplevel; public: JSDialogSender(VclPtr aOwnedToplevel) : m_aOwnedToplevel(aOwnedToplevel) { } void notifyDialogState(); }; class VCL_DLLPUBLIC JSInstanceBuilder : public SalInstanceBuilder { public: JSInstanceBuilder(weld::Widget* pParent, const OUString& rUIRoot, const OUString& rUIFile); virtual std::unique_ptr weld_dialog(const OString& id, bool bTakeOwnership = true) override; virtual std::unique_ptr weld_label(const OString& id, bool bTakeOwnership = false) override; virtual std::unique_ptr weld_button(const OString& id, bool bTakeOwnership = false) override; virtual std::unique_ptr weld_entry(const OString& id, bool bTakeOwnership = false) override; virtual std::unique_ptr weld_combo_box(const OString& id, bool bTakeOwnership = false) override; virtual std::unique_ptr weld_notebook(const OString& id, bool bTakeOwnership = false) override; }; template class JSWidget : public BaseInstanceClass, public JSDialogSender { public: JSWidget(VclPtr aOwnedToplevel, VclClass* pObject, SalInstanceBuilder* pBuilder, bool bTakeOwnership) : BaseInstanceClass(pObject, pBuilder, bTakeOwnership) , JSDialogSender(aOwnedToplevel) { } virtual void show() override { BaseInstanceClass::show(); notifyDialogState(); } virtual void hide() override { BaseInstanceClass::hide(); notifyDialogState(); } virtual void set_sensitive(bool sensitive) override { BaseInstanceClass::set_sensitive(sensitive); notifyDialogState(); } }; class VCL_DLLPUBLIC JSLabel : public JSWidget { public: JSLabel(VclPtr aOwnedToplevel, FixedText* pLabel, SalInstanceBuilder* pBuilder, bool bTakeOwnership); virtual void set_label(const OUString& rText) override; }; class VCL_DLLPUBLIC JSButton : public JSWidget { public: JSButton(VclPtr aOwnedToplevel, ::Button* pButton, SalInstanceBuilder* pBuilder, bool bTakeOwnership); }; class VCL_DLLPUBLIC JSEntry : public JSWidget { public: JSEntry(VclPtr aOwnedToplevel, ::Edit* pEntry, SalInstanceBuilder* pBuilder, bool bTakeOwnership); virtual void set_text(const OUString& rText) override; }; class VCL_DLLPUBLIC JSListBox : public JSWidget { public: JSListBox(VclPtr aOwnedToplevel, ::ListBox* pListBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); virtual void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) override; virtual void remove(int pos) override; }; class VCL_DLLPUBLIC JSComboBox : public JSWidget { public: JSComboBox(VclPtr aOwnedToplevel, ::ComboBox* pComboBox, SalInstanceBuilder* pBuilder, bool bTakeOwnership); virtual void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) override; virtual void remove(int pos) override; virtual void set_entry_text(const OUString& rText) override; }; class VCL_DLLPUBLIC JSNotebook : public JSWidget { public: JSNotebook(VclPtr aOwnedToplevel, ::TabControl* pControl, SalInstanceBuilder* pBuilder, bool bTakeOwnership); virtual void set_current_page(int nPage) override; virtual void set_current_page(const OString& rIdent) override; virtual void remove_page(const OString& rIdent) override; virtual void insert_page(const OString& rIdent, const OUString& rLabel, int nPos) override; }; #endif