diff options
Diffstat (limited to 'ldmicro/lib')
-rw-r--r-- | ldmicro/lib/linuxUI/linuxLD.h | 4 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.cpp | 38 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.h | 12 |
3 files changed, 44 insertions, 10 deletions
diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h index 5f8e0e7..c593ba6 100644 --- a/ldmicro/lib/linuxUI/linuxLD.h +++ b/ldmicro/lib/linuxUI/linuxLD.h @@ -24,6 +24,7 @@ /// Macro functions #define max(_A, _B) std::max(_A, _B) +// #define min(_A, _B) std::min(_A, _B) /// Typedefs //typedef int64_t __int64; @@ -73,6 +74,9 @@ typedef GtkListStore *HLIST; typedef GtkApplication *HAPP; typedef GtkTreeViewColumn *HTVC; typedef GdkPixbuf *HICON; +typedef GdkRectangle RECT; +typedef GdkRectangle *PRECT; + /// Check if system is x64 or x86 #if defined(__UNIX64) typedef uint64_t UINT_PTR; diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 70866f9..5206ce1 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -1,5 +1,8 @@ #include "linuxUI.h" +/// Variable to current text color +COLORREF HdcCurrentTextColor; + /// EnableMenuItem Variables const UINT MF_ENABLED = 0; const UINT MF_GRAYED = 1; @@ -203,18 +206,18 @@ void SelectObject(HCRDC hcr, HFONT hfont) cairo_rotate(hcr, hfont->nOrientation); - // cairo_text_extents_t extents; - // cairo_text_extents (hcr, "H", &extents); + cairo_text_extents_t extents; + cairo_text_extents (hcr, "H", &extents); - // cairo_matrix_t matrix; - // cairo_matrix_init_scale (&matrix, - // (double)hfont->nWidth / extents.width, - // (double)hfont->nHeight / extents.width); + cairo_matrix_t matrix; + cairo_matrix_init_scale (&matrix, + (double)hfont->nWidth * 1.6, + (double)hfont->nHeight * 1.4); - // cairo_set_font_matrix (hcr, &matrix); + cairo_set_font_matrix (hcr, &matrix); // g_print("wR = %f\nhR = %f\n", (double)hfont->nWidth / extents.width, (double)hfont->nHeight / extents.height); // g_print("tW = %f\ntH = %f\n", extents.width, extents.width); - cairo_set_font_size(hcr, 15); + // cairo_set_font_size(hcr, 15); } HBRUSH CreateBrushIndirect(PLOGBRUSH plb) @@ -262,6 +265,7 @@ void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol) void SetTextColor(HCRDC hcr, COLORREF color) { + HdcCurrentTextColor = color; gdk_cairo_set_source_rgba (hcr, &color); } @@ -272,4 +276,20 @@ void TextOut(HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, int cchStrin cairo_fill (hcr); } - + +COLORREF GetTextColor(HCRDC Hdc) +{ + // COLORREF col; + // gtk_style_context_get_color (Hdc, + // gtk_style_context_get_state (Hdc), + // &col); + + return HdcCurrentTextColor; +} + +BOOL InvalidateRect(HWID hWid, const RECT *lpRect, BOOL bErase) +{ + // gtk_widget_queue_draw(hWid); + gdk_window_invalidate_rect (gtk_widget_get_window (hWid), lpRect, bErase); +} + diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h index 552a6af..0fb0067 100644 --- a/ldmicro/lib/linuxUI/linuxUI.h +++ b/ldmicro/lib/linuxUI/linuxUI.h @@ -59,7 +59,7 @@ extern const UINT MF_UNCHECKED; extern GtkWidget *view; extern GtkTreeViewColumn *column; -/// data types +/// Structures typedef struct OpenFileInfoData { DWORD lStructSize; HWID parentWindow; @@ -71,6 +71,9 @@ typedef struct OpenFileInfoData { LPCTSTR lpstrDefExt; } OPENFILENAME; +/// Variables +extern COLORREF HdcCurrentTextColor; + /// functions BOOL isFocus(HWID window); @@ -120,4 +123,11 @@ void TextOut(HCRDC hcr, LPCTSTR lpString, int cchString); +COLORREF GetTextColor(HCRDC Hdc); + +BOOL InvalidateRect( + HWID hWId, + const RECT *lpRect, + BOOL bErase); + #endif
\ No newline at end of file |