add MwTreeViewGetOpened
All checks were successful
pyrite-dev/milsko/pipeline/head This commit looks good

This commit is contained in:
Nishi 2026-05-12 09:49:06 +09:00
commit 56544212b1
4 changed files with 32 additions and 9 deletions

View file

@ -90,6 +90,19 @@ MwInline void MwTreeViewSetOpened(MwWidget handle, void* item, int opened) {
MwVaWidgetExecute(handle, "mwTreeViewSetOpened", NULL, item, opened);
}
/*!
* @brief Gets the opened state of ithe item
* @param handle Widget
* @param item Item
* @return Opened or not
*/
MwInline int MwTreeViewGetOpened(MwWidget handle, void* item) {
int out;
MwVaWidgetExecute(handle, "mwTreeViewGetOpened", (void*)&out, item);
return out;
}
#ifdef __cplusplus
}
#endif

View file

@ -96,7 +96,7 @@ static void draw(MwWidget handle) {
MwDrawFrame(handle, &r3, c, 1);
MwLLClip(handle->lowlevel, NULL);
}else if(n == 1 && i == 0){
} else if(n == 1 && i == 0) {
MwRect r3 = r2;
r3.y = tab_height(handle);

View file

@ -435,6 +435,12 @@ static void mwTreeViewSetOpenedImpl(MwWidget handle, void* item, int opened) {
}
}
static int mwTreeViewGetOpenedImpl(MwWidget handle, void* item) {
MwTreeViewEntry* e = item;
return e->opened;
}
static void func_handler(MwWidget handle, const char* name, void* out, va_list va) {
if(strcmp(name, "mwTreeViewAdd") == 0) {
void* parent = va_arg(va, void*);
@ -468,6 +474,10 @@ static void func_handler(MwWidget handle, const char* name, void* out, va_list v
int opened = va_arg(va, int);
mwTreeViewSetOpenedImpl(handle, item, opened);
}
if(strcmp(name, "mwTreeViewGetOpened") == 0) {
void* item = va_arg(va, void*);
*(int*)out = mwTreeViewGetOpenedImpl(handle, item);
}
}
static void tick(MwWidget handle) {

View file

@ -3,12 +3,12 @@
#include <stdio.h>
int main(int argc, char** argv){
int main(int argc, char** argv) {
unsigned char* rgba;
int width, height, bpp;
int i;
int width, height, bpp;
int i;
if(argc != 3){
if(argc != 3) {
printf("Usage: %s input name\n", argv[0]);
return 1;
}
@ -17,12 +17,12 @@ int main(int argc, char** argv){
printf("MwU32 %s[] = {\n", argv[2]);
printf(" (%d << 16) | %d,\n", width, height);
for(i = 0; i < width * height; i++){
for(i = 0; i < width * height; i++) {
unsigned char* px = &rgba[i * 4];
unsigned int p = 0;
int j;
unsigned int p = 0;
int j;
for(j = 0; j < 4; j++){
for(j = 0; j < 4; j++) {
p = p << 8;
p = p | px[j];
}