summaryrefslogtreecommitdiff
path: root/ldmicro/lib
diff options
context:
space:
mode:
Diffstat (limited to 'ldmicro/lib')
-rw-r--r--ldmicro/lib/freezeLD/freezeLD.cpp42
-rw-r--r--ldmicro/lib/freezeLD/freezeLD.h2
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.cpp110
-rw-r--r--ldmicro/lib/linuxUI/linuxLD.h23
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.cpp161
-rw-r--r--ldmicro/lib/linuxUI/linuxUI.h125
6 files changed, 328 insertions, 135 deletions
diff --git a/ldmicro/lib/freezeLD/freezeLD.cpp b/ldmicro/lib/freezeLD/freezeLD.cpp
index ea3fae2..880dfab 100644
--- a/ldmicro/lib/freezeLD/freezeLD.cpp
+++ b/ldmicro/lib/freezeLD/freezeLD.cpp
@@ -24,15 +24,16 @@ void FreezeWindowPosF(HWID hwid, char *subKey, char *name)
if (!Ld_CWD)
return;
- char* moveToKeyLocatin = (char *)malloc(strlen(name) + 30);
+ char* moveToKeyLocatin = (char *)malloc(strlen(name) + MAX_PATH);
if(!moveToKeyLocatin)
{
free(Ld_CWD);
return;
}
- sprintf(moveToKeyLocatin, "mkdir -p %s/%s", FREEZE_REGISTER, subKey);
+
+ sprintf(moveToKeyLocatin, "mkdir -p %s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
system(moveToKeyLocatin);
- sprintf(moveToKeyLocatin, "%s/%s", FREEZE_REGISTER, subKey);
+ sprintf(moveToKeyLocatin, "%s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
if (-1 == chdir(moveToKeyLocatin))
{
free(Ld_CWD);
@@ -148,13 +149,14 @@ void ThawWindowPosF(HWID hwid, char *subKey, char *name)
if (!Ld_CWD)
return;
- char* moveToKeyLocatin = (char *)malloc(strlen(name) + 30);
+ char* moveToKeyLocatin = (char *)malloc(strlen(name) + MAX_PATH);
if(!moveToKeyLocatin)
{
free(Ld_CWD);
return;
}
- sprintf(moveToKeyLocatin, "%s/%s", FREEZE_REGISTER, subKey);
+
+ sprintf(moveToKeyLocatin, "%s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
if (-1 == chdir(moveToKeyLocatin))
{
free(Ld_CWD);
@@ -162,8 +164,8 @@ void ThawWindowPosF(HWID hwid, char *subKey, char *name)
return;
}
free(moveToKeyLocatin);
-
- char *keyName = (char *)malloc(strlen(name) + 30);
+
+ char *keyName = (char *)malloc(strlen(name) + MAX_PATH);
if(!keyName)
{
free(Ld_CWD);
@@ -257,15 +259,16 @@ void FreezeDWORDF(DWORD val, char *subKey, char *name)
if (!Ld_CWD)
return;
- char* moveToKeyLocatin = (char *)malloc(strlen(name) + 30);
+ char* moveToKeyLocatin = (char *)malloc(strlen(name) + MAX_PATH);
if(!moveToKeyLocatin)
{
free(Ld_CWD);
return;
}
- sprintf(moveToKeyLocatin, "mkdir -p %s/%s", FREEZE_REGISTER, subKey);
+
+ sprintf(moveToKeyLocatin, "mkdir -p %s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
system(moveToKeyLocatin);
- sprintf(moveToKeyLocatin, "%s/%s", FREEZE_REGISTER, subKey);
+ sprintf(moveToKeyLocatin, "%s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
if (-1 == chdir(moveToKeyLocatin))
{
free(Ld_CWD);
@@ -296,13 +299,14 @@ DWORD ThawDWORDF(DWORD val, char *subKey, char *name)
if (!Ld_CWD)
return val;
- char* moveToKeyLocatin = (char *)malloc(strlen(name) + 30);
+ char* moveToKeyLocatin = (char *)malloc(strlen(name) + MAX_PATH);
if(!moveToKeyLocatin)
{
free(Ld_CWD);
return val;
}
- sprintf(moveToKeyLocatin, "%s/%s", FREEZE_REGISTER, subKey);
+
+ sprintf(moveToKeyLocatin, "%s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
if (-1 == chdir(moveToKeyLocatin))
{
free(Ld_CWD);
@@ -340,15 +344,16 @@ void FreezeStringF(char *val, char *subKey, char *name)
if (!Ld_CWD)
return;
- char* moveToKeyLocatin = (char *)malloc(strlen(name) + 30);
+ char* moveToKeyLocatin = (char *)malloc(strlen(name) + MAX_PATH);
if(!moveToKeyLocatin)
{
free(Ld_CWD);
return;
}
- sprintf(moveToKeyLocatin, "mkdir -p %s/%s", FREEZE_REGISTER, subKey);
+
+ sprintf(moveToKeyLocatin, "mkdir -p %s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
system(moveToKeyLocatin);
- sprintf(moveToKeyLocatin, "%s/%s", FREEZE_REGISTER, subKey);
+ sprintf(moveToKeyLocatin, "%s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
if (-1 == chdir(moveToKeyLocatin))
{
free(Ld_CWD);
@@ -356,7 +361,7 @@ void FreezeStringF(char *val, char *subKey, char *name)
return;
}
free(moveToKeyLocatin);
-
+
std::ofstream Register(name, std::ios::trunc);
Register << strlen(val)+1 << "\n";
Register << val;
@@ -377,13 +382,14 @@ void ThawStringF(char *val, int max, char *subKey, char *name)
if (!Ld_CWD)
return;
- char* moveToKeyLocatin = (char *)malloc(strlen(name) + 30);
+ char* moveToKeyLocatin = (char *)malloc(strlen(name) + MAX_PATH);
if(!moveToKeyLocatin)
{
free(Ld_CWD);
return;
}
- sprintf(moveToKeyLocatin, "%s/%s", FREEZE_REGISTER, subKey);
+
+ sprintf(moveToKeyLocatin, "%s/%s/%s", getenv("HOME"), FREEZE_REGISTER, subKey);
if (-1 == chdir(moveToKeyLocatin))
{
free(Ld_CWD);
diff --git a/ldmicro/lib/freezeLD/freezeLD.h b/ldmicro/lib/freezeLD/freezeLD.h
index 5c00504..581466d 100644
--- a/ldmicro/lib/freezeLD/freezeLD.h
+++ b/ldmicro/lib/freezeLD/freezeLD.h
@@ -10,7 +10,7 @@
#ifndef __FREEZE_H
#define __FREEZE_H
-#define FREEZE_REGISTER "/usr/share/ldmicro"
+#define FREEZE_REGISTER ".ldmicro"
#define FREEZE_SUBKEY "LDMicro"
diff --git a/ldmicro/lib/linuxUI/linuxLD.cpp b/ldmicro/lib/linuxUI/linuxLD.cpp
index 8778154..a83d15e 100644
--- a/ldmicro/lib/linuxUI/linuxLD.cpp
+++ b/ldmicro/lib/linuxUI/linuxLD.cpp
@@ -10,7 +10,7 @@ HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
HANDLE hHeap = NULL;
HEAPRECORD hHeapRecord;
hHeapRecord.dwMaximumSize = dwMaximumSize;
- hHeap = malloc(dwInitialSize);
+ // hHeap = malloc(dwInitialSize);
if (hHeap == NULL)
return NULL;
@@ -26,81 +26,79 @@ HANDLE HeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize)
LPVOID HeapAlloc(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
{
- cout << "Inside HeapAlloc" << "\n";
- if (hHeap == NULL)
- {
+ // if (hHeap == NULL)
+ // {
// printf("Alloc**********NULL HEAP***************\n");
LPVOID p = malloc(dwBytes);
return p;
- }
+ // }
- auto it = std::find_if(HeapRecords.begin(), HeapRecords.end(), [&hHeap](HEAPRECORD &Record) { return Record.hHeap == hHeap; });
+ // auto it = std::find_if(HeapRecords.begin(), HeapRecords.end(), [&hHeap](HEAPRECORD &Record) { return Record.hHeap == hHeap; });
- if (it == HeapRecords.end())
- return NULL;
-
- if ((*it).dwAllocatedSizeOffset + dwBytes > (*it).dwSize)
- {
- if ((*it).dwMaximumSize != 0)
- if((*it).dwAllocatedSizeOffset + dwBytes > (*it).dwMaximumSize)
- return NULL;
+ // if (it == HeapRecords.end())
+ // return NULL;
+
+ // if ((*it).dwAllocatedSizeOffset + dwBytes > (*it).dwSize)
+ // {
+ // if ((*it).dwMaximumSize != 0)
+ // if((*it).dwAllocatedSizeOffset + dwBytes > (*it).dwMaximumSize)
+ // return NULL;
- (*it).hHeap = realloc((*it).hHeap, (*it).dwAllocatedSizeOffset + dwBytes);
- hHeap = (*it).hHeap;
- }
+ // (*it).hHeap = realloc((*it).hHeap, (*it).dwAllocatedSizeOffset + dwBytes);
+ // hHeap = (*it).hHeap;
+ // }
- /// HEAP_ZERO_MEMORY is set by default
- DWORD flags = MAP_ANONYMOUS;
+ // /// HEAP_ZERO_MEMORY is set by default
+ // DWORD flags = MAP_ANONYMOUS;
- // if ( !((dwFlags & HEAP_ZERO_MEMORY) == HEAP_ZERO_MEMORY) )
- // flags = MAP_ANONYMOUS | MAP_UNINITIALIZED;
+ // // if ( !((dwFlags & HEAP_ZERO_MEMORY) == HEAP_ZERO_MEMORY) )
+ // // flags = MAP_ANONYMOUS | MAP_UNINITIALIZED;
- /* Use for setting a meamory chunck with some value
- * void * memset ( void * ptr, int value, size_t num );
- */
- LPVOID p = mmap(hHeap + (*it).dwAllocatedSizeOffset, dwBytes, PROT_EXEC, flags, -1, 0);
+ // /* Use for setting a meamory chunck with some value
+ // * void * memset ( void * ptr, int value, size_t num );
+ // */
+ // LPVOID p = mmap(hHeap + (*it).dwAllocatedSizeOffset, dwBytes, PROT_EXEC, flags, -1, 0);
- if (p == NULL)
- return NULL;
+ // if (p == NULL)
+ // return NULL;
+
+ // (*it).dwAllocatedSizeOffset += dwBytes;
+ // HEAPCHUNCK chunck;
+ // chunck.Chunck = p;
+ // chunck.dwSize = dwBytes;
+ // (*it).Element.push_back(chunck);
- (*it).dwAllocatedSizeOffset += dwBytes;
- HEAPCHUNCK chunck;
- chunck.Chunck = p;
- chunck.dwSize = dwBytes;
- (*it).Element.push_back(chunck);
- cout << "Exiting HeapAlloc" << "\n";
-
- return p;
+ // return p;
}
BOOL HeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem)
{
/// if NULL free()
- if (hHeap == NULL)
- {
+ // if (hHeap == NULL)
+ // {
// printf("free*********NULL HEAP***************\n");
free(lpMem);
return TRUE;
- }
- auto heap_it = std::find_if(HeapRecords.begin(), HeapRecords.end(), [&hHeap](HEAPRECORD &Record) { return Record.hHeap == hHeap; });
+ // }
+ // auto heap_it = std::find_if(HeapRecords.begin(), HeapRecords.end(), [&hHeap](HEAPRECORD &Record) { return Record.hHeap == hHeap; });
- if (heap_it == HeapRecords.end())
- return FALSE;
+ // if (heap_it == HeapRecords.end())
+ // return FALSE;
- auto chunck_it = std::find_if((*heap_it).Element.begin(), (*heap_it).Element.end(), [&lpMem](HEAPCHUNCK &Chunck) { return Chunck.Chunck == lpMem; });
+ // auto chunck_it = std::find_if((*heap_it).Element.begin(), (*heap_it).Element.end(), [&lpMem](HEAPCHUNCK &Chunck) { return Chunck.Chunck == lpMem; });
- if (chunck_it == (*heap_it).Element.end())
- return FALSE;
+ // if (chunck_it == (*heap_it).Element.end())
+ // return FALSE;
- int result = munmap((*chunck_it).Chunck, (*chunck_it).dwSize);
+ // int result = munmap((*chunck_it).Chunck, (*chunck_it).dwSize);
- if (result == 0)
- {
- (*heap_it).Element.erase(chunck_it);
- return TRUE;
- }
- else
- return FALSE;
+ // if (result == 0)
+ // {
+ // (*heap_it).Element.erase(chunck_it);
+ // return TRUE;
+ // }
+ // else
+ // return FALSE;
}
@@ -119,6 +117,14 @@ HICON LoadImage(HINSTANCE hinst, LPCTSTR lpszName, UINT uType, int cxDesired,
return pixbuf;
}
+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;
+}
+
void OutputDebugString(char* str)
{
diff --git a/ldmicro/lib/linuxUI/linuxLD.h b/ldmicro/lib/linuxUI/linuxLD.h
index 5f8e0e7..8a3e3a2 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 GDRECT;
+typedef GdkRectangle *PGDRECT;
+
/// Check if system is x64 or x86
#if defined(__UNIX64)
typedef uint64_t UINT_PTR;
@@ -110,14 +114,6 @@ typedef class tagColorReferance: public GdkRGBA{
this->alpha = 1.0;
}
- // tagColorReferance(tagColorReferance &refCpy)
- // {
- // this->red = refCpy.red;
- // this->green = refCpy.green;
- // this->blue = refCpy.blue;
- // this->alpha = refCpy.alpha;
- // }
-
GdkRGBA* getThis()
{
return this;
@@ -170,6 +166,13 @@ typedef struct tagLOGBRUSH {
// ULONG_PTR lbHatch;
} LOGBRUSH, *PLOGBRUSH;
+typedef struct _RECT {
+ LONG left;
+ LONG top;
+ LONG right;
+ LONG bottom;
+} RECT, *PRECT;
+
/// Variables
extern std::vector<HEAPRECORD> HeapRecord;
@@ -198,6 +201,10 @@ HICON LoadImage(
UINT fuLoad
);
+void RECT_to_GDRECT(
+ const RECT *rc,
+ GDRECT *gdrc);
+
/// functions to be ported
void OutputDebugString(char*);
double GetTickCount(void);
diff --git a/ldmicro/lib/linuxUI/linuxUI.cpp b/ldmicro/lib/linuxUI/linuxUI.cpp
index 70866f9..5125ed9 100644
--- a/ldmicro/lib/linuxUI/linuxUI.cpp
+++ b/ldmicro/lib/linuxUI/linuxUI.cpp
@@ -1,5 +1,15 @@
#include "linuxUI.h"
+/// Brushes
+const COLORREF BLACK_BR(0, 0, 0);
+const COLORREF WHITE_BR(255, 255, 255);
+const COLORREF GRAY_BR(128, 128, 128);
+const COLORREF LTGRAY_BR(211, 211, 211);
+const COLORREF DKGRAY_BR(169, 169, 169);
+
+/// Variable to current text color
+COLORREF HdcCurrentTextColor;
+
/// EnableMenuItem Variables
const UINT MF_ENABLED = 0;
const UINT MF_GRAYED = 1;
@@ -182,16 +192,22 @@ HANDLE GetStockObject(int fnObject)
switch(fnObject)
{
case BLACK_BRUSH:
- return new COLORREF(0, 0, 0);
+ return (HANDLE)&BLACK_BR;
break;
case WHITE_BRUSH:
- return new COLORREF(255, 255, 255);
+ return (HANDLE)&WHITE_BR;
+ break;
+ case GRAY_BRUSH:
+ return (HANDLE)&GRAY_BR;
break;
- case GREY_BRUSH:
- return new COLORREF(128, 128, 128);
+ case LTGRAY_BRUSH:
+ return (HANDLE)&LTGRAY_BR;
+ break;
+ case DKGRAY_BRUSH:
+ return (HANDLE)&DKGRAY_BR;
break;
default:
- return new COLORREF(255, 255, 255);
+ return (HANDLE)&WHITE_BR;
}
}
@@ -202,27 +218,29 @@ void SelectObject(HCRDC hcr, HFONT hfont)
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, "H", &extents);
-
+ // cairo_text_extents (hcr, "Z", &extents);
// cairo_matrix_t matrix;
// cairo_matrix_init_scale (&matrix,
- // (double)hfont->nWidth / extents.width,
- // (double)hfont->nHeight / extents.width);
+ // (double)hfont->nWidth,
+ // (double)hfont->nHeight);
// 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);
+ // g_print("tW = %f tH = %f\n", extents.width, extents.width);
+ cairo_set_font_size(hcr, 10);
}
HBRUSH CreateBrushIndirect(PLOGBRUSH plb)
{
- COLORREF brush(plb->lbColor);
- brush.alpha = (plb->lbStyle == BS_SOLID) ? 1 : 0.2;
+ COLORREF* brush = new COLORREF;
+ brush->red = plb->lbColor.red;
+ brush->green = plb->lbColor.green;
+ brush->blue = plb->lbColor.blue;
+ brush->alpha = (plb->lbStyle == BS_SOLID) ? 1 : 0.2;
- return &brush;
+ return brush;
}
HFONT CreateFont(int nHeight, int nWidth, int nOrientation, int fnWeight,
@@ -262,14 +280,121 @@ void SetBkColor(HWID widget, HCRDC hcr, COLORREF bkCol)
void SetTextColor(HCRDC hcr, COLORREF color)
{
+ HdcCurrentTextColor = color;
gdk_cairo_set_source_rgba (hcr, &color);
}
-void TextOut(HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, int cchString)
+void TextOut(HWID hWid, HCRDC hcr, int nXStart, int nYStart, LPCTSTR lpString, int cchString)
{
+ nYStart += 20;
+
+ cairo_text_extents_t extents;
+ cairo_text_extents (hcr, lpString, &extents);
+ int width = gtk_widget_get_allocated_width (hWid);
+ int height= gtk_widget_get_allocated_height (hWid);
+ BOOL resize_flag = FALSE;
+ // g_print("w = %f h = %f")
+
+ if(nYStart+(extents.height/2.0) >= height)
+ {
+ height += extents.height;
+ resize_flag = TRUE;
+ }
+
+ if (nXStart+(extents.width/2.0) >= width)
+ {
+ width += extents.width;
+ resize_flag = TRUE;
+ }
+
+ if (resize_flag)
+ gtk_widget_set_size_request(hWid, width, height);
+ char* text = (char*)malloc(cchString);
+ strncpy(text, lpString, cchString);
+ text[cchString] = '\0';
+
cairo_move_to(hcr, nXStart, nYStart);
- cairo_show_text(hcr, lpString);
+ cairo_show_text(hcr, text);
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)
+{
+ if(!GDK_IS_WINDOW(hWid))
+ return FALSE;
+
+ if (lpRect == NULL)
+ {
+ gdk_window_invalidate_rect (gtk_widget_get_window (hWid), NULL, FALSE);
+ return TRUE;
+ }
+
+ GDRECT Gdrect;
+ RECT_to_GDRECT(lpRect, &Gdrect);
+ // gtk_widget_queue_draw(hWid);
+ gdk_window_invalidate_rect (gtk_widget_get_window (hWid), &Gdrect, FALSE);
+
+ return TRUE;
+}
+
+int FillRect(HCRDC hDC, const RECT *lprc, HBRUSH hbr)
+{
+ GDRECT gdrc;
+ RECT_to_GDRECT(lprc, &gdrc);
+
+ cairo_set_source_rgb(hDC, hbr->red, hbr->green, hbr->blue);
+ cairo_rectangle(hDC, gdrc.x, gdrc.y, gdrc.width, gdrc.height);
+ cairo_stroke_preserve(hDC);
+ cairo_fill(hDC);
+
+ return 0;
+}
+
+BOOL GetClientRect(HWID hWid, PRECT pRect)
+{
+ GtkAllocation allocation;
+ gtk_widget_get_allocation (hWid, &allocation);
+
+ pRect->top = allocation.x;
+ pRect->left = allocation.y;
+ pRect->right = allocation.width;
+ pRect->bottom = allocation.height;
+
+ return TRUE;
+}
+
+BOOL MoveWindow(HWID hWid, int X, int Y, int nWidth, int nHeight, BOOL bRepaint)
+{
+ gtk_window_move(GTK_WINDOW(hWid), X, Y);
+ gtk_window_resize(GTK_WINDOW(hWid), nWidth, nHeight);
+
+ if (bRepaint)
+ gdk_window_invalidate_rect (gtk_widget_get_window (hWid), NULL, FALSE);
+
+ return TRUE;
+}
+
+
+BOOL GetWindowRect(HWID hWid, PRECT pRect)
+{
+ GtkAllocation allocation;
+ gtk_widget_get_allocation (hWid, &allocation);
+
+ pRect->top = allocation.x;
+ pRect->left = allocation.y;
+ pRect->right = allocation.width;
+ pRect->bottom = allocation.height;
+
+ return TRUE;
+} \ No newline at end of file
diff --git a/ldmicro/lib/linuxUI/linuxUI.h b/ldmicro/lib/linuxUI/linuxUI.h
index 552a6af..e921777 100644
--- a/ldmicro/lib/linuxUI/linuxUI.h
+++ b/ldmicro/lib/linuxUI/linuxUI.h
@@ -18,36 +18,44 @@
/// Flags
/// message box
-#define MB_OK 0x00000001L
-#define MB_OKCANCEL 0x00000002L
-#define MB_YESNO 0x00000004L
-#define MB_YESNOCANCEL 0x00000008L
+#define MB_OK 0x00000001L
+#define MB_OKCANCEL 0x00000002L
+#define MB_YESNO 0x00000004L
+#define MB_YESNOCANCEL 0x00000008L
-#define IDOK 1
-#define IDCANCEL 2
-#define IDYES 3
-#define IDNO 4
+#define IDOK 1
+#define IDCANCEL 2
+#define IDYES 3
+#define IDNO 4
-#define MB_ICONERROR 0x00000010L
-#define MB_ICONQUESTION 0x00000020L
-#define MB_ICONWARNING 0x00000040L
-#define MB_ICONINFORMATION 0x00000080L
+#define MB_ICONERROR 0x00000010L
+#define MB_ICONQUESTION 0x00000020L
+#define MB_ICONWARNING 0x00000040L
+#define MB_ICONINFORMATION 0x00000080L
/// open/save file
-#define OFN_PATHMUSTEXIST 0x00000100L
-#define OFN_HIDEREADONLY 0x00000200L
-#define OFN_OVERWRITEPROMPT 0x00000400L
+#define OFN_PATHMUSTEXIST 0x00000100L
+#define OFN_HIDEREADONLY 0x00000200L
+#define OFN_OVERWRITEPROMPT 0x00000400L
/// window brushes
-#define BS_SOLID 0x00000001L
-#define BS_HOLLOW 0x00000002L
-#define BLACK_BRUSH 0x00000004L
-#define WHITE_BRUSH 0x00000008L
-#define GREY_BRUSH 0x00000010L
+#define BS_SOLID 0x00000001L
+#define BS_HOLLOW 0x00000002L
+#define BLACK_BRUSH 0x00000004L
+#define WHITE_BRUSH 0x00000008L
+#define GRAY_BRUSH 0x00000010L
+#define LTGRAY_BRUSH 0x00000020L
+#define DKGRAY_BRUSH 0x00000040L
+
+extern const COLORREF BLACK_BR;
+extern const COLORREF WHITE_BR;
+extern const COLORREF GRAY_BR;
+extern const COLORREF LTGRAY_BR;
+extern const COLORREF DKGRAY_BR;
/// Font flags
-#define FW_REGULAR 0x00000001L
-#define FW_BOLD 0x00000002L
+#define FW_REGULAR 0x00000001L
+#define FW_BOLD 0x00000002L
/// EnableMenuItem variables
extern const UINT MF_ENABLED;
@@ -59,7 +67,7 @@ extern const UINT MF_UNCHECKED;
extern GtkWidget *view;
extern GtkTreeViewColumn *column;
-/// data types
+/// Structures
typedef struct OpenFileInfoData {
DWORD lStructSize;
HWID parentWindow;
@@ -71,53 +79,94 @@ typedef struct OpenFileInfoData {
LPCTSTR lpstrDefExt;
} OPENFILENAME;
+/// Variables
+extern COLORREF HdcCurrentTextColor;
+
/// functions
BOOL isFocus(HWID window);
-COLORREF RGB(int red,
- int green,
- int blue);
+COLORREF RGB(
+ int red,
+ int green,
+ int blue);
-int MessageBox(HWID pWindow,
+int MessageBox(
+ HWID pWindow,
char* message,
char* title,
UINT mFlags);
BOOL GetSaveFileName(OPENFILENAME *ofn);
-void EnableMenuItem(HMENU MenuName,
+void EnableMenuItem(
+ HMENU MenuName,
HMENU MenuItem,
UINT CheckEnabledItem);
-void CheckMenuItem(HMENU MenuName,
+void CheckMenuItem(
+ HMENU MenuName,
HMENU MenuItem,
UINT Check);
HANDLE GetStockObject(int fnObject);
-void SelectObject(HCRDC hcr,
+void SelectObject(
+ HCRDC hcr,
HFONT hfont);
HBRUSH CreateBrushIndirect(PLOGBRUSH plb);
-HFONT CreateFont(int nHeight,
+HFONT CreateFont(
+ int nHeight,
int nWidth,
int nOrientation,
int fnWeight,
DWORD fdwItalic,
LPCTSTR lpszFace);
-void SetBkColor(HWID widget,
+void SetBkColor(
+ HWID widget,
HCRDC hcr,
COLORREF bkCol);
-void SetTextColor(HCRDC hcr,
+void SetTextColor(
+ HCRDC hcr,
COLORREF color);
-void TextOut(HCRDC hcr,
- int nXStart,
- int nYStart,
- LPCTSTR lpString,
- int cchString);
+void TextOut(
+ HWID hWid,
+ HCRDC hcr,
+ int nXStart,
+ int nYStart,
+ LPCTSTR lpString,
+ int cchString);
+
+COLORREF GetTextColor(HCRDC Hdc);
+
+BOOL InvalidateRect(
+ HWID hWId,
+ const RECT *lpRect,
+ BOOL bErase);
+
+int FillRect(
+ HCRDC hDC,
+ const RECT *lprc,
+ HBRUSH hbr);
+
+BOOL GetClientRect(
+ HWID hWid,
+ PRECT lpRect);
+
+BOOL MoveWindow(
+ HWID hWid,
+ int X,
+ int Y,
+ int nWidth,
+ int nHeight,
+ BOOL bRepaint);
+
+BOOL GetWindowRect(
+ HWID hWid,
+ PRECT pRect);
#endif \ No newline at end of file