int PanelMatrix::AddPanel(std::string config) { int output = 0; int chain = 0; int xOffset = 0; int yOffset = 0; char orientation = 'N'; std::vector<std::string> elems = split(config, ':'); if (elems.size() == 5) { output = atoi(elems[0].c_str()); chain = atoi(elems[1].c_str()); xOffset = atoi(elems[3].c_str()); yOffset = atoi(elems[4].c_str()); if (elems[2].size()) orientation = elems[2].c_str()[0]; } else { LogErr(VB_CHANNELOUT, "Invalid Panel Config: '%s'\n", config.c_str()); return 0; } return AddPanel(output, chain, orientation, xOffset, yOffset); }
BOOL Hotlist::AddItem(OpTreeModel* model, INT32 model_pos) { OpTreeModelItem* model_item = model->GetItemByPosition(model_pos); HotlistModelItem* hmi = HotlistModel::GetItemByType(model_item); if( !hmi->GetInPanel() || hmi->GetIsInsideTrashFolder() ) { return FALSE; } INT32 panel_position = hmi->GetPanelPos(); if( panel_position == -1 ) { // This will keep the two lists in sync. I have observed focus problems // when this sync'ing was not done [espen 2003-03-29] panel_position = GetPanelCount(); g_hotlist_manager->SetPanelPosition( model_item->GetID(), panel_position, FALSE ); } // Create a WebPanel with ID equal to the model item ID WebPanel *new_panel = OP_NEW(WebPanel, ( hmi->GetUrl().CStr(), model_item->GetID(), hmi->GetUniqueGUID().CStr())); if (new_panel) AddPanel(new_panel, panel_position); // As bookmarks loads asynchronously we need to check if the bookmark // just loaded is the ActiveTab if (m_selector->GetSelected() == -1 && GetCollapse() != COLLAPSE_SMALL) { m_selector->SetSelected(ReadActiveTab(), TRUE, TRUE); } return TRUE; }
void Hotlist::AddPanelByType(Type type, INT32 pos) { HotlistPanel* panel = CreatePanelByType(type); if (!panel) { return; } AddPanel(panel, pos); }
int PanelMatrix::ConfigurePanels(std::string layout) { int result = 1; LogDebug(VB_CHANNELOUT, "Parsing Config: '%s'\n", layout.c_str()); std::vector<std::string> panels = split(layout, '|'); for (int i = 0; i < panels.size(); i++) { result &= AddPanel(panels[i]); } if (result) CalculateMaps(); return result; }
BOOL CPanelBase::LoadXml( TiXmlElement *pElem ) { if (!pElem || strcmp(pElem->Value(), "panel") != 0) return FALSE; SetPos(pElem->Attribute("pos")); for (TiXmlElement* pXmlChild = pElem->FirstChildElement("panel"); NULL != pXmlChild; pXmlChild = pXmlChild->NextSiblingElement("panel")) { CPanelBase *pPanel = new CPanelBase; const char *psId = pXmlChild->Attribute("id"); if (!psId) continue; AddPanel(::StrToIntA(psId), pPanel); pPanel->LoadXml(pXmlChild); } return TRUE; }
void TPanelWindowView::MessageReceived( BMessage *message ) { if ( fDebugLevel >= 20 ) message->PrintToStream(); if ( message->what == B_GET_PROPERTY || message->what == B_SET_PROPERTY || message->what == B_COUNT_PROPERTIES || message->what == B_CREATE_PROPERTY || message->what == B_DELETE_PROPERTY || message->what == B_EXECUTE_PROPERTY ) { int32 index, what; BMessage specifier; const char *property; if ( message->GetCurrentSpecifier( &index, &specifier, &what, &property ) == B_OK ) { BMessage reply( B_REPLY ); if ( message->what == B_GET_PROPERTY || message->what == B_COUNT_PROPERTIES || message->what == B_EXECUTE_PROPERTY ) { if ( GetOptions( property, &reply ) ) reply.AddInt32( "error", 0 ); else reply.AddInt32( "error", -1 ); } else if ( message->what == B_SET_PROPERTY ) { if ( SetOptions( property, message ) ) reply.AddInt32( "error", 0 ); else reply.AddInt32( "error", -1 ); } else if ( message->what == B_CREATE_PROPERTY ) { if ( !strcasecmp( property, "tab" ) ) { int32 index; if ( message->FindInt32( "index", &index ) != B_OK ) index = -1; TShortcutPanel *panel = new TShortcutPanel( this ); fPanels.Lock(); if ( index >= 0 ) { TInnerPanel *rightpanel = fPanels.ItemAt(index); AddPanel( panel, rightpanel ); } else { AddPanel( panel ); } fPanels.Unlock(); ChangedSize(0); reply.AddInt32( "error", 0 ); } else reply.AddInt32( "error", -1 ); } else if ( message->what == B_DELETE_PROPERTY ) { int32 index; if ( specifier.FindInt32( "index", &index ) != B_OK ) reply.AddInt32( "error", -1 ); else { fPanels.Lock(); TInnerPanel *panel = fPanels.ItemAt(index); if ( !panel ) reply.AddInt32( "error", -1 ); else { if ( panel != fRunningAppPanel ) { RemovePanel( panel ); reply.AddInt32( "error", 0 ); } else reply.AddInt32( "error", -1 ); } fPanels.Unlock(); } } message->SendReply( &reply ); } return; } if ( message->WasDropped() ) { BPoint point = message->DropPoint(); ConvertFromScreen( &point ); TInnerPanel *panel = PanelAt( point ); if ( message->what == 'IDRG' ) { TPanelIcon *item; if ( message->FindPointer( "source", (void**)&item ) == B_OK ) { TRaisingIconPanel *previous_parent = item->fParent; TRaisingIconPanel *rpanel; if ( modifiers() & B_CONTROL_KEY ) { rpanel = new TShortcutPanel(this); bool left = false; if ( point.x < (panel->Frame().left+(panel->Frame().Width()/2) ) ) { left = true; } rpanel = new TShortcutPanel(this); AddPanel( rpanel, left ? panel : 0 ); } else rpanel = dynamic_cast<TRaisingIconPanel*>(panel); if ( rpanel && rpanel != fRunningAppPanel ) { TPanelIcon *icon = rpanel->IconAt( point, true ); if ( previous_parent == fRunningAppPanel && dynamic_cast<TShortcutPanel*>(rpanel) ) { int32 index = rpanel->IndexOf(icon); AddShortcut( dynamic_cast<TShortcutPanel*>(rpanel), dynamic_cast<TAppPanelIcon*>(item)->Ref(), index ); } else if ( !dynamic_cast<TTrashIcon*>(icon) || (modifiers() & B_SHIFT_KEY) ) { previous_parent->RemoveItem( item, false ); int32 index = rpanel->IndexOf(icon); rpanel->AddItem( item, index ); } else { if ( item->Removable() ) RemoveShortcut(item); } if ( previous_parent->CountItems() == 0 && previous_parent != fRunningAppPanel ) RemovePanel( previous_parent ); } } } else { if ( panel && panel->HitsFrame( point ) ) { panel->HandleDroppedMessage( message, point ); } else { HandleDroppedMessage( message, point ); } } return; } switch ( message->what ) { case kPanelWindowViewTimer: { if ( DoIconSmallerWithTime() == 0 ) { fTimer->SetInterval( 999999999 ); } break; } case T_MENU_CLOSED: { DebugCall( 8, "Got T_MENU_CLOSED" ); TAwarePopupMenu *source; if ( message->FindPointer( "source", (void**)&source ) == B_OK ) { if ( source == fOpenMenu ) { DebugCall( 9, "fOpenMenu is now 0" ); fOpenMenu = 0; BPoint point; uint32 buttons; GetMouse( &point, &buttons ); if ( !Bounds().Contains( point ) ) Window()->PostMessage(B_EXITED_VIEW); } } break; } case B_SOME_APP_LAUNCHED: { team_id tid; if ( message->FindInt32( "be:team", &tid ) != B_OK ) break; const char *sig; if ( message->FindString( "be:signature", &sig ) != B_OK ) break; entry_ref ref; if ( message->FindRef( "be:ref", &ref ) != B_OK ) break; int32 flags; if ( message->FindInt32( "be:flags", &flags ) != B_OK ) break; if ( sig && strlen(sig) && ( ( flags & B_BACKGROUND_APP ) == 0 ) ) AddTeam( tid, sig, ref ); break; } case B_SOME_APP_QUIT: { team_id tid; if ( message->FindInt32( "be:team", &tid ) != B_OK ) break; RemoveTeam( tid ); break; } case B_SOME_APP_ACTIVATED: { team_id tid; if ( message->FindInt32( "be:team", &tid ) == B_OK ) { TAppPanelIcon *icon = ItemWith( tid ); if ( icon != fLastActiveAppIcon ) { DebugCall( 10, "B_SOME_APP_ACTIVATED %p[..]->%p[%i]", fLastActiveAppIcon, icon, tid ); if ( fLastActiveAppIcon ) fLastActiveAppIcon->SetActive( false ); if ( icon ) icon->SetActive( true ); fLastActiveAppIcon = icon; } } BString temp; message->FindString( "be:signature", &temp ); if ( temp != "application/x-vnd.Be-TSKB" ) fLastActivatedAppSig = temp; break; } case kDoBubbleHelp: { BPoint point; uint32 buttons; GetMouse(&point, &buttons); if ( fPreviousMousePosition != point ) { if ( fBubbleCounter > 0 ) { if ( fBubbleCounter >= 6 ) { fBubbleHelp->HideBubble(); } fBubbleCounter = 0; } fPreviousMousePosition = point; } else { BRegion region; GetClippingRegion(®ion); if ( region.Contains( point ) ) { fBubbleCounter ++; if ( fBubbleCounter == 6 ) { ConvertToScreen(&point); TBubbleTarget *target = fBubbleHelp->TargetAt( point ); if (dynamic_cast<TTrackerIcon*>(target)) { TTrackerIcon *trackerIcon = dynamic_cast<TTrackerIcon*>(target); point.x = Window()->Frame().left + trackerIcon->ContentLocation().x + trackerIcon->Frame().Width() + 4; point.y = Window()->Frame().top; float height = TBubbleHelp::BubbleHeight(target); point.y += height; point.y += (Window()->Frame().Height() - height)/2 -4; } fBubbleHelp->ShowBubble( point, target ); } // else if ( fBubbleCounter == 12 ) // { // fBubbleHelp->HideBubble(); // } } } break; } case 'flsh': { BMessenger target; if ( message->FindMessenger("source", &target ) == B_OK && target.IsValid() ) { TAppPanelIcon *teamicon = ItemWith( target.Team() ); if ( teamicon ) { // todo: flashing teamicon->Flash(); } } break; } case 'mctx': { // todo: context menus break; } default: BView::MessageReceived(message); } }
void TPanelWindowView::HandleDroppedMessage( BMessage *message, BPoint point ) { if ( message->what == B_PASTE ) { rgb_color *r; ssize_t s; if ( message->FindData( "RGBColor", B_RGB_COLOR_TYPE, (const void**)&r, &s ) == B_OK ) { BMessage msg; msg.AddData( "data", B_RGB_COLOR_TYPE, r, sizeof(rgb_color) ); SetOptions( "BackColor", &msg ); } } else if ( message->what == B_SIMPLE_DATA || message->what == 'MIME' ) { TInnerPanel *panel = PanelAt( point ); if ( (fShortcutPanelList.CountItems() == 0) || ( modifiers() & B_CONTROL_KEY ) ) { bool left = false; if ( point.x < (panel->Frame().left+(panel->Frame().Width()/2) ) ) { left = true; } TShortcutPanel *cpanel = new TShortcutPanel(this); AddPanel( cpanel, left ? panel : 0 ); panel = cpanel; } TShortcutPanel *pn = dynamic_cast<TShortcutPanel*>( panel ); if ( !pn ) pn = static_cast<TShortcutPanel*>( fShortcutPanelList.FirstItem() ); if ( pn ) { entry_ref ref; char *data; ssize_t size; int32 index = pn->IndexOf(pn->IconAt(point, true)); if ( message->FindRef( "refs", &ref ) == B_OK ) { AddShortcut( pn, ref, index ); } else if ( message->FindData( "text/plain", 'MIME', (const void**)&data, &size ) == B_OK ) { char _data[256]; strncpy( _data, data, size ); data[size] = 0; BString string( data ); if ( string == "clock" ) pn->AddItem( new TClockIcon(), index ); else if ( string == "trash" ) pn->AddItem( new TTrashIcon(), index ); else if ( string == "workspaces" ) pn->AddItem( new TWorkspacesIcon(), index ); else if ( string == "separator" ) pn->AddItem( new TSeparatorIcon(), index ); else if ( string == "showdesktop" ) pn->AddItem( new TShowDesktopIcon(), index ); else if ( string == "!experimental!replicant_tab" ) { // todo: Fix this and the header thingo // AddPanel( new TReplicantShelfPanel(this) ); // ChangedSize(0); } else if ( !strcasecmp( string.String(), "beos") ) { BAlert *alert = new BAlert( "Easter Egg", "Is BeOS the best desktop operating system ever?", "Of Course!!!", "Don't think so...", "What's BeOS?" ); int32 what = alert->Go(); if ( what == 1 ) (new BAlert("Answer", "BLASPHEMY!!!", "I'm evil"))->Go(); else if ( what == 2 ) (new BAlert("Answer", "MEDICCC! MEDICCC! We need a medic here!!", "Uh?"))->Go(); } else if ( !strcasecmp( string.String(), "dockbert" ) ) { char s[512]; sprintf(s, "Build Info:\nVersion: %s %s [build %s]\nBuild Date: %s", BUILDVERSION, BUILDSTATUS, BUILDNR, BUILDDATE ); (new BAlert( "Build Info", s, "Nice" ))->Go(); } else if ( !strcasecmp( string.String(), "black-karma" ) ) { (new BAlert( "Easter Egg", "hm.. two nice people developing for the best OS ever.. nice and simple.. even logic :-) Say hi to Hugo ([email protected]) or to Daniel ([email protected])", "Uh?!" ))->Go(); } else if ( !strcasecmp( string.String(), "microsoft" ) || !strcasecmp( string.String(), "apple" ) ) { (new BAlert( "Easter Egg", "Evil!", "eckkkkk" ))->Go(); be_app->PostMessage(B_QUIT_REQUESTED); } else { BEntry entry( string.String() ); if ( entry.GetRef( &ref) == B_OK ) { AddShortcut( pn, ref ); } } } } } }
void TPanelWindowView::AttachedToWindow() { fTimer = new BMessageRunner( BMessenger(Window()), new BMessage(kPanelWindowViewTimer), 999999 ); new BMessageRunner( BMessenger(this), new BMessage(kDoBubbleHelp), 100000 ); fLastActiveAppIcon = 0, be_roster->StartWatching( BMessenger(this), B_REQUEST_LAUNCHED|B_REQUEST_QUIT|B_REQUEST_ACTIVATED ); fUseWindowShapping = false; fOuterFrameColor = (rgb_color){96,96,96,255}; fBubbleHelp = new TBubbleHelp(); if ( fThisArchive ) { // todo fColor3 = (rgb_color){218,218,205,255}; if ( fThisArchive->FindBool( "TransparentMenus", &fUseTransparentMenus ) != B_OK ) fUseTransparentMenus = false; if ( fThisArchive->FindInt32( "Location", &fLocation ) != B_OK ) fLocation = kLocationBottom; rgb_color *temp_c; ssize_t _size; if ( fThisArchive->FindData( "BackColor", B_RGB_COLOR_TYPE, (const void**)&temp_c, &_size ) != B_OK) fColor2 = (rgb_color){229,235,231,255}; else fColor2 = *temp_c; if ( fThisArchive->FindData( "OuterFrameColor", B_RGB_COLOR_TYPE, (const void**)&temp_c, &_size ) != B_OK) fOuterFrameColor = (rgb_color){96,96,96,255}; else fOuterFrameColor = *temp_c; if ( fThisArchive->FindBool( "DrawOuterFrame", &fDrawOuterFrame ) != B_OK ) fDrawOuterFrame = true; #ifdef USE_WINDOW_SHAPING if ( fThisArchive->FindBool( "UseWindowShapping", &fUseWindowShapping ) != B_OK ) fUseWindowShapping = true; ((TPanelWindow*)Window())->SetShowHideLimit( fUseWindowShapping ? 0.1f : 0.f ); #endif bool autohide; if ( fThisArchive->FindBool( "AutoHide", &autohide ) != B_OK ) autohide = false; ((TPanelWindow*)Window())->SetAutoHide( autohide ); int32 delay; if ( fThisArchive->FindInt32( "HideEffectDelay", &delay ) != B_OK ) delay = kWindowHidderAnimationStaleSpeed; ((TPanelWindow*)Window())->SetHideEffectDelay( delay ); if ( fThisArchive->FindBool( "AlwaysOnTop", &fAlwaysOnTop ) != B_OK ) fAlwaysOnTop = true; if ( fThisArchive->FindBool( "HideStandardDeskbar", &fHideStandardDeskbar ) != B_OK ) fHideStandardDeskbar = false; if ( fHideStandardDeskbar ) { BMessage msg(B_SET_PROPERTY); msg.AddBool( "data", true ); msg.AddSpecifier( "Hidden" ); msg.AddSpecifier( "Window", "Deskbar" ); be_app->PostMessage(&msg); } for ( int i=0; ; i++ ) { BMessage inner; if ( fThisArchive->FindMessage( "tabs", i, &inner ) != B_OK ) break; inner.AddPointer( "parent", this ); BArchivable *archive = instantiate_dock_object( &inner ); if ( archive ) { TInnerPanel *panel = dynamic_cast<TInnerPanel*>(archive); if ( panel ) { AddPanel( panel ); bool _isr; if ( inner.FindBool( "IsRunningAppPanel", &_isr ) == B_OK && _isr ) fRunningAppPanel = cast_as( panel, TApplicationPanel ); } } } delete fThisArchive; fThisArchive = 0; } else { // <options> fUseTransparentMenus = false; fLocation = kLocationBottom; fColor2 = (rgb_color){229,235,231,255}; fColor3 = (rgb_color){218,218,205,255}; fDrawOuterFrame = true; fUseWindowShapping = false; fHideStandardDeskbar = false; fAlwaysOnTop = false; // </options> } if ( fAlwaysOnTop ) Window()->SetFeel( B_FLOATING_ALL_WINDOW_FEEL ); else Window()->SetFeel( B_NORMAL_WINDOW_FEEL ); if ( fPanels.CountItems() == 0 ) { TShortcutPanel *cpanel = new TShortcutPanel(this); AddPanel( cpanel ); cpanel->AddItem( new TTrashIcon() ); cpanel->AddItem( new TWorkspacesIcon() ); cpanel->AddItem( new TClockIcon() ); BEntry entry( "/boot/beos/system/Tracker" ); entry_ref ref; entry.GetRef( &ref ); AddShortcut( cpanel, ref ); BPath path; if ( find_directory( B_USER_CONFIG_DIRECTORY, &path ) == B_OK ) { path.Append( "be" ); BEntry entry2( path.Path() ); entry2.GetRef( &ref ); AddShortcut( cpanel, ref ); } cpanel = new TShortcutPanel(this); AddPanel( cpanel ); AddShortcut( cpanel, "application/x-vnd.Be-NPOS" ); AddShortcut( cpanel, "application/x-vnd.Sugoi-BeShare" ); fRunningAppPanel = new TApplicationPanel(this); AddPanel( fRunningAppPanel ); } // AddPanel( new TReplicantShelfPanel(this) ); }
MusikPrefsDialog::MusikPrefsDialog( wxWindow *pParent, const wxString &sTitle ) :wxDialog( pParent, -1, sTitle, wxDefaultPosition, wxSize(750,700), wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxCAPTION | wxTAB_TRAVERSAL | wxFRAME_FLOAT_ON_PARENT | wxFRAME_NO_TASKBAR ) ,m_pCurrentPanel(NULL) { //---------------// //--- colours ---// //---------------// // static wxColour cBtnFace = wxSystemSettings::GetColour( wxSYS_COLOUR_3DFACE ); // this->SetBackgroundColour ( cBtnFace ); //------------// //--- icon ---// //------------// #if defined (__WXMSW__) SetIcon( wxICON( musicbox ) ); #endif //------------------------------// //--- Selection Tree Control ---// //------------------------------// tcPreferencesTree = new wxTreeCtrl( this, MUSIK_PREFERENCES_TREE, wxDefaultPosition, wxSize(-1,-1), wxTR_HAS_BUTTONS | wxSIMPLE_BORDER ); //--- root nodes ---// wxTreeItemId nRootID = tcPreferencesTree->AddRoot ( _( "Preferences" ) ); wxTreeItemId nOptionsRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Options" ) ); wxTreeItemId nTagRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Tagging" ) ); wxTreeItemId nSoundRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Sound" ) ); wxTreeItemId nStreamingRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Streaming" ) ); wxTreeItemId nMiscellaneousRootID = tcPreferencesTree->AppendItem ( nRootID, _( "Miscellaneous " ) ); //--- child nodes ---// //----------------------// //--- System Buttons ---// //----------------------// wxButton* btnCancel = new wxButton_NoFlicker( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize ); wxButton* btnApply = new wxButton_NoFlicker( this, wxID_APPLY, _("Apply"), wxDefaultPosition, wxDefaultSize ); wxButton* btnOK = new wxButton_NoFlicker( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize ); //----------------------------// //--- System Buttons Sizer ---// //----------------------------// wxBoxSizer *hsSysButtons = new wxBoxSizer( wxHORIZONTAL ); hsSysButtons->Add( btnCancel, 0, wxALIGN_LEFT ); hsSysButtons->Add( -1,-1, 1, wxEXPAND ); hsSysButtons->Add( btnApply, 0, wxALIGN_RIGHT ); hsSysButtons->Add( btnOK, 0, wxALIGN_RIGHT | wxLEFT, 4); //-------------------------// //--- Hide / Show Sizer ---// //-------------------------// wxBoxSizer *hsSplitter = new wxBoxSizer( wxHORIZONTAL ); wxBoxSizer *vsRight = new wxBoxSizer( wxVERTICAL ); m_sizerPanels = new wxBoxSizer( wxVERTICAL ); hsSplitter->Add( tcPreferencesTree, 1, wxEXPAND | wxRIGHT, 8 ); hsSplitter->Add( vsRight, 3 ,wxEXPAND|wxALL,5); wxPanel *HeaderPanel = new wxPanel(this,-1,wxDefaultPosition,wxSize(-1,40),wxBORDER); HeaderPanel->SetBackgroundColour ( wxSystemSettings::GetColour( wxSYS_COLOUR_HIGHLIGHT ) ); m_stPanelHeader = new wxStaticText(HeaderPanel,-1,wxEmptyString); wxBoxSizer *hsHeaderPanel = new wxBoxSizer( wxHORIZONTAL ); hsHeaderPanel->Add( m_stPanelHeader,1,wxALIGN_CENTER_VERTICAL|wxLEFT,10); HeaderPanel->SetSizer(hsHeaderPanel); wxFont f = m_stPanelHeader->GetFont(); f.SetPointSize(f.GetPointSize() * 2); f.SetWeight(wxBOLD); m_stPanelHeader->SetFont(f); vsRight->Add(HeaderPanel,0,wxEXPAND|wxALL,5); vsRight->Add(m_sizerPanels,1,wxEXPAND|wxALL,10); AddPanel(nOptionsRootID,new OptionGeneralPanel(this)); AddPanel(nOptionsRootID,new OptionSelectionsPanel(this)); AddPanel(nOptionsRootID,new OptionPlaylistPanel(this)); AddPanel(nOptionsRootID,new OptionFileAssocPanel(this)); AddPanel(nOptionsRootID,new OptionTunagePanel(this)); AddPanel(nOptionsRootID,new OptionAutoDJPanel(this)); AddPanel(nTagRootID,new TaggingGeneralPanel(this)); AddPanel(nTagRootID,new TaggingAutoRenamePanel(this)); AddPanel(nSoundRootID,new SoundDriverPanel(this)); AddPanel(nSoundRootID,new SoundCrossfaderPanel(this)); AddPanel(nStreamingRootID,new StreamingBufferPanel(this)); AddPanel(nStreamingRootID,new StreamingProxyServerPanel(this)); AddPanel(nMiscellaneousRootID,new WebServerPanel(this)); //--- expand all the root nodes ---// ExpandAll( tcPreferencesTree->GetRootItem() ); //-----------------// //--- Top Sizer ---// //-----------------// wxBoxSizer *vsTopSizer = new wxBoxSizer( wxVERTICAL ); vsTopSizer->Add( hsSplitter, 1, wxEXPAND | wxALL, 2 ); vsTopSizer->Add( hsSysButtons, 0, wxEXPAND | wxLEFT | wxRIGHT | wxBOTTOM, 2 ); SetSizer( vsTopSizer ); //--------------// //--- Layout ---// //--------------// Centre(); //--------------------// //--- Set Defaults ---// //--------------------// SelectFirstPanel(); Layout(); }
void BJobSetupPanel::_SetupInterface() { BGroupView* groupView = new BGroupView(B_VERTICAL, 10.0); // printers fPrinterPopUp = new BPopUpMenu(""); fPrinterPopUp->SetRadioMode(true); fPrinterMenuField = new BMenuField("", fPrinterPopUp); fPrinterMenuField->Menu()->SetLabelFromMarked(true); BPrinter printer; while (fPrinterRoster->GetNextPrinter(&printer) == B_OK) { BMenuItem* item = new BMenuItem(printer.Name().String(), NULL); fPrinterPopUp->AddItem(item); if (printer == *fPrinter) item->SetMarked(true); } if (fPrinterRoster->CountPrinters() > 0) fPrinterPopUp->AddItem(new BSeparatorItem); BMenuItem* pdf = new BMenuItem("Save as PDF file" , NULL); fPrinterPopUp->AddItem(pdf); if (fPrinterPopUp->FindMarked() == NULL) pdf->SetMarked(true); fProperties = new BButton("Properties" B_UTF8_ELLIPSIS , new BMessage('prop')); fPrinterInfo = new BStringView("label", ""); fPrinterInfo->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); BBox* divider = new BBox(B_FANCY_BORDER, NULL); divider->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, 1)); fPrintToFile = new BCheckBox("Print to file"); BView* view = BGroupLayoutBuilder(B_VERTICAL, 5.0) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10.0) .Add(fPrinterMenuField->CreateMenuBarLayoutItem()) .Add(fProperties)) .Add(BGroupLayoutBuilder(B_HORIZONTAL,5.0) .Add(new BStringView("label", "Printer info:")) .Add(fPrinterInfo)) .Add(divider) .Add(fPrintToFile) .SetInsets(10.0, 5.0, 10.0, 5.0); BBox *box = new BBox(B_FANCY_BORDER, view); box->SetLabel(BGroupLayoutBuilder() .Add(new BStringView("", "Printer")) .SetInsets(2.0, 0.0, 2.0, 0.0)); groupView->AddChild(box); // page range fPrintAll = new BRadioButton("Print all", new BMessage('prrg')); fPrintAll->SetValue(B_CONTROL_ON); fPagesFrom = new BRadioButton("Pages from:", new BMessage('prrg')); fFirstPage = new BTextControl("", "", NULL); _DisallowChar(fFirstPage->TextView()); fLastPage = new BTextControl("to:", "", NULL); _DisallowChar(fLastPage->TextView()); fSelection = new BRadioButton("Print selection", new BMessage('prrg')); fFirstPage->CreateLabelLayoutItem(); view = BGroupLayoutBuilder(B_VERTICAL, 5.0) .Add(fPrintAll) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 5.0) .Add(fPagesFrom) .Add(fFirstPage->CreateTextViewLayoutItem()) .Add(fLastPage->CreateLabelLayoutItem()) .Add(fLastPage->CreateTextViewLayoutItem())) .Add(fSelection) .SetInsets(10.0, 5.0, 10.0, 5.0); box = new BBox(B_FANCY_BORDER, view); box->SetLabel(BGroupLayoutBuilder() .Add(new BStringView("", "Page range")) .SetInsets(2.0, 0.0, 2.0, 0.0)); // copies fNumberOfCopies = new BTextControl("Number of copies:", "1", NULL); _DisallowChar(fNumberOfCopies->TextView()); fCollate = new BCheckBox("Collate"); fReverse = new BCheckBox("Reverse"); BView* view2 = BGroupLayoutBuilder(B_VERTICAL, 5.0) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 5.0) .Add(fNumberOfCopies->CreateLabelLayoutItem()) .Add(fNumberOfCopies->CreateTextViewLayoutItem())) .Add(fCollate) .Add(fReverse) .SetInsets(10.0, 5.0, 10.0, 5.0); BBox* box2 = new BBox(B_FANCY_BORDER, view2); box2->SetLabel(BGroupLayoutBuilder() .Add(new BStringView("", "Copies")) .SetInsets(2.0, 0.0, 2.0, 0.0)); groupView->AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10.0) .Add(box) .Add(box2)); // other fColor = new BCheckBox("Print in color"); fDuplex = new BCheckBox("Double side printing"); view = BGroupLayoutBuilder(B_VERTICAL, 5.0) .Add(fColor) .Add(fDuplex) .SetInsets(10.0, 5.0, 10.0, 5.0); box = new BBox(B_FANCY_BORDER, view); box->SetLabel(BGroupLayoutBuilder() .Add(new BStringView("", "Other")) .SetInsets(2.0, 0.0, 2.0, 0.0)); groupView->AddChild(box); AddPanel(groupView); SetOptionFlags(fJobPanelFlags); }