mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-30 05:12:40 +00:00
Use same button handling as in XForms frontend
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@1824 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
3c7b1cf655
commit
0eb38828ca
@ -10,3 +10,5 @@ FormDocumentDialogBase.h
|
|||||||
FormDocumentDialogBase.C
|
FormDocumentDialogBase.C
|
||||||
FormCitationDialog.h
|
FormCitationDialog.h
|
||||||
FormCitationDialog.C
|
FormCitationDialog.C
|
||||||
|
FormCopyrightDialog.C
|
||||||
|
FormCopyrightDialog.h
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
#include "qt2BC.h"
|
#include "qt2BC.h"
|
||||||
#include "support/LAssert.h"
|
#include "support/LAssert.h"
|
||||||
|
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
FormBase::FormBase(ControlBase & c, string const & t)
|
FormBase::FormBase(ControlBase & c, string const & t)
|
||||||
: ViewBC<qt2BC>(c), title_(t)
|
: ViewBC<qt2BC>(c), title_(t)
|
||||||
@ -34,17 +36,27 @@ FormBase::FormBase(ControlBase & c, string const & t)
|
|||||||
|
|
||||||
void FormBase::show()
|
void FormBase::show()
|
||||||
{
|
{
|
||||||
if (!form()) {
|
fprintf( stderr, "FormBase::show() 1\n" );
|
||||||
|
if (!form()) {
|
||||||
|
fprintf( stderr, "FormBase::show() 2\n" );
|
||||||
build();
|
build();
|
||||||
|
fprintf( stderr, "FormBase::show() 3\n" );
|
||||||
}
|
}
|
||||||
|
fprintf( stderr, "FormBase::show() 4\n" );
|
||||||
|
|
||||||
update(); // make sure its up-to-date
|
update(); // make sure its up-to-date
|
||||||
|
fprintf( stderr, "FormBase::show() 5\n" );
|
||||||
|
|
||||||
if (form()->isVisible()) {
|
if (form()->isVisible()) {
|
||||||
|
fprintf( stderr, "FormBase::show() 6\n" );
|
||||||
form()->raise();
|
form()->raise();
|
||||||
|
fprintf( stderr, "FormBase::show() 7\n" );
|
||||||
} else {
|
} else {
|
||||||
|
fprintf( stderr, "FormBase::show() 8\n" );
|
||||||
form()->setCaption( title_.c_str() );
|
form()->setCaption( title_.c_str() );
|
||||||
|
fprintf( stderr, "FormBase::show() 9\n" );
|
||||||
form()->show();
|
form()->show();
|
||||||
|
fprintf( stderr, "FormBase::show() 10\n" );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,65 +68,52 @@ void FormBase::hide()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// PENDING(kalle) Handle this with QValidator?
|
||||||
// void FormBase::InputCB(FL_OBJECT * ob, long data)
|
// void FormBase::InputCB(FL_OBJECT * ob, long data)
|
||||||
// {
|
// {
|
||||||
// bc().input(input(ob, data));
|
// bc().input(input(ob, data));
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
// ButtonPolicy::SMInput FormBase::input(FL_OBJECT *, long)
|
ButtonPolicy::SMInput FormBase::input(QWidget*, long)
|
||||||
// {
|
{
|
||||||
// return ButtonPolicy::SMI_VALID;
|
return ButtonPolicy::SMI_VALID;
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
// FormBase * GetForm(QWidget * ob)
|
void FormBase::slotWMHide()
|
||||||
// {
|
{
|
||||||
// Assert(ob && ob->form && ob->form->u_vdata);
|
CancelButton();
|
||||||
// FormBase * pre = static_cast<FormBase *>(ob->form->u_vdata);
|
}
|
||||||
// return pre;
|
|
||||||
// }
|
|
||||||
|
|
||||||
} // namespace anon
|
|
||||||
|
|
||||||
|
|
||||||
// extern "C" int C_FormBaseWMHideCB(FL_FORM * form, void *)
|
|
||||||
// {
|
void FormBase::slotApply()
|
||||||
// // Close the dialog cleanly, even if the WM is used to do so.
|
{
|
||||||
// Assert(form && form->u_vdata);
|
ApplyButton();
|
||||||
// FormBase * pre = static_cast<FormBase *>(form->u_vdata);
|
}
|
||||||
// pre->CancelButton();
|
|
||||||
// return FL_CANCEL;
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// extern "C" void C_FormBaseApplyCB(FL_OBJECT * ob, long)
|
void FormBase::slotOK()
|
||||||
// {
|
{
|
||||||
// GetForm(ob)->ApplyButton();
|
OKButton();
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// extern "C" void C_FormBaseOKCB(FL_OBJECT * ob, long)
|
void FormBase::slotCancel()
|
||||||
// {
|
{
|
||||||
// GetForm(ob)->OKButton();
|
CancelButton();
|
||||||
// }
|
}
|
||||||
|
|
||||||
|
|
||||||
// extern "C" void C_FormBaseCancelCB(FL_OBJECT * ob, long)
|
void FormBase::slotRestore()
|
||||||
// {
|
{
|
||||||
// FormBase * form = GetForm(ob);
|
RestoreButton();
|
||||||
// form->CancelButton();
|
}
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
// extern "C" void C_FormBaseRestoreCB(FL_OBJECT * ob, long)
|
|
||||||
// {
|
|
||||||
// GetForm(ob)->RestoreButton();
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
|
// PENDING(kalle) How to handle this?
|
||||||
// extern "C" void C_FormBaseInputCB(FL_OBJECT * ob, long d)
|
// extern "C" void C_FormBaseInputCB(FL_OBJECT * ob, long d)
|
||||||
// {
|
// {
|
||||||
// GetForm(ob)->InputCB(ob, d);
|
// GetForm(ob)->InputCB(ob, d);
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
|
|
||||||
class QDialog;
|
class QDialog;
|
||||||
|
|
||||||
|
#include <qfont.h>
|
||||||
|
#include <qobject.h>
|
||||||
|
|
||||||
#ifdef __GNUG__
|
#ifdef __GNUG__
|
||||||
#pragma interface
|
#pragma interface
|
||||||
#endif
|
#endif
|
||||||
@ -30,8 +33,9 @@ class qt2BC;
|
|||||||
|
|
||||||
/** This class is an Qt2 GUI base class.
|
/** This class is an Qt2 GUI base class.
|
||||||
*/
|
*/
|
||||||
class FormBase : public ViewBC<qt2BC>
|
class FormBase : public QObject, public ViewBC<qt2BC>
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
///
|
///
|
||||||
FormBase(ControlBase &, string const &);
|
FormBase(ControlBase &, string const &);
|
||||||
@ -46,12 +50,28 @@ protected:
|
|||||||
/// Create the dialog if necessary, update it and display it.
|
/// Create the dialog if necessary, update it and display it.
|
||||||
void show();
|
void show();
|
||||||
|
|
||||||
|
protected slots:
|
||||||
|
// dialog closed from WM
|
||||||
|
void slotWMHide();
|
||||||
|
|
||||||
|
// Apply button clicked
|
||||||
|
void slotApply();
|
||||||
|
|
||||||
|
// OK button clicked
|
||||||
|
void slotOK();
|
||||||
|
|
||||||
|
// Cancel button clicked
|
||||||
|
void slotCancel();
|
||||||
|
|
||||||
|
// Restore button clicked
|
||||||
|
void slotRestore();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Pointer to the actual instantiation of xform's form
|
/// Pointer to the actual instantiation of xform's form
|
||||||
virtual QDialog* form() const = 0;
|
virtual QDialog* form() const = 0;
|
||||||
// /** Filter the inputs on callback from xforms
|
/** Filter the inputs on callback from xforms
|
||||||
// Return true if inputs are valid. */
|
Return true if inputs are valid. */
|
||||||
// virtual ButtonPolicy::SMInput input(FL_OBJECT *, long);
|
virtual ButtonPolicy::SMInput input(QWidget*, long);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// dialog title, displayed by WM.
|
/// dialog title, displayed by WM.
|
||||||
|
@ -38,13 +38,15 @@ void FormCopyright::build()
|
|||||||
{
|
{
|
||||||
// PENDING(kalle) Parent???
|
// PENDING(kalle) Parent???
|
||||||
dialog_.reset( new FormCopyrightDialogImpl() );
|
dialog_.reset( new FormCopyrightDialogImpl() );
|
||||||
|
connect( dialog_.get()->closePB, SIGNAL( clicked() ),
|
||||||
|
this, SLOT( slotCancel() ) );
|
||||||
|
|
||||||
dialog_->copyrightLA->setText( controller().getCopyright().c_str() );
|
dialog_->copyrightLA->setText( controller().getCopyright().c_str() );
|
||||||
dialog_->licenseLA->setText( controller().getLicence().c_str() );
|
dialog_->licenseLA->setText( controller().getLicence().c_str() );
|
||||||
dialog_->disclaimerLA->setText( controller().getDisclaimer().c_str() );
|
dialog_->disclaimerLA->setText( controller().getDisclaimer().c_str() );
|
||||||
|
|
||||||
// Manage the cancel/close button
|
// Manage the cancel/close button
|
||||||
bc().setCancel(dialog_->okPB);
|
bc().setCancel(dialog_->closePB);
|
||||||
bc().refresh();
|
bc().refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>caption</name>
|
<name>caption</name>
|
||||||
<string>Form1</string>
|
<string>Copyright and Warranty</string>
|
||||||
</property>
|
</property>
|
||||||
<vbox>
|
<vbox>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
@ -159,7 +159,7 @@ if not, write to the Free Software Foundation, Inc.,
|
|||||||
<class>QPushButton</class>
|
<class>QPushButton</class>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>name</name>
|
<name>name</name>
|
||||||
<cstring>okPB</cstring>
|
<cstring>closePB</cstring>
|
||||||
</property>
|
</property>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>sizePolicy</name>
|
<name>sizePolicy</name>
|
||||||
@ -170,7 +170,7 @@ if not, write to the Free Software Foundation, Inc.,
|
|||||||
</property>
|
</property>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>text</name>
|
<name>text</name>
|
||||||
<string>&OK</string>
|
<string>&Close</string>
|
||||||
</property>
|
</property>
|
||||||
<property stdset="1">
|
<property stdset="1">
|
||||||
<name>default</name>
|
<name>default</name>
|
||||||
@ -181,7 +181,7 @@ if not, write to the Free Software Foundation, Inc.,
|
|||||||
</widget>
|
</widget>
|
||||||
<connections>
|
<connections>
|
||||||
<connection>
|
<connection>
|
||||||
<sender>okPB</sender>
|
<sender>closePB</sender>
|
||||||
<signal>clicked()</signal>
|
<signal>clicked()</signal>
|
||||||
<receiver>FormCopyrightDialog</receiver>
|
<receiver>FormCopyrightDialog</receiver>
|
||||||
<slot>reject()</slot>
|
<slot>reject()</slot>
|
||||||
|
@ -12,6 +12,7 @@ CXXFLAGS += -DQT_CLEAN_NAMESPACE -fno-rtti -fno-exceptions
|
|||||||
# moc generated files
|
# moc generated files
|
||||||
BUILTSOURCES = \
|
BUILTSOURCES = \
|
||||||
moc_FileDialog_private.C \
|
moc_FileDialog_private.C \
|
||||||
|
moc_FormBase.C \
|
||||||
moc_FormCitationDialog.C \
|
moc_FormCitationDialog.C \
|
||||||
moc_FormCitationDialogImpl.C \
|
moc_FormCitationDialogImpl.C \
|
||||||
moc_FormCopyrightDialog.C \
|
moc_FormCopyrightDialog.C \
|
||||||
@ -160,6 +161,9 @@ dist-hook:
|
|||||||
done ; \
|
done ; \
|
||||||
done
|
done
|
||||||
|
|
||||||
|
moc_FormBase.C: FormBase.h
|
||||||
|
$(MOC) -o $@ $<
|
||||||
|
|
||||||
FormCitation.C: FormCitationDialog.h
|
FormCitation.C: FormCitationDialog.h
|
||||||
FormCitationDialog.h: FormCitationDialog.ui
|
FormCitationDialog.h: FormCitationDialog.ui
|
||||||
$(UIC) -o $@ $<
|
$(UIC) -o $@ $<
|
||||||
|
Loading…
Reference in New Issue
Block a user