buffp create_combobox_control(int id, struct dimvals dims, struct maskvals style) { S("COMBOBOX"); if (style.or & 0x3) style.and &= ~0x3; return make_control(NULL, id, s, style, dims, WS_VISIBLE | WS_CHILD | WS_TABSTOP | CBS_SIMPLE); }
static int pipemode_filter( void *opaque, int control, IOBUF a, byte *buf, size_t *ret_len) { size_t size = *ret_len; struct pipemode_context_s *stx = opaque; int rc=0; size_t n = 0; int esc = 0; if( control == IOBUFCTRL_UNDERFLOW ) { *ret_len = 0; /* reserve some space for one control packet */ if ( size <= CONTROL_PACKET_SPACE+FAKED_LITERAL_PACKET_SPACE ) BUG(); size -= CONTROL_PACKET_SPACE+FAKED_LITERAL_PACKET_SPACE; if ( stx->block_mode ) { /* reserve 2 bytes for the block length */ buf[n++] = 0; buf[n++] = 0; } while ( n < size ) { /* FIXME: we have to make sure that we have a large enough * buffer for a control packet even after we already read * something. The easest way to do this is probably by ungetting * the control sequence and returning the buffer we have * already assembled */ int c = iobuf_get (a); if (c == -1) { if ( stx->state != STX_init ) { log_error ("EOF encountered at wrong state\n"); stx->stop = 1; return -1; } break; } if ( esc ) { switch (c) { case '@': if ( stx->state == STX_text ) { buf[n++] = c; break; } else if ( stx->state == STX_detached_signature ) { esc = 0; goto do_unarmor; /* not a very elegant solution */ } else if ( stx->state == STX_detached_signature_wait_text) { esc = 0; break; /* just ignore it in this state */ } log_error ("@@ not allowed in current state\n"); return -1; case '<': /* begin of stream part */ if ( stx->state != STX_init ) { log_error ("nested begin of stream\n"); stx->stop = 1; return -1; } stx->state = STX_wait_operation; stx->block_mode = 0; unarmor_pump_release (stx->unarmor_ctx); stx->unarmor_ctx = NULL; break; case '>': /* end of stream part */ if ( stx->state != STX_wait_init ) { log_error ("invalid state for @>\n"); stx->stop = 1; return -1; } stx->state = STX_init; break; case 'V': /* operation = verify */ case 'E': /* operation = encrypt */ case 'S': /* operation = sign */ case 'B': /* operation = detach sign */ case 'C': /* operation = clearsign */ case 'D': /* operation = decrypt */ if ( stx->state != STX_wait_operation ) { log_error ("invalid state for operation code\n"); stx->stop = 1; return -1; } stx->operation = c; if ( stx->operation == 'B') { stx->state = STX_detached_signature; if ( !opt.no_armor ) stx->unarmor_ctx = unarmor_pump_new (); } else stx->state = STX_begin; n += make_control ( buf+n, 1, stx->operation ); /* must leave after a control packet */ goto leave; case 't': /* plaintext text follows */ if ( stx->state == STX_detached_signature_wait_text ) stx->state = STX_detached_signature; if ( stx->state == STX_detached_signature ) { if ( stx->operation != 'B' ) { log_error ("invalid operation for this state\n"); stx->stop = 1; return -1; } stx->state = STX_signed_data; n += make_control ( buf+n, 2, 'B' ); /* and now we fake a literal data packet much the same * as in armor.c */ buf[n++] = 0xaf; /* old packet format, type 11, var length */ buf[n++] = 0; /* set the length header */ buf[n++] = 6; buf[n++] = 'b'; /* we ignore it anyway */ buf[n++] = 0; /* namelength */ memset(buf+n, 0, 4); /* timestamp */ n += 4; /* and return now so that we are sure to have * more space in the bufer for the next control * packet */ stx->block_mode = 1; goto leave2; } else { log_error ("invalid state for @t\n"); stx->stop = 1; return -1; } break; case '.': /* ready */ if ( stx->state == STX_signed_data ) { if (stx->block_mode) { buf[0] = (n-2) >> 8; buf[1] = (n-2); if ( buf[0] || buf[1] ) { /* end of blocks marker */ buf[n++] = 0; buf[n++] = 0; } stx->block_mode = 0; } n += make_control ( buf+n, 3, 'B' ); } else { log_error ("invalid state for @.\n"); stx->stop = 1; return -1; } stx->state = STX_wait_init; goto leave; default: log_error ("invalid escape sequence 0x%02x in stream\n", c); stx->stop = 1; return -1; } esc = 0; }
buffp create_scrollbar_control(int id, struct dimvals dims, struct maskvals style) { S("SCROLLBAR"); return make_control(NULL, id, s, style, dims, WS_VISIBLE | WS_CHILD); }
buffp create_autoradiobutton_control(char *name,int id, struct dimvals dims, struct maskvals style) { S("BUTTON"); return make_control(name, id, s, style, dims, WS_VISIBLE | WS_CHILD | BS_AUTORADIOBUTTON | WS_TABSTOP); }
buffp create_checkbox_control(char *name, int id, struct dimvals dims, struct maskvals style) { S("BUTTON"); return make_control(name, id, s, style, dims, WS_VISIBLE | WS_CHILD | BS_CHECKBOX | WS_TABSTOP); }
buffp create_defpushbutton_control(char *name, int id, struct dimvals dims, struct maskvals style) { S("BUTTON"); return make_control(name, id, s, style, dims, WS_VISIBLE | WS_CHILD | WS_TABSTOP | BS_DEFPUSHBUTTON); }
buffp create_groupbox_control(char *name, int id, struct dimvals dims, struct maskvals style) { S("BUTTON"); return make_control(name, id, s, style, dims, WS_VISIBLE | WS_CHILD | BS_GROUPBOX); }
buffp create_listbox_control(int id, struct dimvals dims, struct maskvals style) { S("LISTBOX"); return make_control(NULL, id, s, style, dims, WS_VISIBLE | WS_CHILD | WS_BORDER | LBS_NOTIFY); }
buffp create_edit_control(int id, struct dimvals dims, struct maskvals style) { S("EDIT"); return make_control(NULL, id, s, style, dims, WS_CHILD | WS_VISIBLE | ES_LEFT | WS_TABSTOP | WS_BORDER); }
buffp create_icon_control(char *name, int id, struct dimvals dims, struct maskvals style) { S("STATIC"); return make_control(name, id, s, style, dims, WS_VISIBLE | WS_CHILD | WS_GROUP | SS_ICON); }