21 #include <tjutils/tjlog.h>
22 #include <tjutils/tjstatic.h>
23 #include <tjutils/tjvector.h>
27 #define _FONT_TYPE_ "helvetica"
28 #define _ARRAY_WIDGET_WIDTH_ 270
29 #define _ARRAY_WIDGET_HEIGHT_ 180
30 #define _ARRAY_BACKGROUND_COLOR_ "Black"
31 #define _ARRAY_FOREGROUND_COLOR1_ "White"
32 #define _ARRAY_FOREGROUND_COLOR2_ "Grey"
33 #define _ARRAY_GRID_COLOR_ "Green"
34 #define _ARRAY_GRID_DARK_FACTOR_ 250
35 #define _ARRAY_SELECTION_COLOR_ "Yellow"
36 #define _ARRAY_HIGHLIGHT_COLOR_ "Orange"
37 #define _ARRAY_MARKER_COLOR_ "Blue"
38 #define _ARRAY_MARKER_BRIGHT_FACTOR_ 180
39 #define _LAYOUT_STRETCH_FACTOR_ 1
40 #define SLIDER_CELL_WIDTH 75
41 #define SLIDER_CELL_HEIGHT 25
42 #define TEXTEDIT_WIDTH 75
43 #define TEXTEDIT_HEIGHT 25
44 #define PLOT_SYMBOLS_SIZE 5
51 #define _FONT_SIZE_ 10
81 class QProgressDialog;
87 class QTableWidgetItem;
89 class QTreeWidgetItem;
109 static const char* get_compName();
116 const char* c_str(
const QString& qs);
118 int layout_border_size();
120 void init_label(QLabel* ql);
122 bool left_button(
const QMouseEvent* qme,
bool return_current_state);
123 bool right_button(
const QMouseEvent* qme,
bool return_current_state);
124 bool middle_button(
const QMouseEvent* qme,
bool return_current_state);
126 void add_tooltip(QWidget* w,
const char* txt);
128 void set_platform_defaults(QWidget* w,
bool enable=
true);
131 STD_string get_save_filename(
const char* caption=0,
const char* startwith=
"",
const char* filter=
"", QWidget* parent=0);
132 STD_string get_open_filename(
const char* caption=0,
const char* startwith=
"",
const char* filter=
"", QWidget* parent=0);
133 STD_string get_directory(
const char* caption=0,
const char* startwith=
"", QWidget* parent=0);
135 bool message_question(
const char* text,
const char* caption, QWidget* parent,
bool ask=
false,
bool error=
false);
138 int paintdevice_height(
const QPaintDevice* qpd);
139 int paintdevice_width(
const QPaintDevice* qpd);
141 svector get_possible_image_fileformats();
153 GuiGridLayout(QWidget *parent,
int rows,
int columns,
bool margin=
true);
156 enum Alignment {Default, VCenter, Center};
158 void add_widget(QWidget *w,
int row,
int column, Alignment alignment=Default,
int rowSpan=1,
int columnSpan=1 );
160 void set_col_stretch(
int col,
int factor);
161 void set_row_stretch(
int row,
int factor);
163 void set_col_minsize(
int col,
int minsize);
164 void set_row_minsize(
int row,
int minsize);
178 GuiButton(QWidget *parent, QObject* receiver,
const char* member,
const char *onlabel,
const char *offlabel=0,
bool initstate=
false);
181 void set_toggled(
bool state);
183 void set_text(
bool state);
185 void set_default(
bool state);
189 QWidget* get_widget();
207 GuiLineEdit(QWidget *parent, QObject* receiver,
const char* member,
int width=-1,
int height=-1);
210 void set_text(
const char* txt);
212 const char* get_text()
const;
216 QWidget* get_widget();
236 void insert_item(
const char* text,
const QObject* receiver,
const char* member,
int accel=0);
237 void insert_separator();
239 void popup(
const QPoint& p);
257 GuiSlider(QWidget *parent,
int minValue,
int maxValue,
int pageStep,
int value,
int tickInterval);
260 int get_value()
const;
261 void set_value(
int val);
262 bool modified_externally()
const {
bool result=modified; modified=
false;
return result;}
264 QSlider* get_widget() {
return qs;}
268 mutable bool modified;
285 void set_names(
const svector& names);
287 void set_current_item(
int index);
288 int get_current_item()
const;
290 QComboBox* get_widget() {
return qcb;}
293 void common_init(QWidget* parent,
const svector& names);
309 void moveTo(
int x,
int y);
310 void lineTo(
int x,
int y);
311 bool begin(QPixmap* qpm);
313 void setPen(
const char* pencolor,
int linewidth=1,
bool dotted=
false,
float lightdark=0.0);
314 void fillRect(
int x,
int y,
int w,
int h,
const QColor& col);
315 void drawRect(
int x,
int y,
int w,
int h);
316 void drawText(
int x,
int y,
const QString& txt,
const QColor& col);
318 QRegion* draw_region(
const STD_list<QPoint>& plist);
320 QPainter* get_painter() {
return qp;}
322 void repaint(QLabel* dst);
327 int x_cache, y_cache;
341 int start(QWidget* mainwidget);
343 QObject* get_object();
348 static char** argv();
350 static void process_events();
356 static int argc_cache;
357 static char** argv_cache;
359 static char** argv4qt;
374 void show(QWidget* central_widget,
bool show_toolbutton_text=
false);
376 void set_caption(
const char* text);
378 void set_status_message(
const char* text,
int timeout_ms=0);
380 void set_status_xpm(
const char** xpm);
382 QWidget* get_widget();
384 void insert_menu(
const char* text,
GuiPopupMenu * gpm);
386 void insert_menu_separator();
408 GuiScroll(QWidget* child, QWidget* parent);
411 QWidget* get_widget();
421 class QDialogDerived;
429 GuiDialog(QWidget *parent,
const char* caption,
bool modal=
false);
432 QWidget* get_widget();
434 virtual void repaint() {}
435 virtual void close() {}
458 void set_progress(
int progr);
459 int get_progress()
const;
461 void set_total_steps(
int steps);
463 bool was_cancelled()
const;
467 void set_text(
const char* txt);
473 QProgressDialog* qpd;
484 GuiImage(
unsigned char* data,
int width,
int height,
bool colormap);
487 QPixmap* create_pixmap()
const;
498 class GuiListViewCallback {
504 GuiListViewCallback() {}
515 GuiListView(QWidget *parent,
const svector& column_labels,
int first_column_width=-1,
int min_height=-1, GuiListViewCallback* callback=0,
bool tree=
false);
518 QWidget* get_widget();
541 bool is_checked()
const;
543 const char* get_text()
const;
546 static void init_static();
547 static void destroy_static();
553 QCheckListItem* qcli;
554 QTableWidgetItem* qtwi;
555 QTreeWidgetItem* qtrwi;
556 QTreeWidget* parent_qtrw;
559 static STD_map<QListViewItem*,GuiListItem*>* listmap;
560 static STD_map<QTableWidgetItem*,GuiListItem*>* tablemap;
574 void set_progress(
int progr);
576 void set_min_width(
int w);
578 QWidget* get_widget();
595 void set_values(
int min,
int max,
int linestep,
int pagestep,
int value);
597 QScrollBar* get_widget();
614 QWidget* get_widget();
616 void add_separator();
632 GuiToolButton(
GuiToolBar* parent,
const char** xpm,
const char* label, QObject* receiver,
const char* member,
bool checkable=
false,
bool initstate=
false );
636 void set_on(
bool flag);
638 void set_enabled(
bool flag);
640 void set_label(
const char* text);
641 void set_tooltip(
const char* text);
661 bool setup(QWidget* parent);
663 QPaintDevice* get_device();
677 GuiTextView(QWidget* parent,
int minwidth,
int minheight);
680 void set_text(
const char* txt);
681 void append_text(
const char* txt);
683 QWidget* get_widget();