summaryrefslogtreecommitdiff
path: root/ldmicro/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro/lib')
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.cpp8
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.h25
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp49
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.h17
4 files changed, 42 insertions, 57 deletions
diff --git a/ldmicro/lib/linuxUI/linuxLD.cpp b/ldmicro/lib/linuxUI/linuxLD.cpp
index a83d15e..d43fd0e 100644
--- a/ldmicro/lib/linuxUI/linuxLD.cpp
+++ b/ldmicro/lib/linuxUI/linuxLD.cpp
@@ -119,10 +119,10 @@ HICON LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType, int cxDesired,
void RECT_to_GDRECT(const RECT *rc, GDRECT *gdrc)
{
- gdrc->x = rc->left;
- gdrc->y = rc->top;
- gdrc->width = rc->right - rc->left;
- gdrc->height = rc->bottom - rc->top;
+ // gdrc->x = rc->left;
+ // gdrc->y = rc->top;
+ // gdrc->width = rc->right - rc->left;
+ // gdrc->height = rc->bottom - rc->top;
}
void OutputDebugString(char* str)
diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h
index f1abbaf..29e6ebc 100644
--- a/ldmicro/lib/linuxUI/linuxLD.h
+++ b/ldmicro/lib/linuxUI/linuxLD.h
@@ -70,18 +70,19 @@ typedef PVOID HANDLE;
typedef HANDLE HINSTANCE;
typedef HANDLE HGDIOBJ;
-typedef cairo_t *HCRDC;
-typedef QWidget* HWID;
-typedef QWidget* HWND;
-typedef QTreeWidget *HLIST;
-typedef GtkTreeIter ITLIST;
-typedef GtkApplication *HAPP;
-typedef GtkTreeViewColumn *HTVC;
-typedef GdkPixbuf *HICON;
-typedef GdkRectangle GDRECT;
-typedef GDRECT *PGDRECT;
-typedef QMenu* HMENU;
-typedef ITLIST *HITLIST;
+typedef GtkApplication* HAPP;
+typedef GtkTreeViewColumn* HTVC;
+typedef GdkRectangle* GDRECT;
+typedef QTreeWidget* HLIST;
+typedef GtkTreeIter ITLIST;
+typedef GDRECT* PGDRECT;
+typedef QMenu* HMENU;
+typedef ITLIST* HITLIST;
+typedef QPalette* HCRDC;
+typedef QWidget* HWID;
+typedef QWidget* HWND;
+typedef GdkPixbuf* HICON;
+
/// Check if system is x64 or x86
#if defined(__UNIX64)
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index e8a8ab5..727fea8 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -284,26 +284,15 @@ HANDLE GetStockObject(int fnObject)
}
}
-void SelectObject(HCRDC hcr, HFONT hfont)
+void SelectObject(QPainter* hcr, HFONT hfont)
{
if (hcr ==NULL)
return;
-
- cairo_select_font_face(hcr, hfont->lpszFace,
- hfont->fdwItalic ? CAIRO_FONT_SLANT_ITALIC : CAIRO_FONT_SLANT_NORMAL,
- hfont->fnWeight == FW_BOLD ? CAIRO_FONT_WEIGHT_BOLD : CAIRO_FONT_WEIGHT_NORMAL);
-
- cairo_rotate(hcr, hfont->nOrientation);
- // cairo_text_extents_t extents;
- // cairo_text_extents (hcr, "Z", &extents);
- // cairo_matrix_t matrix;
- // cairo_matrix_init_scale (&matrix,
- // (double)hfont->nWidth,
- // (double)hfont->nHeight);
-
- // cairo_set_font_matrix (hcr, &matrix);
-
- cairo_set_font_size(hcr, 10);
+ QFont qtfont(hfont->lpszFace);
+ qtfont.setPointSize(hfont->nHeight);
+ qtfont.setStyle(hfont->fdwItalic ? QFont::StyleItalic : QFont::StyleNormal);
+ qtfont.setWeight(hfont->fnWeight == FW_BOLD ? QFont::Bold : QFont::Normal);
+ hcr->setFont();
}
HBRUSH CreateBrushIndirect(PLOGBRUSH plb)
@@ -334,28 +323,8 @@ HFONT CreateFont(int nHeight, int nWidth, int nOrientation, int fnWeight,
void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol)
{
-/* if (hcr == NULL)
- return;
-
- gtk_widget_override_background_color(GTK_WIDGET(widget),
- GTK_STATE_FLAG_NORMAL, &bkCol);
-
- gint width = gtk_widget_get_allocated_width (widget);
- gint height = gtk_widget_get_allocated_height (widget);
-
- // COLORREF col;
- // GtkStyleContext *context;
-
- // context = gtk_widget_get_style_context (widget);
-
- // gtk_style_context_get_color (context,
- // gtk_style_context_get_state (context),
- // &col);
- gdk_cairo_set_source_rgba (hcr, &bkCol);
- // cairo_rectangle(hcr, 0, 0, width, height);
- // cairo_stroke_preserve(hcr);
-
- cairo_fill (hcr);*/
+ hcr->setColor(QPalette::Background, bkCol);
+ widget->setPalette(*hcr);
}
void SetTextColor(HCRDC hcr, COLORREF color)
@@ -540,3 +509,5 @@ void DestroyWindow (HWID widget)
gtk_widget_destroy (widget);
}*/
}
+
+
diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h
index e482051..88a89c4 100644
--- a/ldmicro/lib/linuxUI/linuxUI.h
+++ b/ldmicro/lib/linuxUI/linuxUI.h
@@ -9,6 +9,8 @@
#include <QMenuBar>
#include <QVBoxLayout>
#include <QLabel>
+#include <QPainter>
+// #include <QtGui>
// #include <QSize>
// #include "freezeLD.h"
// #include "linuxLD.h"
@@ -186,7 +188,7 @@ void CheckMenuItem(
HANDLE GetStockObject(int fnObject);
void SelectObject(
- HCRDC hcr,
+ QPainter* hcr,
HFONT hfont);
HBRUSH CreateBrushIndirect(PLOGBRUSH plb);
@@ -265,6 +267,17 @@ BOOL KillTimer(
void DestroyWindow (HWID widget);
-
+class PaintWidget : public QWidget
+{
+ Q_OBJECT
+public:
+ // MyWidget();
+
+protected:
+ void paintEvent(QPaintEvent *event);
+signals:
+
+public slots:
+};
#endif \ No newline at end of file