[gtkmm-documentation] Label and ProgressBar examples: Fix text. Fix orientation of a Box.
- From: Kjell Ahlstedt <kjellahl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtkmm-documentation] Label and ProgressBar examples: Fix text. Fix orientation of a Box.
- Date: Wed, 7 Sep 2011 08:27:24 +0000 (UTC)
commit 5558330ab04738a17f8f60bb38d58a3478db648e
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date: Wed Sep 7 10:10:54 2011 +0200
Label and ProgressBar examples: Fix text. Fix orientation of a Box.
* examples/book/label/examplewindow.cc: Fix the orientation of m_VBox2.
Correct the text in the right-justified frame. Remove unneccessary
backslashes.
* examples/book/progressbar/examplewindow.[h|cc]: Use
ProgressBar::set_show_text() to control the text (new in gtkmm 3.0).
Rename on_checkbutton_orientation() to on_checkbutton_inverted().
Correct some comments. Bug #658265.
ChangeLog | 12 ++++++++
examples/book/label/examplewindow.cc | 40 ++++++++++++++--------------
examples/book/progressbar/examplewindow.cc | 18 +++++-------
examples/book/progressbar/examplewindow.h | 2 +-
4 files changed, 41 insertions(+), 31 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 6b17f8a..8e75d82 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2011-09-07 Kjell Ahlstedt <kjell ahlstedt bredband net>
+
+ Label and ProgressBar examples: Fix text. Fix orientation of a Box.
+
+ * examples/book/label/examplewindow.cc: Fix the orientation of m_VBox2.
+ Correct the text in the right-justified frame. Remove unneccessary
+ backslashes.
+ * examples/book/progressbar/examplewindow.[h|cc]: Use
+ ProgressBar::set_show_text() to control the text (new in gtkmm 3.0).
+ Rename on_checkbutton_orientation() to on_checkbutton_inverted().
+ Correct some comments. Bug #658265.
+
2011-09-06 Kjell Ahlstedt <kjell ahlstedt bredband net>
Range Widgets example: Fix size and orientation of widgets.
diff --git a/examples/book/label/examplewindow.cc b/examples/book/label/examplewindow.cc
index 44d62f3..a1e7e4f 100644
--- a/examples/book/label/examplewindow.cc
+++ b/examples/book/label/examplewindow.cc
@@ -23,6 +23,7 @@ ExampleWindow::ExampleWindow()
:
m_HBox(Gtk::ORIENTATION_HORIZONTAL, 5),
m_VBox(Gtk::ORIENTATION_VERTICAL, 5),
+ m_VBox2(Gtk::ORIENTATION_VERTICAL, 5),
m_Frame_Normal("Normal Label"),
m_Frame_Multi("Multi-line Label"),
m_Frame_Left("Left Justified Label"),
@@ -33,8 +34,7 @@ ExampleWindow::ExampleWindow()
m_Label_Normal("_This is a Normal label", true),
m_Label_Multi("This is a Multi-line label.\nSecond line\nThird line"),
m_Label_Left("This is a Left-Justified\nMulti-line label.\nThird line"),
- m_Label_Right("This is a Right-Justified\n"
- "Multi-line label.\nFourth line, (j/k)"),
+ m_Label_Right("This is a Right-Justified\nMulti-line label.\nThird line"),
m_Label_Underlined("This label is underlined!\n"
"This one is underlined in quite a funky fashion")
{
@@ -62,31 +62,31 @@ ExampleWindow::ExampleWindow()
m_HBox.pack_start(m_VBox2, Gtk::PACK_SHRINK);
m_Label_LineWrapped.set_text(
- "This is an example of a line-wrapped label. It " \
- /* add a big space to the next line to test spacing */ \
+ "This is an example of a line-wrapped label. It "
+ /* add a big space to the next line to test spacing */
"should not be taking up the entire "
- "width allocated to it, but automatically " \
- "wraps the words to fit. " \
- "The time has come, for all good men, to come to " \
- "the aid of their party. " \
- "The sixth sheik's six sheep's sick.\n" \
- " It supports multiple paragraphs correctly, " \
- "and correctly adds " \
+ "width allocated to it, but automatically "
+ "wraps the words to fit. "
+ "The time has come, for all good men, to come to "
+ "the aid of their party. "
+ "The sixth sheik's six sheep's sick.\n"
+ " It supports multiple paragraphs correctly, "
+ "and correctly adds "
"many extra spaces. ");
m_Label_LineWrapped.set_line_wrap();
m_Frame_LineWrapped.add(m_Label_LineWrapped);
m_VBox2.pack_start(m_Frame_LineWrapped, Gtk::PACK_SHRINK);
m_Label_FilledWrapped.set_text(
- "This is an example of a line-wrapped, filled label. " \
- "It should be taking " \
- "up the entire width allocated to it. " \
- "Here is a sentence to prove " \
- "my point. Here is another sentence. " \
- "Here comes the sun, do de do de do.\n" \
- " This is a new paragraph.\n" \
- " This is another newer, longer, better " \
- "paragraph. It is coming to an end, " \
+ "This is an example of a line-wrapped, filled label. "
+ "It should be taking "
+ "up the entire width allocated to it. "
+ "Here is a sentence to prove "
+ "my point. Here is another sentence. "
+ "Here comes the sun, do de do de do.\n"
+ " This is a new paragraph.\n"
+ " This is another newer, longer, better "
+ "paragraph. It is coming to an end, "
"unfortunately.");
m_Label_FilledWrapped.set_justify(Gtk::JUSTIFY_FILL);
m_Label_FilledWrapped.set_line_wrap();
diff --git a/examples/book/progressbar/examplewindow.cc b/examples/book/progressbar/examplewindow.cc
index fd4fb1f..028b8c4 100644
--- a/examples/book/progressbar/examplewindow.cc
+++ b/examples/book/progressbar/examplewindow.cc
@@ -37,6 +37,8 @@ ExampleWindow::ExampleWindow()
m_VBox.pack_start(m_Alignment, Gtk::PACK_SHRINK, 5);
m_Alignment.add(m_ProgressBar);
+ m_ProgressBar.set_text("some text");
+ m_ProgressBar.set_show_text(false);
//Add a timer callback to update the value of the progress bar:
m_connection_id_timeout = Glib::signal_timeout().connect(sigc::mem_fun(*this,
@@ -51,17 +53,17 @@ ExampleWindow::ExampleWindow()
m_CheckButton_Text.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_text) );
- //Add a check button to select displaying of the trough text:
+ //Add a check button to toggle activity mode:
m_Table.attach(m_CheckButton_Activity, 0, 1, 1, 2, Gtk::EXPAND | Gtk::FILL,
Gtk::EXPAND | Gtk::FILL, 5, 5);
m_CheckButton_Activity.signal_clicked().connect(sigc::mem_fun(*this,
&ExampleWindow::on_checkbutton_activity) );
- //Add a check button to toggle activity mode:
+ //Add a check button to select growth from left to right or from right to left:
m_Table.attach(m_CheckButton_Inverted, 0, 1, 2, 3, Gtk::EXPAND | Gtk::FILL,
Gtk::EXPAND | Gtk::FILL, 5, 5);
m_CheckButton_Inverted.signal_clicked().connect(sigc::mem_fun(*this,
- &ExampleWindow::on_checkbutton_orientation) );
+ &ExampleWindow::on_checkbutton_inverted) );
//Add a button to exit the program.
m_VBox.pack_start(m_Button_Close, Gtk::PACK_SHRINK);
@@ -79,12 +81,8 @@ ExampleWindow::~ExampleWindow()
void ExampleWindow::on_checkbutton_text()
{
- const Glib::ustring text = m_ProgressBar.get_text();
-
- if(!text.empty())
- m_ProgressBar.set_text("");
- else
- m_ProgressBar.set_text("some text");
+ const bool show_text = m_CheckButton_Text.get_active();
+ m_ProgressBar.set_show_text(show_text);
}
void ExampleWindow::on_checkbutton_activity()
@@ -97,7 +95,7 @@ void ExampleWindow::on_checkbutton_activity()
m_ProgressBar.set_fraction(0.0);
}
-void ExampleWindow::on_checkbutton_orientation()
+void ExampleWindow::on_checkbutton_inverted()
{
const bool inverted = m_CheckButton_Inverted.get_active();
m_ProgressBar.set_inverted(inverted);
diff --git a/examples/book/progressbar/examplewindow.h b/examples/book/progressbar/examplewindow.h
index 6145eae..6f20526 100644
--- a/examples/book/progressbar/examplewindow.h
+++ b/examples/book/progressbar/examplewindow.h
@@ -31,7 +31,7 @@ protected:
//Signal handlers:
void on_checkbutton_text();
void on_checkbutton_activity();
- void on_checkbutton_orientation();
+ void on_checkbutton_inverted();
virtual bool on_timeout();
void on_button_close();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]