Changeset 91 for trunk/orca

Show
Ignore:
Timestamp:
03/14/06 22:00:21 (3 years ago)
Author:
krobillard
Message:

Qt - Added 'question native and widgets.r demo.

Location:
trunk/orca/qt
Files:
1 added
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/orca/qt/qorca.cpp

    r90 r91  
    533533 
    534534                if( match->integer == LD_TEXT_EDITS ) 
    535                     pw->setPlainText( valueStr( cbp.values + 1 ) ); 
     535                { 
     536                    const char* str = valueStr( cbp.values + 1 ); 
     537                    if( *str == '<' ) 
     538                        pw->setHtml( str ); 
     539                    else 
     540                        pw->setPlainText( str ); 
     541                } 
    536542            } 
    537543                break; 
     
    11361142    else 
    11371143        QMessageBox::information( 0, cp1, cp2 ); 
     1144} 
     1145 
     1146 
     1147OR_NATIVE( questionNative ) 
     1148{ 
     1149#define REF_QUESTION_DEF    a1+4 
     1150#define REF_QUESTION_BTN    a1+5 
     1151    OString* ostr; 
     1152    QString str[4]; 
     1153    int def = 0; 
     1154    int i; 
     1155 
     1156    for( i = 0; i < 4; ++i ) 
     1157    { 
     1158        OValue* val = a1 + i; 
     1159        ostr = orSTRING(val); 
     1160        orTermCStr(ostr); 
     1161        str[i] = orStrChars(ostr, val); 
     1162    } 
     1163 
     1164    if( orRefineSet( REF_QUESTION_DEF ) ) 
     1165        def = orInt(REF_QUESTION_BTN) - 1; 
     1166 
     1167    i = QMessageBox::question( 0, str[0], str[1], str[2], str[3], 
     1168                               QString(), def ); 
     1169    if( i < 0 ) 
     1170    { 
     1171        orResultNONE; 
     1172    } 
     1173    else 
     1174    { 
     1175        orResult( OT_INTEGER, i + 1 ); 
     1176    } 
    11381177} 
    11391178 
     
    11661205  "append-text: native [wid [integer!] val]\n" 
    11671206  "message: native [title [string!] msg [string!] /warn]\n" 
     1207  "question: native [\n" 
     1208  "  title [string!] msg [string!]\n" 
     1209  "  button1 [string!] button2 [string!]\n" 
     1210  "  /default button [integer!]\n" 
     1211  "]\n" 
    11681212  "layout-rules: [\n" 
    11691213  "  0 ['hbox block!]\n" 
     
    12341278    orNative( (void*) appendTextNative,     "append-text" ); 
    12351279    orNative( (void*) messageNative,        "message" ); 
     1280    orNative( (void*) questionNative,       "question" ); 
    12361281 
    12371282    {