added visual enable thing for style menus so one can see which style is currently selected
This commit is contained in:
parent
ef72b1d7fc
commit
d919892957
1 changed files with 26 additions and 16 deletions
|
@ -22,7 +22,7 @@
|
||||||
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||||
// DEALINGS IN THE SOFTWARE.
|
// DEALINGS IN THE SOFTWARE.
|
||||||
|
|
||||||
// $Id: Screen.cc,v 1.199 2003/07/01 12:39:09 fluxgen Exp $
|
// $Id: Screen.cc,v 1.200 2003/07/03 13:57:58 fluxgen Exp $
|
||||||
|
|
||||||
|
|
||||||
#include "Screen.hh"
|
#include "Screen.hh"
|
||||||
|
@ -178,6 +178,25 @@ private:
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
|
class StyleMenuItem: public FbTk::MenuItem {
|
||||||
|
public:
|
||||||
|
StyleMenuItem(const std::string &label, const std::string &filename):FbTk::MenuItem(label.c_str()),
|
||||||
|
m_filename(FbTk::StringUtil::
|
||||||
|
expandFilename(filename)) {
|
||||||
|
// perform shell style ~ home directory expansion
|
||||||
|
// and insert style
|
||||||
|
FbTk::RefCount<FbTk::Command>
|
||||||
|
setstyle_cmd(new FbCommands::
|
||||||
|
SetStyleCmd(m_filename));
|
||||||
|
setCommand(setstyle_cmd);
|
||||||
|
}
|
||||||
|
bool isSelected() const {
|
||||||
|
return Fluxbox::instance()->getStyleFilename() == m_filename;
|
||||||
|
}
|
||||||
|
private:
|
||||||
|
const std::string m_filename;
|
||||||
|
};
|
||||||
|
|
||||||
class AddWorkspaceCmd:public FbTk::Command {
|
class AddWorkspaceCmd:public FbTk::Command {
|
||||||
public:
|
public:
|
||||||
explicit AddWorkspaceCmd(BScreen &scrn):m_screen(scrn) { }
|
explicit AddWorkspaceCmd(BScreen &scrn):m_screen(scrn) { }
|
||||||
|
@ -1745,21 +1764,13 @@ bool BScreen::parseMenuFile(ifstream &file, FbTk::Menu &menu, int &row) {
|
||||||
if (!( str_label.size() && str_cmd.size())) {
|
if (!( str_label.size() && str_cmd.size())) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
i18n->
|
i18n->
|
||||||
getMessage(
|
getMessage(FBNLS::ScreenSet, FBNLS::ScreenSTYLEError,
|
||||||
FBNLS::ScreenSet, FBNLS::ScreenSTYLEError,
|
|
||||||
"BScreen::parseMenuFile: [style] error, "
|
"BScreen::parseMenuFile: [style] error, "
|
||||||
"no menu label and/or filename defined\n"));
|
"no menu label and/or filename defined\n"));
|
||||||
cerr<<"Row: "<<row<<endl;
|
cerr<<"Row: "<<row<<endl;
|
||||||
} else {
|
} else
|
||||||
// perform shell style ~ home directory expansion
|
menu.insert(new StyleMenuItem(str_label, str_cmd));
|
||||||
// and insert style
|
|
||||||
FbTk::RefCount<FbTk::Command>
|
|
||||||
setstyle_cmd(new FbCommands::
|
|
||||||
SetStyleCmd(FbTk::StringUtil::
|
|
||||||
expandFilename(str_cmd)));
|
|
||||||
menu.insert(str_label.c_str(), setstyle_cmd);
|
|
||||||
|
|
||||||
}
|
|
||||||
} else if (str_key == "config") {
|
} else if (str_key == "config") {
|
||||||
if (! str_label.size()) {
|
if (! str_label.size()) {
|
||||||
fprintf(stderr,
|
fprintf(stderr,
|
||||||
|
@ -2055,9 +2066,8 @@ void BScreen::createStyleMenu(FbTk::Menu &menu,
|
||||||
strncpy(style + slen + 1, filelist[file_index].c_str(), nlen + 1);
|
strncpy(style + slen + 1, filelist[file_index].c_str(), nlen + 1);
|
||||||
|
|
||||||
if ( !stat(style, &statbuf) && S_ISREG(statbuf.st_mode)) {
|
if ( !stat(style, &statbuf) && S_ISREG(statbuf.st_mode)) {
|
||||||
FbTk::RefCount<FbTk::Command> setstyle_cmd(new FbCommands::
|
FbTk::MenuItem *item = new StyleMenuItem(filelist[file_index], style);
|
||||||
SetStyleCmd(style));
|
menu.insert(item);
|
||||||
menu.insert(filelist[file_index].c_str(), setstyle_cmd);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// update menu graphics
|
// update menu graphics
|
||||||
|
|
Loading…
Reference in a new issue