当前位置: 首页>>代码示例>>C++>>正文


C++ set_label函数代码示例

本文整理汇总了C++中set_label函数的典型用法代码示例。如果您正苦于以下问题:C++ set_label函数的具体用法?C++ set_label怎么用?C++ set_label使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了set_label函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: m_heading_position

TableofcontentsMenuItem::TableofcontentsMenuItem (
                            const gnote::Note::Ptr & note,
                            const Glib::ustring    & heading,
                            Heading::Type            heading_level,
                            int                      heading_position)
  : m_note            (note)
  , m_heading_position (heading_position)
{
  //Create a new menu item, with style depending on the heading level:
  /* +-----------------+
     |[] NOTE TITLE    | <---- Title     == note icon  + bold note title
     | > Heading 1     | <---- Level_1   == arrow icon + heading title
     | > Heading 1     |
     |   → heading 2   | <---- Level_2   == (no icon)  + indent string + heading title
     |   → heading 2   |
     |   → heading 2   |
     | > Heading 1     |
     +-----------------+
   */

  set_use_underline (false); //we don't want potential '_' in the heading to be used as mnemonic

  if (heading_level == Heading::Title) {
    set_image(*manage(new Gtk::Image(gnote::IconManager::obj().get_icon(gnote::IconManager::NOTE, 16))));
    Gtk::Label *label = (Gtk::Label*)get_child();
    label->set_markup("<b>" + heading + "</b>");
  }
  else if (heading_level == Heading::Level_1) {
    set_image(*manage(new Gtk::Image(Gtk::Stock::GO_FORWARD, Gtk::ICON_SIZE_MENU)));
    set_label(heading);
  }
  else if (heading_level == Heading::Level_2) {
    set_label("→  " + heading);
  }
}
开发者ID:mattiklock,项目名称:gnote,代码行数:35,代码来源:tableofcontentsmenuitem.cpp

示例2: test_serde

  void test_serde() {
    // dynamic create message.
    MessageHelper helper;
    FileDescriptorProto file_proto;
    file_proto.set_name("test.proo");
    DescriptorProto *message_proto = file_proto.add_message_type();
    message_proto->set_name("Pair");
    auto field = message_proto->add_field();
    field->set_name("key");
    field->set_label(FieldDescriptorProto_Label_LABEL_REQUIRED);
    field->set_type(FieldDescriptorProto_Type_TYPE_STRING);
    field->set_number(1);

    field = message_proto->add_field();
    field->set_name("value");
    field->set_label(FieldDescriptorProto_Label_LABEL_REQUIRED);
    field->set_type(FieldDescriptorProto_Type_TYPE_BYTES);
    field->set_number(2);
    helper.registerDynamicMessage(file_proto);
    auto src = helper.createMessage("Pair");
    auto ref = src->GetReflection();
    string key("scott");
    string value("tiger");
    ref->SetString(src.get(), src->GetDescriptor()->FindFieldByName("key"), key);
    ref->SetString(src.get(), src->GetDescriptor()->FindFieldByName("value"), value);

    // test serde
    check_serde_str(src.get(), helper.createMessage("Pair").get());
    check_serde_array(src.get(), helper.createMessage("Pair").get());
    check_serstr_dearray(src.get(), helper.createMessage("Pair").get());
    check_serarray_destr(src.get(), helper.createMessage("Pair").get());
  }
开发者ID:XiaominZhang,项目名称:raf,代码行数:32,代码来源:pair_serde_test.cpp

示例3: swap_labels

static void
swap_labels(struct coloring *c, int a, int b)
{
	int tmp = c->lab[a];
	set_label(c, a, c->lab[b]);
	set_label(c, b, tmp);
}
开发者ID:KULeuven-KRR,项目名称:IDP,代码行数:7,代码来源:saucy.cpp

示例4: generate_for

