summaryrefslogtreecommitdiff
path: root/ldmicro/lib/linuxUI
diff options
context:
space:
mode:
authorNatsuDrag92018-06-27 09:54:37 +0530
committerNatsuDrag92018-06-27 09:54:37 +0530
commitbb4567164fdbeaaa47dd5525f9081e81e769725e (patch)
treeea1a20104ed2930aeb7e044988bdee35a3a109eb /ldmicro/lib/linuxUI
parent8444936675f7de12f2cd24931cec08405427b2ed (diff)
parentf3a85302eb2c25f90189b4b087ac7730c1088c08 (diff)
downloadLDMicroGtk-bb4567164fdbeaaa47dd5525f9081e81e769725e.tar.gz
LDMicroGtk-bb4567164fdbeaaa47dd5525f9081e81e769725e.tar.bz2
LDMicroGtk-bb4567164fdbeaaa47dd5525f9081e81e769725e.zip
Merged changes and updated DestroyWindow function in all files.
Diffstat (limited to 'ldmicro/lib/linuxUI')
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.h2
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp33
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.h11
3 files changed, 35 insertions, 11 deletions
diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h
index 28116b2..ce0b812 100644
--- a/ldmicro/lib/linuxUI/linuxLD.h
+++ b/ldmicro/lib/linuxUI/linuxLD.h
@@ -182,7 +182,7 @@ typedef struct FontTag {
int nOrientation;
int fnWeight;
DWORD fdwItalic;
- LPCTSTR lpszFace;
+ LPTSTR lpszFace;
} *HFONT, FONT;
typedef struct tagLOGBRUSH {
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 5b87a60..d7248b7 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -282,6 +282,9 @@ HANDLE GetStockObject(int fnObject)
void SelectObject(HCRDC 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);
@@ -313,19 +316,23 @@ HBRUSH CreateBrushIndirect(PLOGBRUSH plb)
HFONT CreateFont(int nHeight, int nWidth, int nOrientation, int fnWeight,
DWORD fdwItalic, LPCTSTR lpszFace)
{
- HFONT font = new FONT;
+ HFONT font = (HFONT)malloc(strlen(lpszFace) + 1 + sizeof(FONT));
font->nHeight = nHeight;
font->nWidth = nWidth;
font->nOrientation = nOrientation;
font->fnWeight = fnWeight;
font->fdwItalic = fdwItalic;
- font->lpszFace = lpszFace;
-
+ font->lpszFace = (char*)malloc(strlen(lpszFace)+1);
+ strcpy(font->lpszFace, lpszFace);
+
return font;
}
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);
@@ -349,12 +356,18 @@ void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol)
void SetTextColor(HCRDC hcr, COLORREF color)
{
+ if (hcr == NULL)
+ return;
+
HdcCurrentTextColor = color;
gdk_cairo_set_source_rgba (hcr, &color);
}
void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, int cchString)
{
+ if (hcr == NULL)
+ return;
+
nYStart += 30;
cairo_text_extents_t extents;
@@ -419,6 +432,9 @@ BOOL InvalidateRect(HWID hWid, const RECT *lpRect, BOOL bErase)
int FillRect(HCRDC hDC, const RECT *lprc, HBRUSH hbr)
{
+ if (hDC == NULL)
+ return -1;
+
GDRECT gdrc;
RECT_to_GDRECT(lprc, &gdrc);
@@ -432,6 +448,9 @@ int FillRect(HCRDC hDC, const RECT *lprc, HBRUSH hbr)
BOOL PatBlt(HCRDC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, DWORD dwRop, HBRUSH hbr)
{
+ if (hdc == NULL)
+ return FALSE;
+
cairo_set_source_rgb(hdc, hbr->red, hbr->green, hbr->blue);
cairo_rectangle(hdc, nXLeft, nYLeft + 20, nWidth, nHeight);
cairo_stroke_preserve(hdc);
@@ -479,9 +498,6 @@ BOOL GetWindowRect(HWID hWid, PRECT pRect)
return TRUE;
}
-void DestroyWindow (GtkWidget* widget, gpointer data){
- gtk_widget_destroy (widget);
-}
UINT SetTimer(HWID hWid, UINT nIDEvent, UINT uElapse, BOOL (*lpTimerFunc)(BOOL) )
{
@@ -512,3 +528,8 @@ BOOL KillTimer(HWID hWid, UINT uIDEvent)
return TRUE;
}
+
+void DestroyWindow (HWID widget)
+{
+ gtk_widget_destroy (widget);
+}
diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h
index 41b281f..b1a3d48 100644
--- a/ldmicro/lib/linuxUI/linuxUI.h
+++ b/ldmicro/lib/linuxUI/linuxUI.h
@@ -43,6 +43,11 @@
#define SB_THUMBTRACK 0x00000040
#define SB_THUMBPOSITION 0x00000080
+/// UART terminal flags
+#define WM_GETTEXT 0x00000001
+#define WM_SETTEXT 0x00000002
+#define WM_SETTEXT_END 0x00000004
+
/// List view flags
#define LVN_ITEMACTIVATE 0x00000001
#define LVN_GETDISPINFO 0x00000002
@@ -205,10 +210,6 @@ BOOL MoveWindow(
int nHeight,
BOOL bRepaint);
-void DestroyWindow (
- HWID widget,
- gpointer data);
-
BOOL GetWindowRect(
HWID hWid,
PRECT pRect);
@@ -223,4 +224,6 @@ BOOL KillTimer(
HWID hWid,
UINT uIDEvent);
+void DestroyWindow (HWID widget);
+
#endif \ No newline at end of file