comparison src/gui_kde_wid.h @ 42:c75153d791d0

updated for version 7.0026
author vimboss
date Wed, 29 Dec 2004 20:58:21 +0000
parents 4ac1dce8dd5e
children
comparison
equal deleted inserted replaced
41:f529edb9bab3 42:c75153d791d0
66 class QDialog; 66 class QDialog;
67 class QLineEdit; 67 class QLineEdit;
68 class QSignalMapper; 68 class QSignalMapper;
69 class QPaintEvent; 69 class QPaintEvent;
70 70
71 enum BlinkState { 71 enum BlinkState
72 {
72 BLINK_NONE, 73 BLINK_NONE,
73 BLINK_ON, 74 BLINK_ON,
74 BLINK_OFF 75 BLINK_OFF
75 }; 76 };
76 77
77 class VimWidget : public QWidget, virtual public KVim 78 class VimWidget : public QWidget, virtual public KVim
78 { 79 {
79 Q_OBJECT 80 Q_OBJECT
80 81
81 public: 82 public:
82 VimWidget( QWidget *parent=0, const char *name=0, WFlags f=0 ); 83 VimWidget(QWidget *parent = 0, const char *name = 0, WFlags f = 0);
83 virtual void paintEvent( QPaintEvent *); 84 virtual void paintEvent(QPaintEvent *);
84 void draw_string(int x, int y, QString s, int len, int flags); 85 void draw_string(int x, int y, QString s, int len, int flags);
85 86
86 /** Init the blinking time */ 87 /** Init the blinking time */
87 void set_blink_time( long, long, long ); 88 void set_blink_time(long, long, long);
88 void start_cursor_blinking(); 89 void start_cursor_blinking();
89 void stop_cursor_blinking(); 90 void stop_cursor_blinking();
90 void wait(long); 91 void wait(long);
91 #ifdef FEAT_CLIENTSERVER 92 #ifdef FEAT_CLIENTSERVER
92 void serverActivate(WId id); 93 void serverActivate(WId id);
106 107
107 bool wait_done; 108 bool wait_done;
108 BlinkState blink_state; 109 BlinkState blink_state;
109 QPainter *painter; 110 QPainter *painter;
110 QPopupMenu *menu; 111 QPopupMenu *menu;
112 virtual void setMicroFocusHint(int x, int y, int w, int h, bool text=TRUE, QFont *f = 0)
113 {
114 QWidget::setMicroFocusHint(x, y, w, h, text, f);
115 }
111 116
112 protected: 117 protected:
113 virtual void keyPressEvent( QKeyEvent * ); 118 virtual void keyPressEvent(QKeyEvent *);
114 virtual void mousePressEvent( QMouseEvent *); 119 virtual void mousePressEvent(QMouseEvent *);
115 virtual void mouseDoubleClickEvent( QMouseEvent *); 120 virtual void mouseDoubleClickEvent(QMouseEvent *);
116 virtual void mouseReleaseEvent( QMouseEvent *); 121 virtual void mouseReleaseEvent(QMouseEvent *);
117 virtual void mouseMoveEvent( QMouseEvent *); 122 virtual void mouseMoveEvent(QMouseEvent *);
118 virtual void focusInEvent( QFocusEvent * ); 123 virtual void focusInEvent(QFocusEvent *);
119 virtual void focusOutEvent( QFocusEvent * ); 124 virtual void focusOutEvent(QFocusEvent *);
120 virtual void dragEnterEvent (QDragEnterEvent *); 125 virtual void dragEnterEvent(QDragEnterEvent *);
121 virtual void dropEvent (QDropEvent *); 126 virtual void dropEvent(QDropEvent *);
122 #ifdef FEAT_XIM 127 #ifdef FEAT_XIM
123 virtual void imStartEvent ( QIMEvent * ); 128 virtual void imStartEvent(QIMEvent *);
124 virtual void imEndEvent ( QIMEvent * ); 129 virtual void imEndEvent(QIMEvent *);
125 virtual void imComposeEvent ( QIMEvent * ); 130 virtual void imComposeEvent(QIMEvent *);
126 #endif 131 #endif
127 #ifdef FEAT_MZSCHEME 132 #ifdef FEAT_MZSCHEME
128 virtual void timerEvent( QTimerEvent * ); 133 virtual void timerEvent(QTimerEvent *);
129 #endif 134 #endif
130 135
131 /* cursor blinking stuff */ 136 /* cursor blinking stuff */
132 QTimer blink_timer; 137 QTimer blink_timer;
133 long blink_wait_time, blink_on_time, blink_off_time; 138 long blink_wait_time, blink_on_time, blink_off_time;
147 class VimMainWindow : public KMainWindow 152 class VimMainWindow : public KMainWindow
148 { 153 {
149 Q_OBJECT 154 Q_OBJECT
150 155
151 public: 156 public:
152 VimMainWindow ( const char *name = 0L, WFlags f = WDestructiveClose ); 157 VimMainWindow(const char *name = 0L, WFlags f = WDestructiveClose);
153 158
154 /** called when the widget closes */ 159 /** called when the widget closes */
155 // bool close(bool alsoDelete); 160 // bool close(bool alsoDelete);
156 VimWidget *w; 161 VimWidget *w;
157 KEdFind *finddlg; 162 KEdFind *finddlg;
158 KEdReplace *repldlg; 163 KEdReplace *repldlg;
159 int have_tearoff; 164 int have_tearoff;
160 QTextCodec *codec; 165 QTextCodec *codec;
161 166
162 public slots: 167 public slots:
163 void menu_activated(int dx); 168 void menu_activated(int dx);
164 void clipboard_selection_update(); 169 void clipboard_selection_update();
165 void clipboard_data_update(); 170 void clipboard_data_update();
166 void slotSearch(); 171 void slotSearch();
167 void slotFind(); 172 void slotFind();
168 void slotReplace(); 173 void slotReplace();
169 void slotReplaceAll(); 174 void slotReplaceAll();
170 void showAboutApplication(); 175 void showAboutApplication();
171 void showAboutKDE(); 176 void showAboutKDE();
172 void showBugReport(); 177 void showBugReport();
173 void showTipOfTheDay(); 178 void showTipOfTheDay();
174 void buffersToolbar(); 179 void buffersToolbar();
175 bool isLocked(); 180 bool isLocked();
176 void lock(); 181 void lock();
177 void unlock(); 182 void unlock();
178 183
179 protected: 184 protected:
180 virtual void wheelEvent (QWheelEvent *); 185 virtual void wheelEvent(QWheelEvent *);
181 virtual void resizeEvent ( QResizeEvent *e ); 186 virtual void resizeEvent(QResizeEvent *e);
182 187
183 #if defined(FEAT_SESSION) 188 #if defined(FEAT_SESSION)
184 void saveGlobalProperties (KConfig *conf); 189 void saveGlobalProperties(KConfig *conf);
185 void readGlobalProperties (KConfig *conf); 190 void readGlobalProperties(KConfig *conf);
186 #endif 191 #endif
187 bool queryClose(); 192 bool queryClose();
188 bool queryExit(); 193 bool queryExit();
189 bool locked; 194 bool locked;
190 }; 195 };
192 197
193 class VimDialog : public QDialog 198 class VimDialog : public QDialog
194 { 199 {
195 Q_OBJECT 200 Q_OBJECT
196 public: 201 public:
197 VimDialog (int type, /* type of dialog */ 202 VimDialog(int type, /* type of dialog */
198 unsigned char * title, /* title of dialog */ 203 unsigned char *title, /* title of dialog */
199 unsigned char * message, /* message text */ 204 unsigned char *message, /* message text */
200 unsigned char * buttons, /* names of buttons */ 205 unsigned char *buttons, /* names of buttons */
201 int def_but, /* default button */ 206 int def_but, /* default button */
202 char_u *textfield); /* input text */ 207 char_u *textfield); /* input text */
203 private: 208 private:
204 QSignalMapper mapper; 209 QSignalMapper mapper;
205 QLineEdit *entry; 210 QLineEdit *entry;
227 void sbUsed(int who); 232 void sbUsed(int who);
228 private: 233 private:
229 QSignalMapper mapper; 234 QSignalMapper mapper;
230 }; 235 };
231 236
232 class KVimUtils { 237 class KVimUtils
238 {
233 public: 239 public:
234 static QString convertEncodingName(QString); 240 static QString convertEncodingName(QString);
235 #if QT_VERSION<300 241 #if QT_VERSION<300
236 static bool fromString(QFont*,QString); 242 static bool fromString(QFont*,QString);
237 static QString toString(QFont*); 243 static QString toString(QFont*);
238 #endif 244 #endif
239 }; 245 };
240 246
241 extern VimMainWindow *vmw; 247 extern VimMainWindow *vmw;
242 extern SBPool *sbpool; 248 extern SBPool *sbpool;
243 extern QString *argServerName; 249 extern QString *argServerName;
250
251 #define QSTR(x) \
252 (has_mbyte ? \
253 (enc_utf8 ? \
254 QString::fromUtf8((const char *)x) : \
255 QString::fromLocal8Bit((const char *)x)) : \
256 QString((const char *)x))
244 257
245 #endif // GUI_KDE_WIDGET 258 #endif // GUI_KDE_WIDGET