#include #include #include #include "diadef.h" #include "dialog.h" /* This class is a virtual class. This is the building block for combo-type widget. It edit like a string, but a hotkey may trigger a helper function which may bring a help dialog or a pick list. This class do the drawing of the little button at the end of the string (an arrow in popular GUI toolkit). It intercept the hotkey and trigger the assist function (which must be derived). */ PUBLIC FIELD_STRING_HELP::FIELD_STRING_HELP( const char *_prompt, SSTRING &_str) : FIELD_SSTRING (_prompt,_str,30) { } PUBLIC FIELD_STRING_HELP::FIELD_STRING_HELP( const char *_prompt, SSTRING &_str, int _maxsiz) : FIELD_SSTRING (_prompt,_str,_maxsiz) { } /* Draw only the input part of a field */ PUBLIC void FIELD_STRING_HELP::drawtxt ( WINDOW *dialog, int offset, int start_line, int end_line) { FIELD_STRING_BASE::drawtxt(dialog, offset, start_line, end_line); if (!is_readonly()){ // Add the little button wattrset(dialog, inputbox_attr); wmove(dialog, box.y,box.x+box.width-1); waddch (dialog,ACS_DARROW); } } PUBLIC MENU_STATUS FIELD_STRING_HELP::dokey ( WINDOW *dialog, int key, FIELD_MSG &msg, bool &grab) { MENU_STATUS ret = MENU_NULL; if (key == 24 || key == KEY_F(4)){ if (!is_readonly()) assist(dialog); }else{ ret = FIELD_SSTRING::dokey(dialog,key,msg,grab); } return ret; }