summaryrefslogtreecommitdiffstats
path: root/krecipes/src/dialogs/ingredientsdialog.h
blob: dc17b8ae392b7a2bcd2f776f02bdced5fae314b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
/***************************************************************************
*   Copyright (C) 2003 by                                                 *
*   Unai Garro (ugarro@users.sourceforge.net)                             *
*   Cyril Bosselut (bosselut@b1project.com)                               *
*   Jason Kivlighn (jkivlighn@gmail.com)                                  *
*                                                                         *
*   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 INGREDIENTSDIALOG_H
#define INGREDIENTSDIALOG_H

#include <ntqpushbutton.h>
#include <ntqvbox.h>
#include <ntqlayout.h>
#include <ntqwidget.h>
#include <knuminput.h>

#include "widgets/krelistview.h"
#include "widgets/dblistviewbase.h"
#include "datablocks/unit.h"

class KDoubleNumInput;

class RecipeDB;
class ElementList;
class SelectUnitDialog;
class CreateElementDialog;
class IngredientPropertyList;
class SelectPropertyDialog;
class UnitsDialog;
class IngredientGroupsDialog;
class MixedNumber;

class IngredientsDialog: public TQWidget
{
TQ_OBJECT

public:
	IngredientsDialog( TQWidget* parent, RecipeDB *db );
	~IngredientsDialog();
	void reload( ReloadFlags flag = Load );

private:
	// Widgets
	TQGridLayout* layout;
	TQPushButton* addIngredientButton;
	TQPushButton* removeIngredientButton;
	TQPushButton* addUnitButton;
	TQPushButton* removeUnitButton;
	TQPushButton* addPropertyButton;
	TQPushButton* removePropertyButton;
	TQPushButton* addWeightButton;
	TQPushButton* removeWeightButton;
	KreListView* ingredientListView;
	KreListView* unitsListView;
	KreListView* propertiesListView;
	KreListView* weightsListView;
	TQPushButton* pushButton5;
	KDoubleNumInput* inputBox;
	IngredientGroupsDialog *groupsDialog;

	// Internal Methods
	void reloadIngredientList( ReloadFlags flag = Load );
	void reloadUnitList( void );
	void reloadPropertyList( void );
	void reloadWeightList( void );
	int findPropertyNo( TQListViewItem *it );

	// Internal Variables
	RecipeDB *database;
	UnitList *unitList;
	IngredientPropertyList *propertiesList;
	ElementList *perUnitListBack;

private slots:
	void addUnitToIngredient( void );
	void removeUnitFromIngredient( void );
	void addWeight();
	void removeWeight();
	void updateLists( void );
	void addPropertyToIngredient( void );
	void removePropertyFromIngredient( void );
	void insertPropertyEditBox( TQListViewItem* it );
	void setPropertyAmount( double amount );
	void openUSDADialog( void );
	void itemRenamed( TQListViewItem*, const TQPoint &, int col );
};

#endif