void generate_for(component init, component condition, component next,
		  component iteration, const char *continue_label,
		  bool discard, fncode fn)
{
  struct whiledata wdata;

  env_block_push(NULL); /* init may have local declarations */
  if (init)
    generate_component(init, NULL, TRUE, fn);

  start_block(NULL, FALSE, discard, fn);
  wdata.continue_label = continue_label;
  wdata.looplab = new_label(fn);
  wdata.mainlab = new_label(fn);
  wdata.endlab = new_label(fn);
  wdata.code = iteration;
  wdata.next = next;

  set_label(wdata.looplab, fn);
  if (condition)
    {
      generate_condition(condition, wdata.mainlab, wmain_code, &wdata,
			 wdata.endlab, NULL, NULL, fn);
      set_label(wdata.endlab, fn);
      if (!discard)
	generate_component(component_undefined, NULL, FALSE, fn);
    }
  else
    wmain_code(&wdata, fn);
  end_block(fn);
  env_block_pop();
}
开发者ID:saurabhd14,项目名称:tinyos-1.x,代码行数:32,代码来源:compile.c

示例5: generate_while_statement

static void
generate_while_statement(DVM_Executable *exe, Block *block,
                         Statement *statement, OpcodeBuf *ob)
{
    int loop_label;
    WhileStatement *while_s = &statement->u.while_s;

    loop_label = get_label(ob);
    set_label(ob, loop_label);

    generate_expression(exe, block, while_s->condition, ob);

    while_s->block->parent.statement.break_label = get_label(ob);
    while_s->block->parent.statement.continue_label = get_label(ob);

    generate_code(ob, statement->line_number,
                  DVM_JUMP_IF_FALSE,
                  while_s->block->parent.statement.break_label);
    generate_statement_list(exe, while_s->block,
                            while_s->block->statement_list, ob);

    set_label(ob, while_s->block->parent.statement.continue_label);
    generate_code(ob, statement->line_number, DVM_JUMP, loop_label);
    set_label(ob, while_s->block->parent.statement.break_label);
}
开发者ID:BluePanM,项目名称:code,代码行数:25,代码来源:generate.c

示例6: set_label

int AthScan::scale_axis()
{
    qint32 minFreq = ui->minFreqSpinBox->value();
    qint32 maxFreq = (minFreq > ui->maxFreqSpinBox->value()) ?  minFreq + 20 : ui->maxFreqSpinBox->value();
    qint32 minPwr = ui->minPwrSpinBox->value();
    qint32 maxPwr = (minPwr > ui->maxPwrSpinBox->value()) ?  minPwr + 2 : ui->maxPwrSpinBox->value();
    quint32 x_border = (minFreq + maxFreq) / 2;
    qint32 y_border = (minPwr + maxPwr) / 2;

    _borderV->setValue(x_border, y_border);
    QString xlabel;
    xlabel.sprintf("%dMHz", x_border);
    set_label(_borderV, xlabel);
    _borderH->setValue(x_border, y_border);
    QString ylabel;
    ylabel.sprintf("%ddb", y_border);
    set_label(_borderH, ylabel);

    ui->fftPlot->setAxisScale(QwtPlot::xBottom, minFreq, maxFreq);
    ui->fftPlot->setAxisScale(QwtPlot::yLeft, minPwr, maxPwr, 4);

    ui->fftPlot->replot();

    return 0;
}
开发者ID:alexchenmom,项目名称:ath_spectral,代码行数:25,代码来源:athscan.cpp

示例7: edit_find_ok_callback

