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


C++ Label::set_margin_left方法代码示例

本文整理汇总了C++中gtk::Label::set_margin_left方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::set_margin_left方法的具体用法?C++ Label::set_margin_left怎么用?C++ Label::set_margin_left使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gtk::Label的用法示例。


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

示例1: populate_results

void AwesomeBar::populate_results(const std::vector<unicode>& to_add) {
    Pango::FontDescription desc("sans-serif 12");

    displayed_files_.clear();
    for(auto file: to_add) {
        auto to_display = file.slice(window_.project_path().length() + 1, nullptr);
        Gtk::Label* label = Gtk::manage(new Gtk::Label(to_display.encode()));
        label->set_margin_top(10);
        label->set_margin_bottom(10);
        label->set_margin_left(10);
        label->set_margin_right(10);
        label->set_alignment(0, 0.5);
        label->set_hexpand(false);
        label->set_line_wrap_mode(Pango::WRAP_CHAR);
        label->set_ellipsize(Pango::ELLIPSIZE_MIDDLE);
        label->set_line_wrap(true);
        label->override_font(desc);
        list_.append(*label);
        displayed_files_.push_back(file);
    }

    list_.show_all();
    if(!list_.get_children().empty()) {
        list_revealer_.set_reveal_child(true);
        about_to_focus = true;
        list_.select_row(*list_.get_row_at_index(0));
    }
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例2: GRadioColorGroup

    Gtk::Grid *SmartChessWindow::createSuboptionsArea() {
        const int SUBOPTIONS_ROWS = 3;
        const int SUBOPTIONS_COLS = 3;
        const int MARGIN = 1;

        mSubOptionsGrid = Gtk::manage(new Gtk::Grid());
        mSubOptionsGrid->set_vexpand();
        mSubOptionsGrid->set_hexpand(false);
        mSubOptionsGrid->set_column_homogeneous(true);
        mSubOptionsGrid->insert_column(0);

        for(auto i : IntRange(SUBOPTIONS_COLS))
            mSubOptionsGrid->insert_column(i);

        for(auto i : IntRange(SUBOPTIONS_ROWS))
            mSubOptionsGrid->insert_row(i);

        Gtk::Label* p1 = Gtk::manage(new Gtk::Label("Player 1"));
        p1->set_margin_left(MARGIN);
        p1->set_margin_right(MARGIN);
        mSubOptionsGrid->attach(*p1, 0, 0, 1, 1);

        Gtk::Label* vs = Gtk::manage(new Gtk::Label("V.S."));
        vs->set_margin_left(MARGIN);
        vs->set_margin_right(MARGIN);
        mSubOptionsGrid->attach(*vs, 1, 0, 1, 1);

        Gtk::Label* p2 = Gtk::manage(new Gtk::Label("Player 2"));
        p2->set_margin_left(MARGIN);
        p2->set_margin_right(MARGIN);
        mSubOptionsGrid->attach(*p2, 2, 0, 1, 1);

        mCbt1 = Gtk::manage(new Gtk::ComboBoxText());
        mCbt1->append("Human");
        mCbt1->append("A.I.");
        mCbt1->set_active(0);
        mSubOptionsGrid->attach(*mCbt1, 0, 1, 1, 1);

        mCbt2 = Gtk::manage(new Gtk::ComboBoxText());
        mCbt2->append("Human");
        mCbt2->append("A.I.");
        mCbt2->set_active(1);
        mSubOptionsGrid->attach(*mCbt2, 2, 1, 1, 1);

        rcg1 = Gtk::manage(new GRadioColorGroup());
        mSubOptionsGrid->attach(*rcg1, 0, 2, 1, 1);

        rcg2 = Gtk::manage(new GRadioColorGroup());
        mSubOptionsGrid->attach(*rcg2, 2, 2, 1, 1);

        rcg1->signalClickedWhite().connect(sigc::mem_fun(rcg2, &GRadioColorGroup::setBlack));
        rcg1->signalClickedBlack().connect(sigc::mem_fun(rcg2, &GRadioColorGroup::setWhite));
        rcg2->signalClickedWhite().connect(sigc::mem_fun(rcg1, &GRadioColorGroup::setBlack));
        rcg2->signalClickedBlack().connect(sigc::mem_fun(rcg1, &GRadioColorGroup::setWhite));
        rcg1->setWhite();
        rcg2->setBlack();
        return mSubOptionsGrid;
    }
开发者ID:elfus,项目名称:smart-chess,代码行数:58,代码来源:SmartChessWindow.cpp


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