本文整理汇总了C++中Fl_Double_Window::add方法的典型用法代码示例。如果您正苦于以下问题:C++ Fl_Double_Window::add方法的具体用法?C++ Fl_Double_Window::add怎么用?C++ Fl_Double_Window::add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Fl_Double_Window
的用法示例。
在下文中一共展示了Fl_Double_Window::add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: LoadPlugins
void SynthModular::LoadPlugins (string pluginPath) {
int Width = 35;
int Height = 35;
int SWidth = 256;
int SHeight = 256;
Fl_Pixmap pic (SSM_xpm);
Fl_Double_Window* Splash = new Fl_Double_Window ((Fl::w()/2) - (SWidth/2), (Fl::h()/2) - (SHeight/2),
SWidth, SHeight, "SSM");
Splash->border(0);
Fl_Box* pbut = new Fl_Box (0, 8, SWidth, SHeight, "");
pbut->box (FL_NO_BOX);
pic.label (pbut);
Fl_Box *splashtext = new Fl_Box (5, SHeight-20, 200, 20, "Loading...");
splashtext->labelsize (10);
splashtext->box (FL_NO_BOX);
splashtext->align (FL_ALIGN_INSIDE | FL_ALIGN_LEFT);
Splash->add (pbut);
Splash->add (splashtext);
Splash->show();
int ID=-1;
vector<string> PluginVector;
if (SpiralInfo::USEPLUGINLIST) PluginVector = SpiralInfo::PLUGINVEC;
else {
if (pluginPath.empty()) PluginVector = BuildPluginList (SpiralInfo::PLUGIN_PATH);
else {
string::iterator i = pluginPath.end() - 1;
if (*i != '/') pluginPath += '/';
PluginVector = BuildPluginList (pluginPath);
}
}
for (vector<string>::iterator i=PluginVector.begin(); i!=PluginVector.end(); i++) {
string Fullpath;
if (pluginPath=="") Fullpath=SpiralInfo::PLUGIN_PATH+*i;
else Fullpath = pluginPath + *"/" + *i;
ID = PluginManager::Get()->LoadPlugin (Fullpath.c_str());
if (ID!=PluginError) {
#ifdef DEBUG_PLUGINS
cerr << ID << " = Plugin [" << *i << "]" << endl;
#endif
Fl_ToolButton *NewButton = new Fl_ToolButton (0, 0, Width, Height, "");
// we can't set user data, because the callback uses it
// NewButton->user_data ((void*)(this));
NewButton->labelsize (1);
Fl_Pixmap *tPix = new Fl_Pixmap (PluginManager::Get()->GetPlugin(ID)->GetIcon());
NewButton->image(tPix->copy(tPix->w(),tPix->h()));
delete tPix;
const char * gName = PluginManager::Get()->GetPlugin(ID)->GetGroupName();
string GroupName(gName);
Fl_Pack* the_group=NULL;
// find or create this group, and add an icon
map<string,Fl_Pack*>::iterator gi = m_PluginGroupMap.find (GroupName);
if (gi == m_PluginGroupMap.end()) {
the_group = new Fl_Pack (m_GroupTab->x(), 16, m_GroupTab->w(), m_GroupTab->h() - 15, gName);
the_group->type(FL_HORIZONTAL);
the_group->labelsize(8);
the_group->color(SpiralInfo::GUICOL_Button);
the_group->user_data((void*)(this));
//m_GroupTab->add(the_group);
m_GroupTab->value(the_group);
m_PluginGroupMap[GroupName]=the_group;
}
else the_group = gi->second;
NewButton->type (0);
NewButton->box (FL_NO_BOX);
NewButton->down_box (FL_NO_BOX);
//NewButton->color(SpiralInfo::GUICOL_Button);
//NewButton->selection_color(SpiralInfo::GUICOL_Button);
the_group->add (NewButton);
// we need to keep tooltips stored outside their widgets - widgets just have a pointer
// I haven't done anything about cleaning up these strings - which may cause memory leaks?
// But m_DeviceVec - which, I assume, would be used to keep track of / clean up the dynamicly
// created NewButton widgets isn't cleaned up either, so we might have 2 memory leaks
// involved? - but then again, they might be automatically deallocated because they're
// in another widget, in which case there's just one memory leak to deal with. (andy)
string* PluginName = new string (*i);
// find the first slash, if there is one, and get rid of everything before and including it
unsigned int p = PluginName->find ('/');
if (p < PluginName->length()) PluginName->erase (0, p);
// find last . and get rid of everything after and including it
p = PluginName->rfind ('.');
unsigned int l = PluginName->length ();
if (p < l) PluginName->erase (p, l);
NewButton->tooltip (PluginName->c_str());
// Slashes have significance to the menu widgets, remove them from the GroupName
while ((p = GroupName.find ('/')) < PluginName->length())
GroupName = GroupName.replace (p, 1, " and ");
string MenuEntry = "Plugins/" + GroupName + "/" + *PluginName;
m_MainMenu->add (MenuEntry.c_str(), 0, cb_NewDeviceFromMenu, &Numbers[ID], 0);
// when help is working better - this will put the plugins into the help menu
// MenuEntry = "Help/" + MenuEntry;
// m_MainMenu->add (MenuEntry.c_str(), 0, NULL, &Numbers[ID], 0);
// Add the plugins to the canvas menu
m_Canvas->AddPluginName (MenuEntry, PluginManager::Get()->GetPlugin(ID)->ID);
// this overwrites the widget's user_data with that specified for the callback
// so we can't use it for other purposes
NewButton->callback ((Fl_Callback*)cb_NewDevice, &Numbers[ID]);
NewButton->show();
// Nothing else ever touches m_DeviceVec - is this right??? (andy)
//.........这里部分代码省略.........