diff options
Diffstat (limited to 'src/widgets/unitlistview.h')
-rw-r--r-- | src/widgets/unitlistview.h | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/src/widgets/unitlistview.h b/src/widgets/unitlistview.h new file mode 100644 index 0000000..b71b67f --- /dev/null +++ b/src/widgets/unitlistview.h @@ -0,0 +1,76 @@ +/*************************************************************************** +* Copyright (C) 2004 by * +* Jason Kivlighn ([email protected]) * +* Unai Garro ([email protected]) * +* Cyril Bosselut ([email protected]) * +* * +* This program is free software; you can redistribute it and/or modify * +* it under the terms of the GNU General Public License as published by * +* the Free Software Foundation; either version 2 of the License, or * +* (at your option) any later version. * +***************************************************************************/ + +#ifndef UNITLISTVIEW_H +#define UNITLISTVIEW_H + +#include "dblistviewbase.h" + +#include "datablocks/unit.h" + +class TQComboBox; + +class RecipeDB; +class TDEPopupMenu; + +class UnitListView : public DBListViewBase +{ + TQ_OBJECT + +public: + UnitListView( TQWidget *parent, RecipeDB *db ); + +public slots: + virtual void load( int curr_limit, int curr_offset ); + +protected slots: + virtual void createUnit( const Unit & ) = 0; + virtual void removeUnit( int ) = 0; + + void checkCreateUnit( const Unit &el ); + +protected: + virtual void init(); +}; + +class StdUnitListView : public UnitListView +{ + TQ_OBJECT + +public: + StdUnitListView( TQWidget *parent, RecipeDB *db, bool editable = false ); + +protected: + virtual void createUnit( const Unit & ); + virtual void removeUnit( int ); + +private slots: + void showPopup( TDEListView *, TQListViewItem *, const TQPoint & ); + void hideTypeCombo(); + void updateType( int type ); + + void createNew(); + void remove(); + void rename(); + + void modUnit( TQListViewItem* i, const TQPoint &p, int c ); + void saveUnit( TQListViewItem* i, const TQString &text, int c ); + +private: + bool checkBounds( const Unit &unit ); + void insertTypeComboBox( TQListViewItem* ); + + TDEPopupMenu *kpop; + TQComboBox *typeComboBox; +}; + +#endif //UNITLISTVIEW_H |