// // $Id: ExchangeCfgDlg.hpp,v 1.9 2008/12/23 00:29:40 philw Exp $ // #ifndef ExchangeCfgDlgINCLUDED #define ExchangeCfgDlgINCLUDED #ifndef EXCHANGECFGDLGBASE_H #include "qt/ExchangeCfgDlgBase.h" #endif #ifndef AcctGuiDefsINCLUDED #include "AcctGuiDefs.hpp" #endif #ifndef RootINCLUDED #include "Root.hpp" #endif #ifndef ExchangeINCLUDED #include "Exchange.hpp" #endif #ifndef UnitMgrINCLUDED #include "UnitMgr.hpp" #endif #ifndef GusListenerINCLUDED #include "GusListener.hpp" #endif //-------------------------------------------------- #include #include class QCloseEvent; class QShowEvent; class QHideEvent; // Forward class declarations class Payback; class Supply; class RootSelection; class GusSelector; //---------------------------------------------------------------- //+class // // CLASS: // ExchangeCfgDlg : public ExchangeCfgDlgBase // // DESCRIPTION: // // This dialog object class is intended to provide everything the user // needs to configure an accounting exchange. An exchange defines the // relationship between different accounts supplies and demands. // // This is NOT a singleton class -- the user is allowed to configure as // many exchanges as they wish at the same time. // // This dialog has been set up as a "GusListener" (Grand Unified Selector // listener) for three different types of Supply Selection -- i.e. to allow // the user to select the exchange's borrower, payback destination, and // payback sources. // class ExchangeCfgDlg : public ExchangeCfgDlgBase, public GusListener { Q_OBJECT private: class PaybackSrcItem : public Q3ListViewItem { private: const Payback* _paybackPtr; Q3ListView* _parent; public: // constructors and destructor PaybackSrcItem(Q3ListView* parent, const Payback* paybackPtr); virtual ~PaybackSrcItem(); // return the payback pointer const Payback* getPaybackPtr() const { return _paybackPtr; } void updateItemDisplay(); // virtual from QListViewItem virtual void startRename (int col); protected: // virtual from QListViewItem virtual void okRename(int col); }; private: // Don't use this constructor. // Made private to cause compile error if used, // given no body so link error if used. ExchangeCfgDlg(); public: AcctGuiDefs::DisplayMode _displayMode; ExchangeCfgDlg (Exchange* exchange, AcctGuiDefs::DisplayMode mode = AcctGuiDefs::EXISTING_EXCHANGE); virtual ~ExchangeCfgDlg(); protected: // Exchange/Payback Tracking Exchange* _exchangeCopy; // Where edits are made, before applying them. Exchange* _origExchange; // Kept around in case user chooses to reset PaybackEditList* _editablePaybacksList; QString _borrowNameCache; QString _destNameCache; Q3PopupMenu* _contextMenu; bool _isCancelCompleted; bool _deleteNewExchange; bool _isDialogClosing; // Initialization bool getEditableExchange (AcctGuiDefs::DisplayMode mode); void connectSignals(); // Updates dialog display void updateDialogContent(); void updateEnabledness(); // RiverwareViewer methods void disableModelEdit(); // GRAND UNIFIED SELECTOR (GUS) // ... only one for all Exchange Configuration Dialogs. static RootSelection* _rootSelection; static GusSelector* _gusSelector; static ExchangeCfgDlg* _gusExchCfgDlgUser; static char _gusUse; // 'B' Borrow Sply, 'D' Pback Dest, // 'A' Add Pback Source, 'M' Modify Pback Source void showGusSupplySelector (const RWCString& caption, char gusUse, Supply* sply); void closeGusSupplySelector (); void gusProcessSelectedSupply (GusSelector*); virtual void gusOk (GusSelector*, GusClientData*); virtual void gusApply (GusSelector*, GusClientData*); virtual void gusCancel (GusSelector*, GusClientData*); // Utility methods void addPaybackSource(Supply* sply); void modifyPaybackSource(Supply* sply); void saveNameLineEditChange(); void saveScaleLineEditChange(); // Close methods void closeDialog (bool isCancelRequired); virtual void closeEvent(QCloseEvent *e); bool checkInputs(); public: void closeDialogPublic(); protected: // Virtual from QWidget virtual void showEvent (QShowEvent*); virtual void hideEvent (QHideEvent*); protected: // Callbacks Callback* _workspaceClearedCB; Callback* _accountingStateChangedCB; Callback* _exchangeOrigCB; Callback* _exchangeCopyCB; void addCallbacks(); void deleteCallbacks(); int workspaceClearedHandler (CallbackType, CallbackData*, void*); int accountingStateChangedHandler (CallbackType, CallbackData*, void*); int exchangeCBHandler (CallbackType, CallbackData*, void*, bool isCopy); int exchangeOrigCBHandler (CallbackType, CallbackData*, void*); int exchangeCopyCBHandler (CallbackType, CallbackData*, void*); protected slots: void showWorkspaceHandler(); void configureSystemHandler(); void manageAccountsHandler(); void manageSuppliesHandler(); void borrowButtonHandler(int id); void payDestButtonHandler(int id); void selBorrowButtonHandler(); void selDestButtonHandler(); void nameLineEditHandler(); void addButtonHandler(); void modifyButtonHandler(); void removeButtonHandler(); void userUnitsComboHandler(const QString& units); void formatComboHandler(const QString& formatString); void scaleLineEditHandler(); void precisionSpinHandler(int value); void okButtonHandler(); void applyButtonHandler(); void resetButtonHandler(); void closeHandler(); void displayContextHandler(Q3ListViewItem*, const QPoint&, int); void editPaybackLossHandler(); void selectionChangedHandler(); void paySourceDoubleClickHandler(Q3ListViewItem*,const QPoint&,int); }; #endif //--- (end ExchangeCfgDlg.hpp) ---