summaryrefslogtreecommitdiffstats
path: root/parts/filecreate/filecreate_widget2.h
blob: a8a3b38e515af54f8a29866d9492a1f453238321 (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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
/***************************************************************************
 *   Copyright (C) 2003 by Julian Rockey                                   *
 *   linux@jrockey.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 __FILECREATE_WIDGET2_H__
#define __FILECREATE_WIDGET2_H__

#include <kdeversion.h>
#include <tqtable.h>
#include <tqstring.h>
#include <tqmap.h>

//#include <klistview.h>

#include "filecreate_typechooser.h"

class KIconLoader;
class KDevProject;
class FileCreatePart;

namespace FileCreate {

  class FileType;

  class FriendlyWidget : public TQTable, public TypeChooser
    {
      Q_OBJECT
  TQ_OBJECT

      public:

        FriendlyWidget(FileCreatePart *part);
        virtual ~FriendlyWidget();

	/**
	 * Refreshes the widget with the part's file type list.
	 */
	virtual void refresh();
	/**
	 * Sets the currently highlighted file type.
	 */
	virtual void setCurrent(const FileType * current);

      protected:
	/**
	 * Sets row <i>row</i> to filetype <i>filetype</i>.
	 */
	virtual void setRow(int row, FileType * filetype);
	/**
	 * Clears the table.
	 */
	virtual void empty();
	/**
	 * Sets some default column widths.
	 */
	virtual void setDefaultColumnWidths();
	/**
	 * Scans the cells in the table and adjusts their size based
	 * on their contents.
	 */
	virtual void resizeCells();
	/**
	 * Sets the height of a row to the highest
	 * cell in the row.
	 */
	virtual void resizeRow(int row);
	/**
	 * Sets the width of a column to the widest
	 * cell in the column.
	 */
	virtual void resizeColumn(int col);

	/**
	 * The default icon loader, here for convenience.
	 */
	KIconLoader * m_iconLoader;
	/**
	 * A mapping of each row number to a file type.
	 */
	TQMap<int,FileType*> typeForRow;
	/**
	 * The currently selected file type, or null if none.
	 */
	FileType * m_selected;

      protected slots:
	/**
	 * When a cell is selected by the user.
	 */
	virtual void slotCellSelected(int row, int col);
	/**
	 * Invoked as a single shot after slotCellSelected, with m_selected
	 * set to the selected file type, so that
	 * the GUI will be updated before the selection event
	 * takes place.
	 */
	virtual void slotDoSelection();


    };

}

#endif