static void edit_find_ok_callback(read_direction_t direction, Widget w, XtPointer context, XtPointer info)
{ /* "Find" is the label here */
  char *str = NULL, *buf = NULL;
  XmString s1;
  XEN proc;
  str = XmTextGetString(edit_find_text);
  if ((str) && (*str))
    { 
      clear_global_search_procedure(true);
      ss->search_expr = mus_strdup(str);
      redirect_errors_to(errors_to_find_text, NULL);
      proc = snd_catch_any(eval_str_wrapper, str, str);
      redirect_errors_to(NULL, NULL);
      if ((XEN_PROCEDURE_P(proc)) && (procedure_arity_ok(proc, 1)))
	{
	  ss->search_proc = proc;
	  ss->search_proc_loc = snd_protect(proc);
#if HAVE_SCHEME
	  if (optimization(ss) > 0)
	    ss->search_tree = mus_run_form_to_ptree_1_b(XEN_PROCEDURE_SOURCE(proc));
#endif
	  buf = (char *)calloc(PRINT_BUFFER_SIZE, sizeof(char));
	  mus_snprintf(buf, PRINT_BUFFER_SIZE, "find: %s", str);
	  set_label(edit_find_label, buf);
	  /* XmTextSetString(edit_find_text, NULL); */
	  free(buf);
	}
    }
  else
    {
      if (ss->search_expr == NULL)
	{
	  char *temp = NULL;
	  /* using global search_proc set by user */
	  buf = (char *)calloc(PRINT_BUFFER_SIZE, sizeof(char));
	  mus_snprintf(buf, PRINT_BUFFER_SIZE, "find: %s", temp = (char *)XEN_AS_STRING(ss->search_proc));
#if HAVE_SCHEME
	  if (temp) free(temp);
#endif
	  set_label(edit_find_label, buf);
	  /* XmTextSetString(edit_find_text, NULL); */
	  free(buf);
	}
    }
  if (str) XtFree(str);
  if ((XEN_PROCEDURE_P(ss->search_proc)) || (ss->search_tree))
    {
      s1 = XmStringCreateLocalized((char *)"Stop");
      XtVaSetValues(cancelB, XmNlabelString, s1, NULL);
      XmStringFree(s1);
      redirect_xen_error_to(stop_search_if_error, NULL);
      str = global_search(direction);
      redirect_xen_error_to(NULL, NULL);
      s1 = XmStringCreateLocalized((char *)"Go Away");
      XtVaSetValues(cancelB, XmNlabelString, s1, NULL);
      XmStringFree(s1);
      if ((str) && (*str)) set_label(edit_find_label, str);
    }
} 
开发者ID:OS2World,项目名称:MM-SOUND-Snd,代码行数:59,代码来源:snd-xfind.c

示例8: update_ipv6

