本文整理汇总了C++中gtk::ToggleButton类的典型用法代码示例。如果您正苦于以下问题:C++ ToggleButton类的具体用法?C++ ToggleButton怎么用?C++ ToggleButton使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ToggleButton类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: TempRow
TempRow(Model *model, TempType type) :
m_model(model), m_type(type)
{
static const char *names[] = { "Nozzle", "Bed" };
add(*(new Gtk::Label(names[type])));
Gtk::ToggleButton *pOn = new Gtk::ToggleButton("Heat On");
pOn->signal_toggled().connect
(sigc::bind (sigc::mem_fun (*this, &TempRow::heat_toggled), pOn));
add(*pOn);
m_temp = new Gtk::Label();
add (*m_temp);
add(*(new Gtk::Label("Target Temperature (°C)")));
m_target = new Gtk::SpinButton();
m_target->set_increments (1, 5);
m_target->set_range(25.0, 256.0);
switch (type) {
case TEMP_NOZZLE:
default:
m_target->set_value(200.0);
break;
case TEMP_BED:
m_target->set_value(100.0);
break;
}
add (*m_target);
}
开发者ID:earizaa,项目名称:repsnapper,代码行数:27,代码来源:view.cpp
示例2: connectWidget
void Toggle::connectWidget(Gtk::Widget* widget)
{
if (dynamic_cast<Gtk::ToggleToolButton*>(widget) != NULL)
{
Gtk::ToggleToolButton* toolButton = static_cast<Gtk::ToggleToolButton*>(widget);
toolButton->set_active(_toggled);
// Connect the toggleToolbutton to the callback of this class
_toggleWidgets[widget] = toolButton->signal_toggled().connect(
sigc::mem_fun(*this, &Toggle::onToggleToolButtonClicked));
}
else if (dynamic_cast<Gtk::ToggleButton*>(widget) != NULL)
{
Gtk::ToggleButton* toggleButton = static_cast<Gtk::ToggleButton*>(widget);
toggleButton->set_active(_toggled);
// Connect the togglebutton to the callback of this class
_toggleWidgets[widget] = toggleButton->signal_toggled().connect(
sigc::mem_fun(*this, &Toggle::onToggleButtonClicked));
}
else if (dynamic_cast<Gtk::CheckMenuItem*>(widget) != NULL)
{
Gtk::CheckMenuItem* menuItem = static_cast<Gtk::CheckMenuItem*>(widget);
menuItem->set_active(_toggled);
// Connect the togglebutton to the callback of this class
_toggleWidgets[widget] = menuItem->signal_toggled().connect(
sigc::mem_fun(*this, &Toggle::onCheckMenuItemClicked));
}
}
开发者ID:DerSaidin,项目名称:DarkRadiant,代码行数:33,代码来源:Toggle.cpp
示例3:
//------------------------------------------------------------------------------
void mforms::gtk::ToolBarImpl::set_item_checked(mforms::ToolBarItem *item, bool toggled) {
Gtk::ToggleButton *btn = cast<Gtk::ToggleButton *>(item->get_data_ptr());
if (btn) {
btn->set_data("ignore_signal", (void *)1);
btn->set_active(toggled);
btn->set_data("ignore_signal", (void *)0);
}
}
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:9,代码来源:lf_toolbar.cpp
示例4: connect_toggled
void View::connect_toggled(const char *name, const sigc::slot<void, Gtk::ToggleButton *> &slot)
{
Gtk::ToggleButton *button = NULL;
m_builder->get_widget (name, button);
if (button)
button->signal_toggled().connect (sigc::bind(slot, button));
else {
std::cerr << "missing toggle button " << name << "\n";
}
}
开发者ID:earizaa,项目名称:repsnapper,代码行数:10,代码来源:view.cpp
示例5: manage
Gtk::ToggleButton *
ToggleDucksDial::create_label_button(Gtk::IconSize iconsize, const char *stockid,
const char * tooltip)
{
Gtk::ToggleButton *tbutton = manage(new class Gtk::ToggleButton());
Gtk::Image *icon = manage(new Gtk::Image(Gtk::StockID(stockid), iconsize));
tbutton->set_tooltip_text(tooltip);
tbutton->add(*icon);
icon->set_padding(0, 0);
icon->show();
tbutton->set_relief(Gtk::RELIEF_NONE);
tbutton->show();
return tbutton;
}
开发者ID:ZurbaXI,项目名称:synfig,代码行数:15,代码来源:toggleducksdial.cpp
示例6:
/*! \fn Toolbox::add_state(const Smach::state_base *state)
* \brief Add and connect a toogle button to the toolbox defined by a state
* \param state a const pointer to Smach::state_base
*/
void
Toolbox::add_state(const Smach::state_base *state)
{
Gtk::Image *icon;
assert(state);
String name=state->get_name();
Gtk::StockItem stock_item;
Gtk::Stock::lookup(Gtk::StockID("synfig-"+name),stock_item);
Gtk::ToggleButton* button;
button=manage(new class Gtk::ToggleButton());
Gtk::AccelKey key;
//Have a look to global fonction init_ui_manager() from app.cpp for "accel_path" definition
Gtk::AccelMap::lookup_entry ("<Actions>/action_group_state_manager/state-"+name, key);
//Gets the accelerator representation for labels
Glib::ustring accel_path = key.get_abbrev ();
icon=manage(new Gtk::Image(stock_item.get_stock_id(),Gtk::IconSize(4)));
button->add(*icon);
button->set_tooltip_text(stock_item.get_label()+" "+accel_path);
icon->show();
button->show();
int row=state_button_map.size()/5;
int col=state_button_map.size()%5;
tool_table->attach(*button,col,col+1,row,row+1, Gtk::EXPAND, Gtk::EXPAND, 0, 0);
state_button_map[name]=button;
button->signal_clicked().connect(
sigc::bind(
sigc::mem_fun(*this,&studio::Toolbox::change_state_),
state
)
);
refresh();
}
开发者ID:aaronaskew,项目名称:synfig,代码行数:47,代码来源:toolbox.cpp
示例7: add_info_widget
void Torrents_viewport::add_info_widget(const std::string& name, Gtk::Widget& widget_container, Info_widget& widget, Gtk::ToggleButton& button)
{
this->info_widgets.push_back(Info_widget_handle(name, button, widget));
this->torrent_infos_notebook.append_page(widget_container);
this->info_toggle_buttons_hbox.pack_start(button, false, false);
button.signal_toggled().connect(
sigc::bind<Gtk::ToggleButton*>(
sigc::mem_fun(*this, &Torrents_viewport::on_toggle_info_callback),
&button
)
);
}
开发者ID:dxq-git,项目名称:flush,代码行数:13,代码来源:torrents_viewport.cpp
示例8: switch
//------------------------------------------------------------------------------
bool mforms::gtk::ToolBarImpl::create_tool_item(mforms::ToolBarItem *item, ToolBarItemType type) {
Gtk::Widget *w = 0;
switch (type) {
case mforms::TextActionItem:
case mforms::ActionItem:
case mforms::SwitcherItem: {
Gtk::Button *btn = Gtk::manage(new Gtk::Button());
btn->set_focus_on_click(false);
btn->set_border_width(0);
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_clicked().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item));
if (type == mforms::SwitcherItem)
btn->set_always_show_image(true);
w = btn;
break;
}
case mforms::SegmentedToggleItem:
case mforms::ToggleItem: {
Gtk::ToggleButton *btn = Gtk::manage(new Gtk::ToggleButton());
btn->set_focus_on_click(false);
btn->set_relief(Gtk::RELIEF_NONE);
btn->signal_toggled().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), btn, item));
btn->set_inconsistent(false);
w = btn;
break;
}
case mforms::SeparatorItem: {
Gtk::Separator *sep = new Gtk::Separator(Gtk::ORIENTATION_VERTICAL);
w = sep;
break;
}
case mforms::SearchFieldItem: {
#if GTK_VERSION_GE(2, 16)
Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
w = entry;
entry->set_icon_from_stock(Gtk::Stock::FIND);
#else
Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
w = hbox;
Gtk::Image *image = Gtk::manage(new Gtk::Image(Gtk::Stock::FIND, Gtk::ICON_SIZE_MENU));
Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
hbox->pack_start(*image, false, true);
hbox->pack_start(*entry, true, true);
hbox->set_data("entry", entry);
hbox->show_all();
#endif
entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item));
break;
}
case mforms::TextEntryItem: {
Gtk::Box *hbox = Gtk::manage(new Gtk::Box(Gtk::ORIENTATION_HORIZONTAL, 0));
w = hbox;
Gtk::Entry *entry = Gtk::manage(new Gtk::Entry());
hbox->pack_start(*entry, true, true);
hbox->set_data("entry", entry);
hbox->show_all();
entry->signal_activate().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), entry, item));
break;
}
case mforms::FlatSelectorItem:
case mforms::SelectorItem: {
Gtk::ComboBoxText *ct = Gtk::manage(new Gtk::ComboBoxText());
ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item));
w = ct;
break;
}
case mforms::ColorSelectorItem: {
if (!color_combo_columns) {
color_combo_columns = new ColorComboColumns();
}
Gtk::ComboBox *ct = Gtk::manage(new Gtk::ComboBox());
ct->pack_start(color_combo_columns->image);
ct->signal_changed().connect(sigc::bind(sigc::ptr_fun(process_ctrl_action), ct, item));
w = ct;
break;
}
case mforms::ExpanderItem:
case mforms::LabelItem: {
Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5));
w = label;
break;
}
case mforms::ImageBoxItem: {
Gtk::Image *image = Gtk::manage(new Gtk::Image());
w = image;
break;
}
case mforms::TitleItem: {
Gtk::Label *label = Gtk::manage(new Gtk::Label("", 0.0, 0.5));
w = label;
auto provider = Gtk::CssProvider::create();
provider->load_from_data("* { color: #333; font-weight: bold; }");
w->get_style_context()->add_provider(provider, GTK_STYLE_PROVIDER_PRIORITY_USER);
//.........这里部分代码省略.........
开发者ID:pk-codebox-evo,项目名称:mysql-workbench,代码行数:101,代码来源:lf_toolbar.cpp
示例9: onToggleButton
void onToggleButton() {
mVisible = mToggleButton->get_active();
mRenderer->requestDraw();
}
开发者ID:Gastd,项目名称:oh-distro,代码行数:4,代码来源:ViewMetaData.cpp
示例10: addWidgets
bool addWidgets(Gtk::Box* iBox) {
if (mBox != NULL) return false;
mBox = Gtk::manage(new Gtk::VBox());
Gtk::Box* box = Gtk::manage(new Gtk::HBox());
mToggleButton = Gtk::manage(new Gtk::ToggleButton(" "));
Gdk::Color color;
color.set_rgb_p(mAttributes.mColor[0], mAttributes.mColor[1],
mAttributes.mColor[2]);
mToggleButton->modify_bg(Gtk::STATE_ACTIVE, color);
color.set_rgb_p((mAttributes.mColor[0]+1)/2, (mAttributes.mColor[1]+1)/2,
(mAttributes.mColor[2]+1)/2);
mToggleButton->modify_bg(Gtk::STATE_PRELIGHT, color);
color.set_rgb_p(0.8, 0.8, 0.8);
mToggleButton->modify_bg(Gtk::STATE_NORMAL, color);
mToggleButton->signal_toggled().connect
(sigc::mem_fun(*this, &Helper::onToggleButton));
mToggleButton->set_active(true);
box->pack_start(*(mToggleButton), false, false);
Gtk::Label* label = Gtk::manage(new Gtk::Label(mAttributes.mLabel));
box->pack_start(*label, false, false);
if (mViewId != 1) {
Gtk::Button* cancelButton = Gtk::manage(new Gtk::Button("X"));
box->pack_start(*cancelButton, false, false);
cancelButton->signal_clicked().connect
(sigc::mem_fun(*this, &Helper::onRemoveButton));
}
Gtk::Button* button = Gtk::manage(new Gtk::Button("save"));
button->signal_clicked().connect
(sigc::mem_fun(*this, &Helper::onSaveButton));
box->pack_start(*button, false, false);
mBox->pack_start(*box, false, false);
box = Gtk::manage(new Gtk::HBox());
std::vector<int> ids;
std::vector<std::string> labels;
ids = { MeshRenderer::ColorModeFlat, MeshRenderer::ColorModeHeight,
MeshRenderer::ColorModeRange, MeshRenderer::ColorModeNormal,
MeshRenderer::ColorModeCamera };
labels = { "Flat", "Height", "Range", "Normal", "Camera" };
Gtk::ComboBox* combo =
gtkmm::RendererBase::createCombo(mAttributes.mColorMode, labels, ids);
combo->signal_changed().connect([this]{this->mRenderer->requestDraw();});
box->pack_start(*combo, false, false);
ids = { MeshRenderer::MeshModePoints, MeshRenderer::MeshModeWireframe,
MeshRenderer::MeshModeFilled };
labels = { "Points", "Wireframe", "Filled" };
combo =
gtkmm::RendererBase::createCombo(mAttributes.mMeshMode, labels, ids);
combo->signal_changed().connect([this]{this->mRenderer->requestDraw();});
box->pack_start(*combo, false, false);
Gtk::HScale* slider =
gtkmm::RendererBase::createSlider(mAttributes.mPointSize, 0.1, 10, 0.1);
slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
box->pack_start(*slider, true, true);
mBox->pack_start(*box, false, false);
box = Gtk::manage(new Gtk::HBox());
label = Gtk::manage(new Gtk::Label("Z Rng"));
box->pack_start(*label,false,false);
slider = gtkmm::RendererBase::createSlider(mAttributes.mMinZ, -1, 2, 0.01);
slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
box->pack_start(*slider, true, true);
slider = gtkmm::RendererBase::createSlider(mAttributes.mMaxZ, -1, 2, 0.01);
slider->signal_value_changed().connect([this]{this->mRenderer->requestDraw();});
box->pack_start(*slider, true, true);
mBox->pack_start(*box, false, false);
mBox->pack_start(*Gtk::manage(new Gtk::HSeparator()));
mBox->show_all();
iBox->pack_start(*mBox, false, false);
return true;
}
开发者ID:Gastd,项目名称:oh-distro,代码行数:81,代码来源:ViewMetaData.cpp
示例11: setToggleButtonCallback
void setToggleButtonCallback(string b, sigc::slot<void> sig ) {
Gtk::ToggleButton* bu;
VRGuiBuilder()->get_widget(b, bu);
bu->signal_clicked().connect(sig);
}
开发者ID:AntonChalakov,项目名称:polyvr,代码行数:5,代码来源:VRGuiUtils.cpp
示例12: PropertyEditorBase
PropertyEditorBool::PropertyEditorBool(const char * key, Gtk::ToggleButton &button)
: PropertyEditorBase(key, button)
{
m_connection = button.property_active().signal_changed().connect(
sigc::mem_fun(*this, &PropertyEditorBool::on_changed));
}
开发者ID:gfunkmonk2,项目名称:mate-note,代码行数:6,代码来源:propertyeditor.cpp
示例13:
void
StateBrush_Context::refresh_tool_options()
{
brush_buttons.clear();
App::dialog_tool_options->clear();
App::dialog_tool_options->set_local_name(_("Brush Tool"));
App::dialog_tool_options->set_name("brush");
// create container
Gtk::Table *table = Gtk::manage(new Gtk::Table(1, 2, false));
// create options
table->attach(eraser_checkbox, 0, 1, 0, 1, Gtk::FILL, Gtk::SHRINK);
// create brushes container widget
int cols = 4;
Gtk::Table *brushes_table = Gtk::manage(new Gtk::Table(1, cols));
// load brushes
// scan directories
std::set<String> files;
for(std::set<String>::const_iterator i = paths.begin(); i != paths.end(); ++i)
scan_directory(*i, 1, files);
// load files
int col = 0; int row = 0;
Gtk::ToggleButton *first_button = NULL;
Gtk::IconSize iconsize = Gtk::ICON_SIZE_LARGE_TOOLBAR;
for(std::set<String>::const_iterator i = files.begin(); i != files.end(); ++i)
{
if (!brush_buttons.count(*i) && filename_extension(*i) == ".myb")
{
const String &brush_file = *i;
const String icon_file = filename_sans_extension(brush_file) + "_prev.png";
if (files.count(icon_file))
{
// create button
Gtk::ToggleButton *button = brush_buttons[*i] = Gtk::manage(new Gtk::ToggleButton());
Glib::RefPtr<Gdk::Pixbuf> pixbuf, pixbuf_scaled;
pixbuf = Gdk::Pixbuf::create_from_file(icon_file);
pixbuf_scaled = pixbuf->scale_simple(48, 48, Gdk::INTERP_BILINEAR);
button->set_image(*Gtk::manage(new Gtk::Image(pixbuf_scaled)));
button->set_relief(Gtk::RELIEF_NONE);
button->signal_toggled().connect(
sigc::bind(sigc::mem_fun(*this, &StateBrush_Context::select_brush), button, brush_file) );
if (first_button == NULL) first_button = button;
if (col >= cols)
{
// add row
col = 0;
++row;
brushes_table->resize(row + 1, cols);
}
// add button
brushes_table->attach(*button, col, col+1, row, row+1);
++col;
}
}
}
Gtk::ScrolledWindow *brushes_scroll = Gtk::manage(new Gtk::ScrolledWindow());
brushes_scroll->add(*brushes_table);
table->attach(*brushes_scroll, 0, 1, 1, 2);
table->show_all();
App::dialog_tool_options->add(*table);
// select first brush
if (first_button != NULL) first_button->set_active(true);
}
开发者ID:yellow-dee,项目名称:synfig,代码行数:71,代码来源:state_brush.cpp
示例14: proc__
int common___::proc__(std::deque<Glib::ustring>* p,char*buf,long siz,char**addr_ret,void*shangji,void*ce) {
const Glib::ustring& p0=(*p)[0];
if(p0=="剪贴板"){
if(siz==-1)return 1;
Glib::RefPtr<Gtk::Clipboard> cb = Gtk::Clipboard::get();
if(p->size()>1)
cb->set_text((*p)[1].c_str());
else
*addr_ret=dup__(cb->wait_for_text().c_str());
return 1;
}
if(p0=="全屏"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
w->fullscreen();
return 1;
}
if(p0=="取消全屏"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
w->unfullscreen();
return 1;
}
if(p0=="置顶"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
w->set_keep_above(true);
return 1;
}
if(p0=="取消置顶"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
w->set_keep_above(false);
return 1;
}
if(p0=="无边框"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
w->set_decorated(false);
return 1;
}
if(p0=="跳过任务栏"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
w->set_skip_taskbar_hint(true);
return 1;
}
if(p0=="窗口活动"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,1);
if(!w)
return 1;
cpy__(buf,w->property_is_active(),siz);
return 1;
}
if(p0=="图标"){
if(siz==-1)return 1;
Gtk::Window* w=w__(p,2);
if(!w)
return 1;
if(p->size()>1){
const Glib::ustring& p1=(*p)[1];
w->set_icon_name(p1);
Glib::RefPtr<Gdk::Pixbuf> pb=Gdk::Pixbuf::create_from_file(p1);
if(pb)
w->set_icon(pb);
}else
cpy__(buf,w->get_icon_name().c_str(),siz);
return 1;
}
if(p->size()<2){
return 0;
}
const Glib::ustring& p1=(*p)[1];
Gtk::Entry* e;
Gtk::Label* l;
Gtk::Button* b;
Gtk::ToolButton* tb;
Gtk::TextView* tv;
Gtk::Notebook* n;
Gtk::Bin* bI;
Gtk::Widget* w;
Gtk::Statusbar* sB;
Gtk::FileChooserButton* fcb;
Gtk::ToggleButton* tOb;//CheckButton RadioButton
//.........这里部分代码省略.........
开发者ID:zzzzzzzzzzz0,项目名称:zhscript,代码行数:101,代码来源:common___.cpp
示例15: get_layer_curve_gradient_flag
bool get_layer_curve_gradient_flag()const { return layer_curve_gradient_togglebutton.get_active(); }
开发者ID:Permutatrix,项目名称:synfig,代码行数:1,代码来源:state_polygon.cpp
示例16: set_layer_advanced_outline_flag
void set_layer_advanced_outline_flag(bool x) { return layer_advanced_outline_togglebutton.set_active(x); }
开发者ID:Permutatrix,项目名称:synfig,代码行数:1,代码来源:state_polygon.cpp
示例17: get_layer_advanced_outline_flag
bool get_layer_advanced_outline_flag()const { return layer_advanced_outline_togglebutton.get_active(); }
开发者ID:Permutatrix,项目名称:synfig,代码行数:1,代码来源:state_polygon.cpp
示例18: set_layer_region_flag
void set_layer_region_flag(bool x) { return layer_region_togglebutton.set_active(x); }
开发者ID:Permutatrix,项目名称:synfig,代码行数:1,代码来源:state_polygon.cpp
示例19: get_layer_region_flag
bool get_layer_region_flag()const { return layer_region_togglebutton.get_active(); }
开发者ID:Permutatrix,项目名称:synfig,代码行数:1,代码来源:state_polygon.cpp
示例20: set_layer_curve_gradient_flag
void set_layer_curve_gradient_flag(bool x) { return layer_curve_gradient_togglebutton.set_active(x); }
开发者ID:Permutatrix,项目名称:synfig,代码行数:1,代码来源:state_polygon.cpp
注:本文中的gtk::ToggleButton类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论