aboutsummaryrefslogtreecommitdiff
path: root/src/CurrentWindowCmd.cc
diff options
context:
space:
mode:
authorMark Tiefenbruck <mark@fluxbox.org>2008-08-17 11:10:17 (GMT)
committerMark Tiefenbruck <mark@fluxbox.org>2008-08-17 11:10:17 (GMT)
commita23778a44d2469fdc414884f5fe72fde09c100cc (patch)
treedcff8778bef2f70fb1112f60f6de290a0aebe777 /src/CurrentWindowCmd.cc
parent72fd5e03a48396e6feec86534d266c68a9edd915 (diff)
downloadfluxbox-a23778a44d2469fdc414884f5fe72fde09c100cc.zip
fluxbox-a23778a44d2469fdc414884f5fe72fde09c100cc.tar.bz2
add SetTitle and SetTitleDialog key commands
Diffstat (limited to 'src/CurrentWindowCmd.cc')
-rw-r--r--src/CurrentWindowCmd.cc37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/CurrentWindowCmd.cc b/src/CurrentWindowCmd.cc
index 65c5711..f8c7b4b 100644
--- a/src/CurrentWindowCmd.cc
+++ b/src/CurrentWindowCmd.cc
@@ -27,10 +27,12 @@
27#include "Window.hh" 27#include "Window.hh"
28#include "WindowCmd.hh" 28#include "WindowCmd.hh"
29#include "Screen.hh" 29#include "Screen.hh"
30#include "TextDialog.hh"
30#include "WinClient.hh" 31#include "WinClient.hh"
31 32
32#include "FocusControl.hh" 33#include "FocusControl.hh"
33#include "FbTk/CommandParser.hh" 34#include "FbTk/CommandParser.hh"
35#include "FbTk/I18n.hh"
34#include "FbTk/stringstream.hh" 36#include "FbTk/stringstream.hh"
35#include "FbTk/StringUtil.hh" 37#include "FbTk/StringUtil.hh"
36 38
@@ -483,7 +485,6 @@ void ResizeToCmd::real_execute() {
483 485
484REGISTER_COMMAND(fullscreen, FullscreenCmd, void); 486REGISTER_COMMAND(fullscreen, FullscreenCmd, void);
485 487
486FullscreenCmd::FullscreenCmd() { }
487void FullscreenCmd::real_execute() { 488void FullscreenCmd::real_execute() {
488 fbwindow().setFullscreen(!fbwindow().isFullscreen()); 489 fbwindow().setFullscreen(!fbwindow().isFullscreen());
489} 490}
@@ -500,6 +501,40 @@ void SetLayerCmd::real_execute() {
500 fbwindow().moveToLayer(m_layer); 501 fbwindow().moveToLayer(m_layer);
501} 502}
502 503
504namespace {
505class SetTitleDialog: public TextDialog {
506public:
507 SetTitleDialog(FluxboxWindow &win, const string &title):
508 TextDialog(win.screen(), title), window(win) {
509 setText(win.title());
510 }
511
512private:
513 void exec(const std::string &text) {
514 window.winClient().setTitle(text);
515 }
516
517 FluxboxWindow &window;
518};
519} // end anonymous namespace
520
521REGISTER_COMMAND(settitledialog, SetTitleDialogCmd, void);
522
523void SetTitleDialogCmd::real_execute() {
524 _FB_USES_NLS;
525
526 SetTitleDialog *win = new SetTitleDialog(fbwindow(),
527 _FB_XTEXT(Windowmenu, SetTitle, "Set Title",
528 "Change the title of the window"));
529 win->show();
530}
531
532REGISTER_COMMAND_WITH_ARGS(settitle, SetTitleCmd, void);
533
534void SetTitleCmd::real_execute() {
535 fbwindow().winClient().setTitle(title);
536}
537
503FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args, 538FbTk::Command<void> *SetAlphaCmd::parse(const string &command, const string &args,
504 bool trusted) { 539 bool trusted) {
505 typedef std::vector<string> StringTokens; 540 typedef std::vector<string> StringTokens;