本文整理汇总了C++中Activity::set_number方法的典型用法代码示例。如果您正苦于以下问题:C++ Activity::set_number方法的具体用法?C++ Activity::set_number怎么用?C++ Activity::set_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::set_number方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main_table
//.........这里部分代码省略.........
Gtk::Dialog(_("Edit activity"), parent);
set_title(_("New activity"));
}
set_transient_for(*parent);
add_button(Gtk::Stock::CANCEL, 2);
if(activity)
add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
else
add_button(_("Create activity"), Gtk::RESPONSE_OK);
Gtk::Box *cont_area = get_vbox();
Gtk::Table main_table(10, 3);
main_table.set_row_spacings(10);
cont_area->pack_start(main_table);
Gtk::Label main_label;
if(activity)
main_label.set_text(_("Edit properties for activity:"));
else
main_label.set_text(_("Enter properties for new activity:"));
main_table.attach(main_label, 0, 3, 0, 1);
Gtk::Label no_label(_("Activity number:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
main_table.attach(no_label, 0, 3, 1, 2);
main_table.attach(number_entry, 0, 3, 2, 3);
Gtk::Label name_label(_("Activity name:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
main_table.attach(name_label, 0, 3, 3, 4);
main_table.attach(name_entry, 0, 3, 4, 5);
Gtk::Label desc_label(_("Description:"), Gtk::ALIGN_LEFT, Gtk::ALIGN_CENTER);
main_table.attach(desc_label, 0, 3, 5, 6);
Gtk::ScrolledWindow desc_scroll;
desc_scroll.add(desc_area);
desc_scroll.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC);
main_table.attach(desc_scroll, 0, 3, 6, 7);
Gtk::Label start_date_label(_("Start date:"), Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
start_date_entry.set_max_length(10);
start_date_entry.set_width_chars(14);
Gtk::Button start_cal_button(_("Calendar"));
start_cal_button.signal_clicked().connect(sigc::mem_fun(*this, &ActivityDialog::on_click_start_calendar));
main_table.attach(start_date_label, 0, 1, 7, 8);
main_table.attach(start_date_entry, 1, 2, 7, 8);
main_table.attach(start_cal_button, 2, 3, 7, 8, Gtk::SHRINK, Gtk::SHRINK);
Gtk::Label end_date_label(_("End date:"), Gtk::ALIGN_RIGHT, Gtk::ALIGN_CENTER);
end_date_entry.set_max_length(10);
end_date_entry.set_width_chars(14);
Gtk::Button end_cal_button(_("Calendar"));
end_cal_button.signal_clicked().connect(sigc::mem_fun(*this, &ActivityDialog::on_click_end_calendar));
main_table.attach(end_date_label, 0, 1, 8, 9);
main_table.attach(end_date_entry, 1, 2, 8, 9);
main_table.attach(end_cal_button, 2, 3, 8, 9, Gtk::SHRINK, Gtk::SHRINK);
check_button_finished.set_label(_("Activity finished"));
main_table.attach(check_button_finished, 1, 3, 9, 10);
show_all_children();
while(true)
{
int result = run();
if(result == Gtk::RESPONSE_OK)
{
Glib::ustring error_msg;
if(name_entry.get_text().size() == 0)
error_msg = _("Activity must have a name.\n");
if(start_date_entry.get_text().size() == 0)
error_msg += _("Activity must have a start date.\n");
if(end_date_entry.get_text().size() == 0)
error_msg += _("Activity must have an end date.");
if(error_msg.size() > 0)
{
Gtk::MessageDialog message(error_msg, false, Gtk::MESSAGE_ERROR);
message.set_icon_from_file("images/HaPr_high_80x100_ver2.gif");
message.run();
}
else
{
Activity newa;
newa.set_number(number_entry.get_text());
newa.set_name(name_entry.get_text());
Glib::RefPtr<Gtk::TextBuffer> desc_buffer = desc_area.get_buffer();
newa.set_description(desc_buffer->get_text());
newa.set_start_date(start_date_entry.get_text());
newa.set_end_date(end_date_entry.get_text());
newa.set_finished(check_button_finished.get_active());
if(activity)
newa.set_id(activity->get_id());
parent->add_edit_activity(&newa);
break;
}
}
else
break;
}
}