static void update_ipv6(void)
{
	const struct connman_ipv6 *ipv6, *ipv6_conf;
	gboolean method_set = FALSE;
	gboolean privacy_set = FALSE;
	char value[6];

	ipv6 = connman_service_get_ipv6(path);
	ipv6_conf = connman_service_get_ipv6_config(path);

	if (ipv6 == NULL) {
		set_entry(builder, "ipv6_address", "", "");
		set_entry(builder, "ipv6_prefix_length", "", "");
		set_entry(builder, "ipv6_gateway", "", "");

		goto config;
	}

	memset(value, 0, 6);
	snprintf(value, 6, "%u", ipv6->prefix);

	set_ipv6_method(ipv6->method);
	method_set = TRUE;

	set_label(builder, "ipv6_address", ipv6->address, "");
	set_label(builder, "ipv6_prefix_length", value, "");
	set_label(builder, "ipv6_gateway", ipv6->gateway, "");

	set_ipv6_privacy(ipv6->privacy);
	privacy_set = TRUE;

config:
	if (ipv6_conf == NULL) {
		set_entry(builder, "ipv6_conf_address", "", "");
		set_entry(builder, "ipv6_conf_prefix_length", "", "");
		set_entry(builder, "ipv6_conf_gateway", "", "");

		if (ipv6 == NULL)
			set_widget_sensitive(builder, "ipv6_settings", FALSE);

		return;
	}

	memset(value, 0, 6);
	snprintf(value, 6, "%u", ipv6_conf->prefix);

	if (method_set == FALSE)
		set_ipv6_method(ipv6_conf->method);

	set_entry(builder, "ipv6_conf_address", ipv6_conf->address, "");
	set_entry(builder, "ipv6_conf_prefix_length", value, "");
	set_entry(builder, "ipv6_conf_gateway", ipv6_conf->gateway, "");

	if (privacy_set == FALSE)
		set_ipv6_privacy(ipv6_conf->privacy);
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman-ui,代码行数:56,代码来源:settings.c

示例9: set_label_from_settings

static void
set_label_from_settings (EmpathyIrcNetworkChooser *self)
{
  EmpathyIrcNetworkChooserPriv *priv = GET_PRIV (self);
  const gchar *server;

  tp_clear_object (&priv->network);

  server = empathy_account_settings_get_string (priv->settings, "server");

  if (server != NULL)
    {
      EmpathyIrcServer *srv;
      gint port;
      gboolean ssl;

      priv->network = empathy_irc_network_manager_find_network_by_address (
          priv->network_manager, server);

      if (priv->network != NULL)
        {
          /* The network is known */
          g_object_ref (priv->network);
          set_label (self);
          return;
        }

      /* We don't have this network. Let's create it */
      port = empathy_account_settings_get_uint32 (priv->settings, "port");
      ssl = empathy_account_settings_get_boolean (priv->settings,
          "use-ssl");

      DEBUG ("Create a network %s", server);
      priv->network = empathy_irc_network_new (server);
      srv = empathy_irc_server_new (server, port, ssl);

      empathy_irc_network_append_server (priv->network, srv);
      empathy_irc_network_manager_add (priv->network_manager, priv->network);

      set_label (self);

      g_object_unref (srv);
      return;
    }

  /* Set default network */
  priv->network = empathy_irc_network_manager_find_network_by_address (
          priv->network_manager, DEFAULT_IRC_NETWORK);
  g_assert (priv->network != NULL);

  set_label (self);
  update_server_params (self);
  g_object_ref (priv->network);
}
开发者ID:chrisinvisible,项目名称:empathy,代码行数:54,代码来源:empathy-irc-network-chooser.c

示例10: update_game_values

void update_game_values()
{
	char dummy[20] = "";

	sprintf(dummy,"%lu",current_score);
	set_label(score_label2,dummy);
	sprintf(dummy,"%d",current_level);
	set_label(level_label2,dummy);
	sprintf(dummy,"%d",current_lines);
	set_label(lines_label2,dummy);
}
开发者ID:wader,项目名称:gtktetris,代码行数:11,代码来源:interface.c

示例11: update_header

static void update_header(void)
{
	GdkPixbuf *image = NULL;
	const char *type, *info;
	GtkWidget *widget;
	gboolean favorite;

	type = connman_service_get_type(path);
	if (g_strcmp0(type, "wifi") == 0) {
		uint8_t strength;

		strength = connman_service_get_strength(path);

		cui_theme_get_signal_icone_and_info(strength, &image, &info);
	} else
		cui_theme_get_type_icone_and_info(type, &image, &info);

	set_image(builder, "service_type", image, info);
	set_label(builder, "service_name",
			connman_service_get_name(path), "- Hidden -");

	if (connman_service_is_connected(path) == TRUE)
		cui_theme_get_state_icone_and_info(
				connman_service_get_state(path), &image, &info);
	else
		image = NULL;

	set_image(builder, "service_state", image, info);
	set_label(builder, "service_error",
				connman_service_get_error(path), "");

	favorite = connman_service_is_favorite(path);

	set_button_toggle(builder, "service_autoconnect",
				connman_service_is_autoconnect(path));
	widget = set_widget_sensitive(builder,
				"service_autoconnect", favorite);
	if (favorite == TRUE) {
		g_signal_connect(widget, "toggled",
				G_CALLBACK(autoconnect_button_toggled), NULL);
	}

	set_button_toggle(builder, "service_favorite", favorite);
	widget = set_widget_sensitive(builder, "service_favorite", favorite);

	if (favorite == TRUE) {
		g_signal_connect(widget, "toggled",
				G_CALLBACK(favorite_button_toggled), NULL);
	}
}
开发者ID:Jubei-Mitsuyoshi,项目名称:aaa-connman-ui,代码行数:50,代码来源:settings.c

示例12: make_region_labels

static void make_region_labels(file_info *hdr)
{
  char *str;
  if (hdr == NULL) return;
  str = (char *)CALLOC(PRINT_BUFFER_SIZE, sizeof(char));
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("srate: %d"), hdr->srate);
  set_label(srate_text, str);
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("chans: %d"), hdr->chans);
  set_label(chans_text, str);
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("length: %.3f"), (float)((double)(hdr->samples) / (float)(hdr->chans * hdr->srate)));
  set_label(length_text, str);
  mus_snprintf(str, PRINT_BUFFER_SIZE, _("maxamp: %.3f"), region_maxamp(region_list_position_to_id(current_region)));
  set_label(maxamp_text, str);
  FREE(str);
}
开发者ID:huangjs,项目名称:cl,代码行数:15,代码来源:snd-gregion.c

