mirror of
https://gitea.nishi.boats/pyrite-dev/milsko
synced 2026-01-19 15:44:07 +00:00
move some to lowlevel
git-svn-id: http://svn2.nishi.boats/svn/milsko/trunk@675 b9cfdab3-6d41-4d17-bbe4-086880011989
This commit is contained in:
@@ -691,3 +691,10 @@ char* MwLLGetClipboard(MwLL handle) {
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
void MwLLMakeToolWindow(MwLL handle) {
|
||||
LPARAM lp = GetWindowLongPtr(handle->hWnd, GWL_STYLE) & WS_VISIBLE;
|
||||
|
||||
SetWindowLongPtr(handle->hWnd, GWL_STYLE, (LPARAM)lp);
|
||||
SetWindowLongPtr(handle->hWnd, GWL_EXSTYLE, (LPARAM)WS_EX_TOOLWINDOW);
|
||||
}
|
||||
|
||||
@@ -946,3 +946,14 @@ char* MwLLGetClipboard(MwLL handle) {
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
void MwLLMakeToolWindow(MwLL handle) {
|
||||
XSetWindowAttributes xswa;
|
||||
Atom wndtype = XInternAtom(handle->display, "_NET_WM_WINDOW_TYPE", False);
|
||||
Atom wndmenu = XInternAtom(handle->display, "_NET_WM_WINDOW_TYPE_MENU", False);
|
||||
|
||||
xswa.override_redirect = True;
|
||||
|
||||
XChangeWindowAttributes(handle->display, handle->window, CWOverrideRedirect, &xswa);
|
||||
XChangeProperty(handle->display, handle->window, wndtype, XA_ATOM, 32, PropModeReplace, (unsigned char*)&wndmenu, 1);
|
||||
}
|
||||
|
||||
@@ -27,44 +27,40 @@
|
||||
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
MwCursor MwCursorArrow = {
|
||||
16, 16, -15, -15,
|
||||
{
|
||||
0, /* ................ */
|
||||
6, /* .............##. */
|
||||
30, /* ...........####. */
|
||||
124, /* .........#####.. */
|
||||
508, /* .......#######.. */
|
||||
2040, /* .....########... */
|
||||
8184, /* ...##########... */
|
||||
496, /* .......#####.... */
|
||||
1008, /* ......######.... */
|
||||
1888, /* .....###.##..... */
|
||||
3680, /* ....###..##..... */
|
||||
7232, /* ...###...#...... */
|
||||
14400, /* ..###....#...... */
|
||||
28672, /* .###............ */
|
||||
8192, /* ..#............. */
|
||||
0 /* ................ */
|
||||
}
|
||||
};
|
||||
16, 16, -15, -15, {
|
||||
0, /* ................ */
|
||||
6, /* .............##. */
|
||||
30, /* ...........####. */
|
||||
124, /* .........#####.. */
|
||||
508, /* .......#######.. */
|
||||
2040, /* .....########... */
|
||||
8184, /* ...##########... */
|
||||
496, /* .......#####.... */
|
||||
1008, /* ......######.... */
|
||||
1888, /* .....###.##..... */
|
||||
3680, /* ....###..##..... */
|
||||
7232, /* ...###...#...... */
|
||||
14400, /* ..###....#...... */
|
||||
28672, /* .###............ */
|
||||
8192, /* ..#............. */
|
||||
0 /* ................ */
|
||||
}};
|
||||
MwCursor MwCursorArrowMask = {
|
||||
16, 16, -15, -15,
|
||||
{
|
||||
7, /* .............### */
|
||||
31, /* ...........##### */
|
||||
127, /* .........####### */
|
||||
510, /* .......########. */
|
||||
2046, /* .....##########. */
|
||||
8188, /* ...###########.. */
|
||||
16380, /* ..############.. */
|
||||
8184, /* ...##########... */
|
||||
2040, /* .....########... */
|
||||
4080, /* ....########.... */
|
||||
8176, /* ...#########.... */
|
||||
16096, /* ..#####.###..... */
|
||||
31968, /* .#####..###..... */
|
||||
63552, /* #####....#...... */
|
||||
28672, /* .###............ */
|
||||
8192 /* ..#............. */
|
||||
}
|
||||
};
|
||||
16, 16, -15, -15, {
|
||||
7, /* .............### */
|
||||
31, /* ...........##### */
|
||||
127, /* .........####### */
|
||||
510, /* .......########. */
|
||||
2046, /* .....##########. */
|
||||
8188, /* ...###########.. */
|
||||
16380, /* ..############.. */
|
||||
8184, /* ...##########... */
|
||||
2040, /* .....########... */
|
||||
4080, /* ....########.... */
|
||||
8176, /* ...#########.... */
|
||||
16096, /* ..#####.###..... */
|
||||
31968, /* .#####..###..... */
|
||||
63552, /* #####....#...... */
|
||||
28672, /* .###............ */
|
||||
8192 /* ..#............. */
|
||||
}};
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
static int create(MwWidget handle) {
|
||||
MwComboBox cb = malloc(sizeof(*cb));
|
||||
|
||||
cb->list = NULL;
|
||||
cb->list = NULL;
|
||||
cb->opened = 0;
|
||||
cb->selected = 0;
|
||||
cb->selected = 0;
|
||||
handle->internal = cb;
|
||||
|
||||
MwSetDefault(handle);
|
||||
@@ -18,9 +18,9 @@ static int create(MwWidget handle) {
|
||||
|
||||
static void destroy(MwWidget handle) {
|
||||
MwComboBox cb = handle->internal;
|
||||
int i;
|
||||
int i;
|
||||
|
||||
for(i = 0; i < arrlen(cb->list); i++){
|
||||
for(i = 0; i < arrlen(cb->list); i++) {
|
||||
free(cb->list[i]);
|
||||
}
|
||||
arrfree(cb->list);
|
||||
@@ -43,7 +43,7 @@ static void draw(MwWidget handle) {
|
||||
rc = r;
|
||||
|
||||
/* draw text */
|
||||
if(arrlen(cb->list) > cb->selected){
|
||||
if(arrlen(cb->list) > cb->selected) {
|
||||
MwPoint p;
|
||||
|
||||
p.x = MwDefaultBorderWidth(handle) * 2;
|
||||
@@ -80,13 +80,18 @@ static void click(MwWidget handle) {
|
||||
MwComboBox cb = handle->internal;
|
||||
|
||||
cb->opened = cb->opened ? 0 : 1;
|
||||
if(cb->opened) {
|
||||
MwLLSetCursor(handle->lowlevel, &MwCursorArrow, &MwCursorArrowMask);
|
||||
} else {
|
||||
MwLLSetCursor(handle->lowlevel, &MwCursorDefault, &MwCursorDefaultMask);
|
||||
}
|
||||
|
||||
MwForceRender(handle);
|
||||
}
|
||||
|
||||
static void mwComboBoxAddImpl(MwWidget handle, int index, const char* text){
|
||||
static void mwComboBoxAddImpl(MwWidget handle, int index, const char* text) {
|
||||
MwComboBox cb = handle->internal;
|
||||
char* t = MwStringDupliacte(text);
|
||||
char* t = MwStringDupliacte(text);
|
||||
|
||||
if(index == -1) index = arrlen(cb->list);
|
||||
|
||||
@@ -98,8 +103,8 @@ static void mwComboBoxAddImpl(MwWidget handle, int index, const char* text){
|
||||
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
|
||||
(void)out;
|
||||
if(strcmp(name, "mwComboBoxAdd") == 0) {
|
||||
int index = va_arg(va, int);
|
||||
const char* text = va_arg(va, const char*);
|
||||
int index = va_arg(va, int);
|
||||
const char* text = va_arg(va, const char*);
|
||||
mwComboBoxAddImpl(handle, index, text);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,25 +162,12 @@ static void click(MwWidget handle) {
|
||||
|
||||
static void mwSubMenuAppearImpl(MwWidget handle, MwMenu menu, MwPoint* point) {
|
||||
int i, w = 0, h = 0;
|
||||
#ifdef USE_X11
|
||||
XSetWindowAttributes xswa;
|
||||
Atom wndtype = XInternAtom(handle->lowlevel->display, "_NET_WM_WINDOW_TYPE", False);
|
||||
Atom wndmenu = XInternAtom(handle->lowlevel->display, "_NET_WM_WINDOW_TYPE_MENU", False);
|
||||
|
||||
xswa.override_redirect = True;
|
||||
|
||||
XChangeWindowAttributes(handle->lowlevel->display, handle->lowlevel->window, CWOverrideRedirect, &xswa);
|
||||
XChangeProperty(handle->lowlevel->display, handle->lowlevel->window, wndtype, XA_ATOM, 32, PropModeReplace, (unsigned char*)&wndmenu, 1);
|
||||
#endif
|
||||
|
||||
handle->internal = menu;
|
||||
|
||||
MwLLDetach(handle->lowlevel, point);
|
||||
|
||||
#ifdef USE_GDI
|
||||
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_STYLE, (LPARAM)0);
|
||||
SetWindowLongPtr(handle->lowlevel->hWnd, GWL_EXSTYLE, (LPARAM)WS_EX_TOOLWINDOW);
|
||||
#endif
|
||||
MwLLMakeToolWindow(handle->lowlevel);
|
||||
|
||||
MwLLShow(handle->lowlevel, 1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user