本文整理汇总了C++中gtk::Label::set_vexpand方法的典型用法代码示例。如果您正苦于以下问题:C++ Label::set_vexpand方法的具体用法?C++ Label::set_vexpand怎么用?C++ Label::set_vexpand使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gtk::Label
的用法示例。
在下文中一共展示了Label::set_vexpand方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Window
Window() : canvas(), checkbutton1("Plot 1"),
checkbutton2("Plot 2"), checkbutton3("Plot 3"),
label_x("X:"),
label_y("Y:") {
set_default_size(720, 580);
Gdk::Geometry geometry;
geometry.min_aspect = geometry.max_aspect = double(720)/double(580);
set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT);
set_title("Gtkmm-PLplot test4");
canvas.set_hexpand(true);
canvas.set_vexpand(true);
canvas.set_background_color(Gdk::RGBA("Light Gray"));
grid.set_column_homogeneous(true);
checkbutton1.set_vexpand(false);
checkbutton1.set_hexpand(false);
checkbutton1.set_halign(Gtk::ALIGN_CENTER);
checkbutton2.set_vexpand(false);
checkbutton2.set_hexpand(false);
checkbutton2.set_halign(Gtk::ALIGN_CENTER);
checkbutton3.set_vexpand(false);
checkbutton3.set_hexpand(false);
checkbutton3.set_halign(Gtk::ALIGN_CENTER);
std::valarray<double> x_va = Gtk::PLplot::indgen_va(1000)/50.0 - 10.0;
std::valarray<double> y_va1 = sinh(x_va);
std::valarray<double> y_va2 = cosh(x_va);
std::valarray<double> y_va3 = tanh(x_va);
//generate the data, the plot, add them to the canvas and use the return value to pass it to the checkbutton
Gtk::PLplot::Plot2D *plot1 = Gtk::manage(
new Gtk::PLplot::Plot2D(
*Gtk::manage(
new Gtk::PLplot::PlotData2D(
x_va,
y_va1,
Gdk::RGBA("blue"),
Gtk::PLplot::LineStyle::CONTINUOUS,
3.0
)
),
"X-axis",
"Y-axis",
"Hyperbolic sine",
0.5,
0.5,
0.0,
0.0
)
);
canvas.add_plot(*plot1);
checkbutton1.connect_plot(plot1);
Gtk::PLplot::Plot2D *plot2 = Gtk::manage(
new Gtk::PLplot::Plot2D(
*Gtk::manage(
new Gtk::PLplot::PlotData2D(
x_va,
y_va2,
Gdk::RGBA("red"),
Gtk::PLplot::LineStyle::CONTINUOUS,
3.0
)
),
"X-axis",
"Y-axis",
"Hyperbolic cosine",
0.5,
0.5,
0.5,
0.0
)
);
canvas.add_plot(*plot2);
checkbutton2.connect_plot(plot2);
Gtk::PLplot::Plot2D *plot3 = Gtk::manage(
new Gtk::PLplot::Plot2D(
*Gtk::manage(
new Gtk::PLplot::PlotData2D(
x_va,
y_va3,
Gdk::RGBA("green"),
Gtk::PLplot::LineStyle::CONTINUOUS,
3.0
)
),
"X-axis",
"Y-axis",
"Hyperbolic tangent",
0.4,
0.4,
0.2,
0.55
)
);
canvas.add_plot(*plot3);
checkbutton3.connect_plot(plot3);
checkbutton1.set_active();
checkbutton2.set_active(false);
//.........这里部分代码省略.........
示例2: Window
Window() :
show_edges_label("Show edges"),
show_labels_label("Show contour labels"),
edge_color_label("Contour edge color"),
edge_color(Gdk::RGBA("Red")),
edge_width_label("Contour edge width"),
edge_width_adj(Gtk::Adjustment::create(1.0, 0.1, 10.0, 0.1, 1.0, 0.0)),
edge_width_spin(edge_width_adj, 0.1, 1),
nlevels_label("Number of contour edges"),
nlevels_adj(Gtk::Adjustment::create(7, 3, 20, 1, 5)),
nlevels_spin(nlevels_adj, 1, 0),
colormap_palette_label("Colormap palette"),
area_fill_pattern_label("Fill pattern"),
area_lines_width_label("Fill pattern width"),
area_lines_width_adj(Gtk::Adjustment::create(1.0, 0.1, 10.0, 0.1, 1.0, 0.0)),
area_lines_width_spin(area_lines_width_adj, 0.1, 1),
colorbar_label("Show colorbar"),
paned(Gtk::ORIENTATION_VERTICAL),
aspect_frame(Glib::ustring(), Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER, 1.5, false)
{
Glib::ustring x_title = "X-axis";
Glib::ustring y_title = "Y-axis";
Glib::ustring plot_title = "Intensity vs detector position";
// general window and canvas settings
set_default_size(720, 720);
Gdk::Geometry geometry;
geometry.min_aspect = geometry.max_aspect = double(720)/double(720);
set_geometry_hints(*this, geometry, Gdk::HINT_ASPECT);
set_title("Gtkmm-PLplot test8");
canvas.set_hexpand(true);
canvas.set_vexpand(true);
//read in our dataset
std::ifstream fs;
fs.exceptions(std::ifstream::failbit | std::ifstream::badbit | std::ifstream::eofbit);
// 11 x 11 dataset (I know the file layout and the data dimensions already)
const int nx = 11;
const int ny = 11;
std::vector<double> x(nx);
std::vector<double> y(ny);
#ifdef GTKMM_PLPLOT_BOOST_ENABLED
boost::multi_array<double, 2> z(boost::extents[nx][ny]);
std::cout << "Using Boost multi_array!" << std::endl;
#else
double **z = Gtk::PLplot::calloc_array2d(nx, ny);
#endif
fs.open(TEST_CSV);
std::string line;
std::getline(fs, line);
gchar **splitted = g_strsplit(line.c_str(), ",", 0);
//first line contains the x values
for (int i = 1 ; i < nx + 1 ; i++) {
x[i-1] = g_ascii_strtod(splitted[i], NULL);
}
g_strfreev(splitted);
for (int i = 0 ; i < ny ; i++) {
line.clear();
std::getline(fs, line);
splitted = g_strsplit(line.c_str(), ",", 0);
y[i] = g_ascii_strtod(splitted[0], NULL);
for (int j = 1 ; j < nx + 1 ; j++) {
z[j-1][i] = g_ascii_strtod(splitted[j], NULL);
}
g_strfreev(splitted);
}
//construct the plot
auto plot = Gtk::manage(new Gtk::PLplot::PlotContourShades(
*Gtk::manage(new Gtk::PLplot::PlotDataSurface(
x,
y,
z
)),
x_title,
y_title,
plot_title,
7,
Gtk::PLplot::ColormapPalette::BLUE_RED,
edge_color.get_rgba(),
1.0
));
canvas.add_plot(*plot);
plot->set_background_color(Gdk::RGBA("Yellow Green"));
//now let's set up the grid
grid.set_column_homogeneous(true);
grid.set_column_spacing(5);
grid.set_row_homogeneous(false);
grid.set_row_spacing(5);
int row_counter = 0;
//.........这里部分代码省略.........