updated for menuseparator

This commit is contained in:
fluxgen 2004-06-07 22:23:50 +00:00
parent 4fdb621efd
commit 13854c39b5

View file

@ -20,7 +20,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: MenuCreator.cc,v 1.6 2004/06/07 11:46:04 rathnor Exp $ // $Id: MenuCreator.cc,v 1.7 2004/06/07 22:23:50 fluxgen Exp $
#include "MenuCreator.hh" #include "MenuCreator.hh"
@ -46,6 +46,8 @@
#include "FbTk/SimpleCommand.hh" #include "FbTk/SimpleCommand.hh"
#include "FbTk/StringUtil.hh" #include "FbTk/StringUtil.hh"
#include "FbTk/Directory.hh" #include "FbTk/Directory.hh"
#include "FbTk/MenuSeparator.hh"
#include "FbTk/MenuIcon.hh"
#include <iostream> #include <iostream>
using namespace std; using namespace std;
@ -212,14 +214,22 @@ static void translateMenuItem(Parser &parse,
menu.insert(str_label.c_str(), &screen->getWorkspacemenu()); menu.insert(str_label.c_str(), &screen->getWorkspacemenu());
} }
} else if (str_key == "separator") { } else if (str_key == "separator") {
menu.insert("---"); //!! TODO: this will be better in the future menu.insert(new FbTk::MenuSeparator());
} else { // ok, if we didn't find any special menu item we try with command parser }/* else if (str_key == "icon") {
FbTk::RefCount<FbTk::Command> cmd(CommandParser::instance().parseLine(str_cmd));
FbTk::MenuItem *item = new FbTk::MenuIcon(str_label, str_cmd, screen_number);
item->setCommand(cmd);
menu.insert(item);
}*/
else { // ok, if we didn't find any special menu item we try with command parser
// we need to attach command with arguments so command parser can parse it // we need to attach command with arguments so command parser can parse it
string line = str_key + " " + str_cmd; string line = str_key + " " + str_cmd;
FbTk::RefCount<FbTk::Command> command(CommandParser::instance().parseLine(line)); FbTk::RefCount<FbTk::Command> command(CommandParser::instance().parseLine(line));
if (*command != 0) if (*command != 0)
menu.insert(str_label.c_str(), command); menu.insert(str_label.c_str(), command);
} }
} }
@ -402,7 +412,7 @@ bool MenuCreator::createWindowMenuItem(const std::string &type,
} else if (type == "separator") { } else if (type == "separator") {
menu.insert("---"); menu.insert(new FbTk::MenuSeparator());
} else } else
return false; return false;