diff options
author | Michele Calgaro <[email protected]> | 2024-10-13 11:56:14 +0900 |
---|---|---|
committer | Michele Calgaro <[email protected]> | 2024-10-29 21:58:42 +0900 |
commit | 2879ff70be9271550477982a1a6371714db38562 (patch) | |
tree | c2054149dba923ab080fe7093432c7663a990111 /src/widgets/ingredientlistview.h | |
parent | 3eb38d2556f676d1027746f20bf12a1dd74451ef (diff) | |
download | krecipes-2879ff70be9271550477982a1a6371714db38562.tar.gz krecipes-2879ff70be9271550477982a1a6371714db38562.zip |
Rearrange folders structure to remove unnecessary 'krecipes' second level subfolder
Signed-off-by: Michele Calgaro <[email protected]>
(cherry picked from commit 0c8ed6c9a4000af8f48581a81c4b5c2f5b9fd502)
Diffstat (limited to 'src/widgets/ingredientlistview.h')
-rw-r--r-- | src/widgets/ingredientlistview.h | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/src/widgets/ingredientlistview.h b/src/widgets/ingredientlistview.h new file mode 100644 index 0000000..58990c4 --- /dev/null +++ b/src/widgets/ingredientlistview.h @@ -0,0 +1,119 @@ +/*************************************************************************** +* Copyright (C) 2004 by * +* Jason Kivlighn ([email protected]) * +* Unai Garro ([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 INGREDIENTLISTVIEW_H +#define INGREDIENTLISTVIEW_H + +#include "dblistviewbase.h" + +#include "datablocks/element.h" + +class RecipeDB; +class TDEPopupMenu; +class IngredientCheckListView; + +/** +@author Unai Garro +*/ +class IngredientCheckListItem: public TQCheckListItem +{ +public: + IngredientCheckListItem( IngredientCheckListView* qlv, const Element &ing ); + IngredientCheckListItem( IngredientCheckListView* qlv, TQListViewItem *after, const Element &ing ); + ~IngredientCheckListItem( void ); + + int id( void ) const; + TQString name( void ) const; + Element ingredient() const; + + virtual TQString text( int column ) const; + +protected: + virtual void stateChange( bool on ); + +private: + Element *ingStored; + IngredientCheckListView *m_listview; +}; + + + +class IngredientListView : public DBListViewBase +{ + TQ_OBJECT + +public: + IngredientListView( TQWidget *parent, RecipeDB *db ); + +protected slots: + virtual void createIngredient( const Element & ) = 0; + virtual void removeIngredient( int ) = 0; + virtual void load(int limit,int offset); + +protected: + virtual void init(); + +private slots: + virtual void checkCreateIngredient( const Element & ); +}; + + + +class StdIngredientListView : public IngredientListView +{ + TQ_OBJECT + +public: + StdIngredientListView( TQWidget *parent, RecipeDB *db, bool editable = false ); + +protected: + virtual void createIngredient( const Element & ); + virtual void removeIngredient( int ); + +private slots: + void showPopup( TDEListView *, TQListViewItem *, const TQPoint & ); + + void createNew(); + void remove + (); + void rename(); + + void modIngredient( TQListViewItem* i ); + void saveIngredient( TQListViewItem* i ); + +private: + bool checkBounds( const TQString &name ); + + TDEPopupMenu *kpop; +}; + + + +class IngredientCheckListView : public IngredientListView +{ +public: + IngredientCheckListView( TQWidget *parent, RecipeDB *db ); + + virtual void stateChange(IngredientCheckListItem *,bool); + + TQValueList<Element> selections() const{ return m_selections; } + +protected: + virtual void createIngredient( const Element &ing ); + virtual void removeIngredient( int ); + + virtual void load( int limit, int offset ); + +private: + TQValueList<Element> m_selections; +}; + +#endif //INGREDIENTLISTVIEW_H |