示例13: gpio_request

int gpio_request(unsigned gpio, const char *label)
{
	if (check_gpio(gpio) < 0)
		return -EINVAL;

	/*
	 * Allow that the identical GPIO can
	 * be requested from the same driver twice
	 * Do nothing and return -
	 */

	if (cmp_label(gpio, label) == 0)
		return 0;

	if (unlikely(is_reserved(gpio, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved by %s !\n",
		       gpio, get_label(gpio));
		return -EBUSY;
	}
	if (unlikely(is_reserved(peri, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));
		return -EBUSY;
	}
	else {	/* Reset POLAR setting when acquiring a gpio for the first time */
		set_gpio_polar(gpio, 0);
	}

	reserve(gpio, gpio);
	set_label(gpio, label);

	port_setup(gpio, GPIO_USAGE);

	return 0;
}
开发者ID:0s4l,项目名称:u-boot-xlnx,代码行数:35,代码来源:gpio.c

示例14: special_gpio_request

int special_gpio_request(unsigned gpio, const char *label)
{
	/*
	 * Allow that the identical GPIO can
	 * be requested from the same driver twice
	 * Do nothing and return -
	 */

	if (cmp_label(gpio, label) == 0)
		return 0;

	if (unlikely(is_reserved(special_gpio, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved by %s !\n",
		       gpio, get_label(gpio));
		return -EBUSY;
	}
	if (unlikely(is_reserved(peri, gpio, 1))) {
		printf("bfin-gpio: GPIO %d is already reserved as Peripheral by %s !\n",
		       gpio, get_label(gpio));

		return -EBUSY;
	}

	reserve(special_gpio, gpio);
	reserve(peri, gpio);

	set_label(gpio, label);
	port_setup(gpio, GPIO_USAGE);

	return 0;
}
开发者ID:0s4l,项目名称:u-boot-xlnx,代码行数:31,代码来源:gpio.c

示例15: _window

NodeView::NodeView(Gtk::Window*                        window,
                   Ganv::Canvas&                       canvas,
                   SPtr<machina::client::ClientObject> node,
                   double                              x,
                   double                              y)
	: Ganv::Circle(canvas, "", x, y)
	, _window(window)
	, _node(node)
	, _default_border_color(get_border_color())
	, _default_fill_color(get_fill_color())
{
	set_fit_label(false);
	set_radius_ems(1.25);

	signal_event().connect(sigc::mem_fun(this, &NodeView::on_event));

	MachinaCanvas* mcanvas = dynamic_cast<MachinaCanvas*>(&canvas);
	if (is(mcanvas->app()->forge(), URIs::instance().machina_initial)) {
		set_border_width(4.0);
		set_is_source(true);
		const uint8_t alpha[] = { 0xCE, 0xB1, 0 };
		set_label((const char*)alpha);
	}

	node->signal_property.connect(sigc::mem_fun(this, &NodeView::on_property));

	for (const auto& p : node->properties()) {
		on_property(p.first, p.second);
	}
}
开发者ID:EQ4,项目名称:lad,代码行数:30,代码来源:NodeView.cpp


注:本文中的set_label函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。