diff options
Diffstat (limited to 'ldmicro/lib/linuxUI')
-rw-r--r-- | ldmicro/lib/linuxUI/linuxLD.h | 10 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.cpp | 49 | ||||
-rw-r--r-- | ldmicro/lib/linuxUI/linuxUI.h | 24 |
3 files changed, 66 insertions, 17 deletions
diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h index 8a3e3a2..80f4471 100644 --- a/ldmicro/lib/linuxUI/linuxLD.h +++ b/ldmicro/lib/linuxUI/linuxLD.h @@ -16,6 +16,7 @@ #define CALLBACK #define CONST const +/// Meamory flags #define HEAP_ZERO_MEMORY 0x00000008 /// Image loading flags @@ -24,7 +25,6 @@ /// Macro functions #define max(_A, _B) std::max(_A, _B) -// #define min(_A, _B) std::min(_A, _B) /// Typedefs //typedef int64_t __int64; @@ -114,6 +114,14 @@ typedef class tagColorReferance: public GdkRGBA{ this->alpha = 1.0; } + bool operator== (tagColorReferance& arg1) + { + if( ((int)arg1.red == (int)this->red) && ((int)arg1.green == (int)this->green) && ((int)arg1.blue == (int)this->blue) ) + return true; + else + return false; + } + GdkRGBA* getThis() { return this; diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp index 062d10c..52c4c36 100644 --- a/ldmicro/lib/linuxUI/linuxUI.cpp +++ b/ldmicro/lib/linuxUI/linuxUI.cpp @@ -25,7 +25,7 @@ HWID view; HTVC column; /// Wraper function for gtk_window_has_toplevel_focus -BOOL isFocus(HWID window) +BOOL GetFocus(HWID window) { return (BOOL) gtk_window_has_toplevel_focus(GTK_WINDOW(window)); } @@ -263,23 +263,24 @@ HFONT CreateFont(int nHeight, int nWidth, int nOrientation, int fnWeight, void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol) { - gtk_widget_override_background_color(GTK_WIDGET(widget), - GTK_STATE_FLAG_NORMAL, &bkCol); + // gtk_widget_override_background_color(GTK_WIDGET(widget), + // GTK_STATE_FLAG_NORMAL, &bkCol); - GtkStyleContext *context; - COLORREF col; + // gint width = gtk_widget_get_allocated_width (widget); + // gint height = gtk_widget_get_allocated_height (widget); - context = gtk_widget_get_style_context (widget); - 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); + // gtk_style_context_get_color (context, + // gtk_style_context_get_state (context), + // &col); - gdk_cairo_set_source_rgba (hcr, &col); + // gdk_cairo_set_source_rgba (hcr, &col); - gtk_render_background (context, hcr, 0, 0, width, height); + // cairo_fill (hcr); } void SetTextColor(HCRDC hcr, COLORREF color) @@ -290,7 +291,7 @@ void SetTextColor(HCRDC hcr, COLORREF color) void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, int cchString) { - nYStart += 20; + nYStart += 30; cairo_text_extents_t extents; cairo_text_extents (hcr, lpString, &extents); @@ -301,12 +302,14 @@ void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, i if(nYStart+(extents.height/2.0) >= height) { - height += extents.height; + // g_print("Y extend\n"); + height += extents.height + 50; resize_flag = TRUE; } if (nXStart+(extents.width/2.0) >= width) { + // g_print("X extend\n"); width += extents.width; resize_flag = TRUE; } @@ -320,6 +323,8 @@ void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, i cairo_move_to(hcr, nXStart, nYStart); cairo_show_text(hcr, text); + // g_print("%s", text); + cairo_fill (hcr); } @@ -336,7 +341,10 @@ COLORREF GetTextColor(HCRDC Hdc) BOOL InvalidateRect(HWID hWid, const RECT *lpRect, BOOL bErase) { if(!GDK_IS_WINDOW(hWid)) + { + // g_print("not window\n"); return FALSE; + } if (lpRect == NULL) { @@ -365,6 +373,17 @@ int FillRect(HCRDC hDC, const RECT *lprc, HBRUSH hbr) return 0; } +BOOL PatBlt(HCRDC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD dwRop, HBRUSH hbr) +{ + cairo_set_source_rgb(hdc, hbr->red, hbr->green, hbr->blue); + cairo_rectangle(hdc, nXLeft, nYLeft + 20, nWidth, nHeight); + cairo_stroke_preserve(hdc); + + cairo_fill(hdc); + + return TRUE; +} + BOOL GetClientRect(HWID hWid, PRECT pRect) { GtkAllocation allocation; diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h index 961822f..bda2c5d 100644 --- a/ldmicro/lib/linuxUI/linuxUI.h +++ b/ldmicro/lib/linuxUI/linuxUI.h @@ -33,11 +33,24 @@ #define MB_ICONWARNING 0x00000040L #define MB_ICONINFORMATION 0x00000080L +/// Scroll +#define SB_LINEUP 0x00000001 +#define SB_PAGEUP 0x00000002 +#define SB_LINEDOWN 0x00000004 +#define SB_PAGEDOWN 0x00000008 +#define SB_TOP 0x00000010 +#define SB_BOTTOM 0x00000020 +#define SB_THUMBTRACK 0x00000040 +#define SB_THUMBPOSITION 0x00000040 + /// open/save file #define OFN_PATHMUSTEXIST 0x00000100L #define OFN_HIDEREADONLY 0x00000200L #define OFN_OVERWRITEPROMPT 0x00000400L +/// PatBlt paint flags +#define PATINVERT 0x00000100L + /// window brushes #define BS_SOLID 0x00000001L #define BS_HOLLOW 0x00000002L @@ -87,7 +100,7 @@ typedef struct OpenFileInfoData { extern COLORREF HdcCurrentTextColor; /// functions -BOOL isFocus(HWID window); +BOOL GetFocus(HWID window); COLORREF RGB( int red, @@ -157,6 +170,15 @@ int FillRect( const RECT *lprc, HBRUSH hbr); +BOOL PatBlt( + HCRDC hdc, + int nXLeft, + int nYLeft, + int nWidth, + int nHeight, + DWORD dwRop, + HBRUSH hbr); + BOOL GetClientRect( HWID hWid, PRECT lpRect); |