File: qtutil.h

package info (click to toggle)
guymager 0.4.2-2
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 932 kB
  • ctags: 1,580
  • sloc: cpp: 8,522; ansic: 2,571; makefile: 49; sh: 23
file content (96 lines) | stat: -rw-r--r-- 3,286 bytes parent folder | download
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
// ****************************************************************************
//  Project:        GUYMAGER
// ****************************************************************************
//  Programmer:     Guy Voncken
//                  Police Grand-Ducale
//                  Service de Police Judiciaire
//                  Section Nouvelles Technologies
// ****************************************************************************
//  Module:         Different Qt utility functions
// ****************************************************************************


#ifndef __QTUTIL_H__
#define __QTUTIL_H__


#define QTUTIL_DEGREES(x) (16*x)
#define QTUTIL_FULL_CIRCLE QTUTIL_DEGREES(360)


#ifdef QDIALOG_H
//   const int QtUtilDefaultDialogFlags = Qt::WStyle_DialogBorder |
//                                        Qt::WStyle_StaysOnTop   |
//                                        Qt::WStyle_Dialog;

   const int QtUtilDefaultDialogFlags = Qt::WindowTitleHint;


// What QMessageBox::information does:
//    : QDialog( parent, name, modal, f | WStyle_Customize | WStyle_DialogBorder | WStyle_Title | WStyle_SysMenu )
#endif




#ifdef QCOLOR_H
   extern const QColor QtUtilColorDefault;
#endif

// ------------------------------------
//               Prototypes
// ------------------------------------

#ifdef QWIDGET_H
   APIRET QtUtilSetGeometryCentered (QWidget *pWidget, int Dx, int Dy);
#endif

#if defined QSTRING_H && defined QPAINTER_H && defined QFONT_H
   APIRET QtUtilGetTextAscent  (QPainter const *pPainter, QFont const *pFont, int *pDy);
   APIRET QtUtilGetTextDescent (QPainter const *pPainter, QFont const *pFont, int *pDy);
   APIRET QtUtilGetCharHeight  (QPainter const *pPainter, QFont const *pFont, int *pDy);
   APIRET QtUtilGetLineHeight  (QPainter const *pPainter, QFont const *pFont, int *pDy);
   APIRET QtUtilGetAvgStrWidth (QPainter const *pPainter, QFont const *pFont, int Chars, int *pAvgWidth);
   APIRET QtUtilGetTextSize    (QPainter const *pPainter, QFont const *pFont, const QString &Str, int *pDx, int *pDy);
   APIRET QtUtilGetNumStrWidth (QPainter const *pPainter, QFont const *pFont, int IntLen, int FrcLen , bool Signed, int *pDx);
#ifdef __STRUCT_H__
   APIRET QtUtilGetNumStrWidth (QPainter const *pPainter, QFont const *pFont, t_pParamUnit pParamUnit, bool Signed, int *pDx);
#endif
#endif

APIRET QtUtilSleep (int MilliSeconds);

#ifdef QLAYOUT_H
   APIRET QtUtilAdjustDefaults (QLayout *pLayout, bool TopLevelLayout=true);
   APIRET QtUtilAdjustLayout   (QLayout *pLayout, bool TopLevelLayout);
#endif
#ifdef QPUSHBUTTON_H
   APIRET QtUtilAdjustPushButton (QPushButton *pWidget);
#endif
#ifdef QLABEL_H
   APIRET QtUtilAdjustLabel      (QLabel      *pWidget);
#endif

APIRET QtUtilProcessCommand (const QString &Command, QString &StandardOutput);

APIRET QtUtilInit   (void);
APIRET QtUtilDeInit (void);

// ------------------------------------
//             Error codes
// ------------------------------------

enum
{
   ERROR_QTUTIL_DIALOG_STACK_OVERFLOW = ERROR_BASE_QTUTIL + 1,
   ERROR_QTUTIL_DIALOG_STACK_UNDERFLOW,
   ERROR_QTUTIL_DIALOG_INVALID_CUSTOMEVENT,
   ERROR_QTUTIL_DIALOG_UNEXPECTED_EVENT,
   ERROR_QTUTIL_INVALID_MESSAGEBOX_TYPE,
   ERROR_QTUTIL_UNFREED_MEMORY,
   ERROR_QTUTIL_COMMAND_TIMEOUT
};

#endif