summaryrefslogtreecommitdiffstats
path: root/kiten/widgets.h
blob: 1bf0782afbc8104742d6dac092555fc6fb96f0a2 (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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/**
 This file is part of Kiten, a KDE Japanese Reference Tool...
 Copyright (C) 2001  Jason Katz-Brown <jason@katzbrown.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.

 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301
 USA
**/

#ifndef KITEN_WIDGETS_H
#define KITEN_WIDGETS_H

#include <tqguardedptr.h>

#include <kaction.h>
#include <klineedit.h>
#include <kmainwindow.h>
#include <ktextbrowser.h>

class TDEListView;
class KStatusBar;

#include "dict.h"
#include "rad.h"

class KDE_EXPORT ResultView : public KTextBrowser
{
	Q_OBJECT
  
	
	public:
	ResultView(bool showLinks, TQWidget *parent = 0, const char *name = 0);

	void addResult(Dict::Entry result, bool common = false);
	void addKanjiResult(Dict::Entry, bool common = false, Radical = Radical());

	void addHeader(const TQString &, unsigned int degree = 3);

	public slots:
	void print(TQString = TQString());
	void append(const TQString &);
	void flush();
	void clear();
	void setBasicMode(bool yes) { basicMode = yes; }

	void updateFont();

	private:
	TQString putchars(const TQString &);
	TQString printText;

	bool links;
	bool basicMode;
};

class KDE_EXPORT eEdit : public TDEMainWindow
{
	Q_OBJECT
  
	
	public:
	eEdit(const TQString &, TQWidget *parent = 0, const char *name = 0);
	~eEdit();

	private slots:
	void add();
	void save();
	void del();
	void disable();
	void openFile(const TQString &);

	private:
	TDEListView *List;
	TQString filename;
	KStatusBar *StatusBar;
	TDEAction *addAct;
	TDEAction *removeAct;
	TDEAction *saveAct;
	bool isMod;
};

class KDE_EXPORT EditAction : public TDEAction
{
	Q_OBJECT
  
	public:
	EditAction( const TQString& text, int accel, const TQObject *receiver, const char *member, TQObject* parent, const char* name );
	virtual ~EditAction();

	virtual int plug( TQWidget *w, int index = -1 );

	virtual void unplug( TQWidget *w );

	TQString text() { return m_combo->text(); }
	void setText(const TQString &text);

	TQGuardedPtr<KLineEdit> editor();

	public slots:
	void insert(const TQString &);

	// also sets focus to the lineedit widget
	void clear();

	signals:
	void plugged();

private:
    TQGuardedPtr<KLineEdit> m_combo;
    const TQObject *m_receiver;
    const char *m_member;
};

#endif