本文整理汇总了C++中set_text函数的典型用法代码示例。如果您正苦于以下问题:C++ set_text函数的具体用法?C++ set_text怎么用?C++ set_text使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_text函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: add_to_history
void GLUI_CommandLine::deactivate( void )
{
// if the commit_flag is set, add the current command to
// history and call deactivate as normal
// Trick deactivate into calling callback if and only if commit_flag set.
// A bit subtle, but deactivate checks that orig_text and text
// are the same to decide whether or not to call the callback.
// Force them to be different for commit, and the same for no commit.
if (commit_flag) {
add_to_history(text.c_str());
orig_text = "";
Super::deactivate( );
set_text( "" );
commit_flag = false;
}
else {
orig_text = text;
}
}
示例2: set_v_size_flags
Label::Label(const String &p_text) {
align=ALIGN_LEFT;
valign=VALIGN_TOP;
text="";
word_cache=NULL;
word_cache_dirty=true;
autowrap=false;
line_count=0;
set_v_size_flags(0);
clip=false;
set_ignore_mouse(true);
total_char_cache=0;
visible_chars=-1;
percent_visible=1;
lines_skipped=0;
max_lines_visible=-1;
set_text(p_text);
uppercase=false;
}
示例3: add_item
void GlobalSearchPositions::create_objects()
{
add_item(new BC_MenuItem("16"));
add_item(new BC_MenuItem("32"));
add_item(new BC_MenuItem("64"));
add_item(new BC_MenuItem("128"));
add_item(new BC_MenuItem("256"));
add_item(new BC_MenuItem("512"));
add_item(new BC_MenuItem("1024"));
add_item(new BC_MenuItem("2048"));
add_item(new BC_MenuItem("4096"));
add_item(new BC_MenuItem("8192"));
add_item(new BC_MenuItem("16384"));
add_item(new BC_MenuItem("32768"));
add_item(new BC_MenuItem("65536"));
add_item(new BC_MenuItem("131072"));
char string[BCTEXTLEN];
sprintf(string, "%d", plugin->config.global_positions);
set_text(string);
}
示例4: WARNLOG
bool CRpcResponse::handleExceptions(IXslProcessor *xslp, IMultiException *me, const char *serv, const char *meth, const char *errorXslt)
{
IEspContext *context=queryContext();
if (me->ordinality()>0)
{
StringBuffer text;
me->errorMessage(text);
text.append('\n');
WARNLOG("Exception(s) in %s::%s - %s", serv, meth, text.str());
if (errorXslt)
{
me->serialize(text.clear());
StringBuffer theOutput;
xslTransformHelper(xslp, text.str(), errorXslt, theOutput, context->queryXslParameters());
set_text(theOutput.str());
}
}
return false;
}
示例5: UCharsetDetector_detect_all
/*
* call-seq:
* detect_all(text=nil, declared_encoding=nil)
*
* Find all charset matches that appear to be consistent with the input,
* returning an array of results. The results are ordered with the
* best quality match first.
*
* Because the detection only looks at a limited amount of the
* input byte data, some of the returned charsets may fail to handle
* the all of input data.
*
* Return an error if
* * no charset appears to match the data
* * no input text has been provided (with +text+ or set with #text= )
*/
static VALUE
UCharsetDetector_detect_all(int argc, VALUE *argv, VALUE self)
{
VALUE text;
VALUE declared_encoding;
rb_scan_args(argc, argv, "02", &text, &declared_encoding);
set_text(self, text);
set_declared_encoding(self, declared_encoding);
UCharsetDetector *detector;
Data_Get_Struct(self, UCharsetDetector, detector);
UErrorCode status = U_ZERO_ERROR;
int32_t matches_found;
const UCharsetMatch **matches = ucsdet_detectAll(detector, &matches_found, &status);
ensure(status);
VALUE ary = rb_ary_new();
int i = 0;
for (i = 0; i < matches_found; i++) {
const char *encoding_name = ucsdet_getName(matches[i], &status);
ensure(status);
int32_t encoding_confidence = ucsdet_getConfidence(matches[i], &status);
ensure(status);
const char *encoding_language = ucsdet_getLanguage(matches[i], &status);
ensure(status);
VALUE hash = rb_hash_new();
rb_hash_aset(hash, ID2SYM(rb_intern("encoding")), rb_str_new2(encoding_name));
rb_hash_aset(hash, ID2SYM(rb_intern("confidence")), INT2NUM(encoding_confidence));
rb_hash_aset(hash, ID2SYM(rb_intern("language")), rb_str_new2(encoding_language));
rb_ary_push(ary, hash);
}
return ary;
}
示例6: TEXT
void GaugeCDI::Update(double TrackBearing, double WaypointBearing)
{
// JMW changed layout here to fit reorganised display
// insert waypoint bearing ".<|>." into CDIScale string"
TCHAR CDIScale[] = TEXT("330..340..350..000..010..020..030..040..050..060..070..080..090..100..110..120..130..140..150..160..170..180..190..200..210..220..230..240..250..260..270..280..290..300..310..320..330..340..350..000..010..020..030..040.");
TCHAR CDIDisplay[25] = TEXT("");
int j;
int CDI_WP_Bearing = (int)WaypointBearing/2;
CDIScale[CDI_WP_Bearing + 9] = 46;
CDIScale[CDI_WP_Bearing + 10] = 60;
CDIScale[CDI_WP_Bearing + 11] = 124; // "|" character
CDIScale[CDI_WP_Bearing + 12] = 62;
CDIScale[CDI_WP_Bearing + 13] = 46;
for (j=0;j<24;j++) CDIDisplay[j] = CDIScale[(j + (int)(TrackBearing)/2)];
CDIDisplay[24] = _T('\0');
// JMW fix bug! This indicator doesn't always display correctly!
// JMW added arrows at end of CDI to point to track if way off..
int deltacdi = iround(WaypointBearing - TrackBearing);
while (deltacdi>180) {
deltacdi-= 360;
}
while (deltacdi<-180) {
deltacdi+= 360;
}
if (deltacdi>20) {
CDIDisplay[21]='>';
CDIDisplay[22]='>';
CDIDisplay[23]='>';
}
if (deltacdi<-20) {
CDIDisplay[0]='<';
CDIDisplay[1]='<';
CDIDisplay[2]='<';
}
set_text(CDIDisplay);
// end of new code to display CDI scale
}
示例7: x
void gui_filterbar_c::fill_tags()
{
int lnki = 0;
auto make_ht = [&]( const ts::wsptr &htt ) -> ts::wstr_c
{
ts::wstr_c x( CONSTWSTR("<cstm=a\1>"), htt );
x.append( CONSTWSTR("<cstm=b\1>, ") );
x.replace_all( CONSTWSTR("\1"), ts::wmake<int>( lnki++ ) );
return x;
};
ts::wstr_c t;
for (int i = 0; i < BIT_count; ++i)
t.append( make_ht(tagname(i)) );
for(const ts::str_c &ht : contacts().get_all_tags())
t.append(make_ht(from_utf8(ht)));
t.trunc_length(2);
set_text(t);
}
示例8: ERR_FAIL_INDEX
void OptionButton::_select(int p_idx, bool p_emit) {
if (p_idx < 0)
return;
if (p_idx == current)
return;
ERR_FAIL_INDEX(p_idx, popup->get_item_count());
for (int i = 0; i < popup->get_item_count(); i++) {
popup->set_item_checked(i, i == p_idx);
}
current = p_idx;
set_text(popup->get_item_text(current));
set_icon(popup->get_item_icon(current));
if (is_inside_tree() && p_emit)
emit_signal("item_selected", current);
}
示例9: get_text
void
ItemColorChannel::remove_char()
{
std::string text = get_text();
if (text.empty())
{
*m_number = 0.0f;
}
else
{
text.pop_back();
if (!text.empty()) {
*m_number = std::stof(text);
} else {
*m_number = 0.0f;
}
}
set_text(text);
}
示例10: in_received_handler
// Called when a message is received from PebbleKitJS
static void in_received_handler(DictionaryIterator *received, void *context) {
bool ok = false;
int status = 0;
Tuple *tuple;
tuple = dict_find(received, STATUS_KEY);
if(tuple) {
status = (int)tuple->value->uint32;
//APP_LOG(APP_LOG_LEVEL_DEBUG, "Received Status: %d", (int)tuple->value->uint32);
}
if (status == 1) {
/*
tuple = dict_find(received, MESSAGE_KEY);
if(tuple) {
APP_LOG(APP_LOG_LEVEL_DEBUG, "Received Message: %s", tuple->value->cstring);
}*/
if (!initialized) {
initialized = true;
hide_loadscreen();
show_window();
}
if (tupleInt(received, RECORDING) == 1) {
vibes_double_pulse();
}
mode = tupleInt(received, MODE);
setMode(mode, tupleInt(received, RECORDING));
setBattery(tupleInt(received, BATTERY));
set_text(tupleStr(received, CURRENT), tupleStr(received, REMAIN));
}
else {
if (initialized) {
initialized = false;
hide_window();
show_loadscreen();
}
set_loadText(status);
}
}
示例11: switch
/**
* \brief Set the text displayed in the control.
*/
void ptb::key_edit::set_label()
{
std::string t;
switch ( m_button.get_type() )
{
case bear::input::controller_button::controller_keyboard:
t = bear::input::keyboard::get_translated_name_of
(m_button.get_key_info().get_code());
break;
case bear::input::controller_button::controller_joystick:
t = bear::input::joystick_button::get_translated_name_of
(m_button.get_joystick_button());
break;
case bear::input::controller_button::controller_mouse:
t = bear::input::mouse::get_translated_name_of(m_button.get_mouse_code());
break;
default: { }
}
set_text(t);
} // key_edit::set_label()
示例12: inbox
void inbox(DictionaryIterator *iter, void *context) {
Tuple *t = dict_read_first(iter);
do {
switch (t->key) {
case DISPLAY_MESSAGE:
set_text(strcpy(DisplayMessage, t->value->cstring));
break;
case MESSAGE:
switch(t->value->int32) {
case IS_LEVEL:
car_is_level();
break;
case BEGIN_LOGGING:
begin_logging();
break;
};
break;
default:
break;
};
} while ((t = dict_read_next(iter)) != NULL);
}
示例13: set_text
void textbox::append_text(const std::string& text, bool auto_scroll, const SDL_Color& color)
{
if(text_image_.get() == NULL) {
set_text(text, color);
return;
}
//disallow adding multi-line text to a single-line text box
if(wrap_ == false && std::find_if(text.begin(),text.end(),utils::isnewline) != text.end()) {
return;
}
const bool is_at_bottom = get_position() == get_max_position();
const wide_string& wtext = utils::string_to_wstring(text);
const surface new_text = add_text_line(wtext, color);
surface new_surface = create_compatible_surface(text_image_,std::max<size_t>(text_image_->w,new_text->w),text_image_->h+new_text->h);
SDL_SetAlpha(new_text.get(),0,0);
SDL_SetAlpha(text_image_.get(),0,0);
sdl_blit(text_image_,NULL,new_surface,NULL);
SDL_Rect target = create_rect(0
, text_image_->h
, new_text->w
, new_text->h);
sdl_blit(new_text,NULL,new_surface,&target);
text_image_.assign(new_surface);
text_.resize(text_.size() + wtext.size());
std::copy(wtext.begin(),wtext.end(),text_.end()-wtext.size());
set_dirty(true);
update_text_cache(false);
if(auto_scroll && is_at_bottom) scroll_to_bottom();
handle_text_changed(text_);
}
示例14: edit_box
VOID edit_box(LONG tree, WORD sobj)
{
LONG obspec;
WORD where, type, exitobj, ok, nilok;
BYTE name[9], text[2], bxchar;
GRECT p;
if (rcs_state != ALRT_STATE)
{
get_fields(tree, sobj, &type, &obspec, &p);
ini_tree(&tree, BOXDIAL);
where = set_obname(tree, BOXNAME, name, ad_view, sobj);
if ( where != NIL && tree_view() && tree_kind( get_kind(where)) )
nilok = FALSE;
else
nilok = TRUE;
bxchar = LHIBT(LHIWD(LLGET(obspec)));
set_text(tree, OCHRITEM, (LONG)ADDR(&text[0]), 2);
text[0] = bxchar? bxchar: '@';
text[1] = '\0';
do {
exitobj = hndl_dial(tree, OCHRITEM, &p);
desel_obj(tree, exitobj);
ok = DEFAULT & GET_FLAGS(tree, exitobj);
} while (ok && !name_ok(name, where, nilok));
if (ok)
{
rcs_edited = TRUE;
get_obname(name, ad_view, sobj);
bxchar = (text[0] == '@')? '\0': text[0];
LLSET(obspec, (LLGET(obspec) & 0xffffffL) |
((LONG) ((UWORD) bxchar) << 24));
}
}
}
示例15: setup
void setup()
{
set_adj("large", "treasure", "sandy");
set_id("chest");
set_untouched_desc("There is a large treasure chest at the bottom of the "
"hole.");
set_long("The treasure chest is still a bit sandy, but otherwise has weathered well. There is some writing on the outside of it.");
set_objects( ([
]) );
#ifdef USE_SIZE
set_size(LARGE);
#endif
#ifdef USE_MASS
set_mass(LARGE);
#endif
set_max_capacity(LARGE);
set_text("Written on the treasure chest is a poem:\n"
"\tI used to have a treasure chest.\n"
"\tIt got so heavy that I had to rest.\n"
"\tI let it slip away from me,\n"
"\tBut I didn't need it anyway,\n"
"\tSo I let it slip away...\n");
}