1 #ifndef _XTQGANTTBARVIEWPORT_H_
2 #define _XTQGANTTBARVIEWPORT_H_
33 #include "KGanttItem.h"
39 #include <tdepopupmenu.h>
40 #include <tdetoolbar.h>
42 #include <tqptrdict.h>
44 #include <tqlineedit.h>
48 #define sgn(n) (n < 0 ? -1 : 1)
60 xTQTaskPosition( int nr, int x, int y, int w, int h, int hiSub,
61 int tPx, int tPy, int d)
62 : _nr(nr), _screenX(x), _screenY(y), _screenW(w), _screenH(h),
63 _screenHS(hiSub), _textPosX(tPx), _textPosY(tPy), _depth(d)
65 _screenHandleX = _screenHandleY = _screenHandleW = _screenHandleH = 0;
69 int _screenX, _screenY, _screenW;
72 int _textPosX, _textPosY;
74 int _screenHandleX, _screenHandleY, _screenHandleW, _screenHandleH;
100 enum Mode {Init, Select, Zoom, Move};
108 const char * name=0, WFlags f=0 );
123 void update( int x1, int y1, int x2, int y2);
127 TQPtrDict<xTQTaskPosition> _gItemList;
134 void addHoliday( int y, int m, int d);
143 Q_UNUSED(y); Q_UNUSED(m); Q_UNUSED(d);
148 TDEPopupMenu* menu() {
158 TDEToolBar* toolbar(TQMainWindow* mw = 0);
162 void zoom( double sfactor, int wx, int wy);
165 void zoom( double sfactor);
175 void modeChanged( int);
176 void scroll( int x, int y);
179 void message( const TQString& msg);
184 void setMode( int mode);
194 void popup( int index);
199 void deleteSelectedItems();
200 void insertIntoSelectedItem();
214 enum Position { Outside = 0, Handle = 1,
215 North = 2, South = 4,
223 inline int screenX( int wx);
230 inline int screenY( int wy);
237 inline int worldX( int sx);
244 inline int worldY( int sy);
250 int _grid, _snapgrid;
251 bool _drawGrid, _drawHeader;
255 int _marginX, _marginY;
256 double _scaleX, _scaleY;
261 TQCursor* _cursor_lupe;
264 TQLineEdit* _itemTextEdit;
273 TDEPopupMenu* _selectMenu;
275 TDEIconLoader* _iconloader;
277 TDEToolBar* _toolbar;
279 TQPoint* _startPoint, *_endPoint;
281 TQPtrList<TQDate> _holidays;
283 TQPtrList<KGanttItem> *_observedList;
290 void drawGrid(TQPainter*, int x1, int y1, int x2, int y2);
291 void drawHeader(TQPainter*, int x1, int y1, int x2, int y2);
292 void drawItem( KGanttItem* item, TQPainter* p, const TQRect& rect );
296 void recalc( KGanttItem* item, int xPos, int yPos, int depth, int nr );
305 void observeList(TQPtrList<KGanttItem>*);
307 Position check( KGanttItem** founditem, int x, int y);
309 void mousePressEvent(TQMouseEvent*);
310 void mouseReleaseEvent(TQMouseEvent*);
312 void wheelEvent ( TQWheelEvent * ) {
313 printf( "wheelEvent\n");
316 void mouseMoveEvent(TQMouseEvent*);
317 void keyPressEvent(TQKeyEvent* e);
318 void paintEvent(TQPaintEvent * e);
321 TQPixmap closedIcon, openedIcon;
331 int xQGanttBarViewPort::screenX( int wx)
334 return ( int) (0.5 + (wx + _marginX) * _scaleX);
336 int xQGanttBarViewPort::screenY( int wy)
339 return ( int) (0.5 + (wy + _marginY) * _scaleY);
341 int xQGanttBarViewPort::worldX( int sx)
344 return ( int) (0.5 + (sx/_scaleX - _marginX));
346 int xQGanttBarViewPort::worldY( int sy)
349 return ( int) (0.5 + (sy/_scaleY - _marginY));
void getSelectedItems(TQPtrList< KGanttItem > &list) Get all selected items.
TDEToolBar * toolbar(TQMainWindow *mw=0) Add gantt toolbar to main window.
TDEPopupMenu * menu() Get popup menu.
void removeHoliday(int y, int m, int d) Remove holiday.
|