EXPORT_C void AknPopupLayouts::SetupImageSelectionMenuPopupWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool heading) { SetupDefaults(aDef); TRect window_rect = AknPopupLayouts::MenuRect(aDef); TAknWindowLineLayout listLayout = AKN_LAYOUT_WINDOW_list_menu_double_large_graphic_pane(heading?1:0, num-1); // We really don't want parent relative list layout here because findbox will be overwritten. // Just calculate list height and use that. TRect nullRect(0,0,0,0); TRect listItemRect = RectFromLayout(nullRect, AknLayoutScalable_Avkon::list_double_large_graphic_pane_cp2(0)); listLayout.iH = (TInt16)(num * listItemRect.Height()); listLayout.ib = ELayoutEmpty; aDef.iListRect.LayoutRect(window_rect, listLayout); //aDef.iListRect.LayoutRect(window_rect, AKN_LAYOUT_WINDOW_list_menu_double_large_graphic_pane(heading?1:0, num-1)); TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants__double__Line_2; // Combine two layouts togeher. if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; if (part2.il != ELayoutEmpty) part1.il = part2.il; if (part2.it != ELayoutEmpty) part1.it = part2.it; if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; aDef.iHeadingRect.LayoutRect(window_rect, part1); //MenuPopupWindowGraphics(aDef); }
vtElevLayer::vtElevLayer(vtElevationGrid *grid) : vtLayer(LT_ELEVATION) { SetupDefaults(); m_pTin = NULL; m_pGrid = grid; m_pGrid->SetupLocalCS(1.0f); }
vtElevLayer::vtElevLayer(const DRECT &area, const IPoint2 &size, bool bFloats, float fScale, const vtProjection &proj) : vtLayer(LT_ELEVATION) { SetupDefaults(); VTLOG(" Constructing vtElevLayer of size %d x %d, floats %d\n", size.x, size.y, bFloats); m_pTin = NULL; m_pGrid = new vtElevationGrid(area, size, bFloats, proj); if (!m_pGrid->HasData()) VTLOG1(" Grid allocation failed.\n"); m_pGrid->SetScale(fScale); }
EXPORT_C void AknPopupLayouts::SetupPopupSNoteGroupWindow(TAknPopupWindowLayoutDef &aDef, TInt num, TBool /*heading*/) { // not used (at least by AvKon) - no need to remove magic numbers SetupDefaults(aDef); TRect window_rect = AknPopupLayouts::MenuRect(aDef); aDef.iListRect.LayoutRect(window_rect, 0, 3, 11, ELayoutEmpty, ELayoutEmpty, 168, 38+(57-38)*(num-2) ); TAknWindowLineLayout part1 = AKN_LAYOUT_WINDOW_Pop_up_window_list_pane_descendants_Line_8; TAknWindowLineLayout part2 = AKN_LAYOUT_WINDOW_Menu_pop_up_window_descendants_Line_2; // Combine two layouts togeher. if (part2.iC != ELayoutEmpty) part1.iC = part2.iC; if (part2.il != ELayoutEmpty) part1.il = part2.il; if (part2.it != ELayoutEmpty) part1.it = part2.it; if (part2.ir != ELayoutEmpty) part1.ir = part2.ir; if (part2.ib != ELayoutEmpty) part1.ib = part2.ib; if (part2.iW != ELayoutEmpty) part1.iW = part2.iW; if (part2.iH != ELayoutEmpty) part1.iH = part2.iH; aDef.iHeadingRect.LayoutRect(window_rect, part1); TInt p = window_rect.Size().iHeight; const AknLayoutUtils::SAknLayoutRect shadow[] = { { 0,0,0,ELayoutEmpty, ELayoutEmpty, 176, p }, { 86,7,12,ELayoutEmpty, ELayoutEmpty, 167, p -16 }, { 221,4,10,ELayoutEmpty, ELayoutEmpty, 169, p -15 }, { 215,2,8,ELayoutEmpty, ELayoutEmpty, 170, p -14 }, { 0,3,9,ELayoutEmpty, ELayoutEmpty, 168, p -16 } }; aDef.iCover.LayoutRect( window_rect, shadow[0]); aDef.iSecond.LayoutRect( window_rect, shadow[1]); aDef.iFirst.LayoutRect( window_rect, shadow[2]); aDef.iOutline.LayoutRect(window_rect, shadow[3]); aDef.iInside.LayoutRect( window_rect, shadow[4]); }
vtElevLayer::vtElevLayer() : vtLayer(LT_ELEVATION) { SetupDefaults(); m_pGrid = NULL; m_pTin = NULL; }
void NetworkPrefsView::MessageReceived (BMessage * msg) { switch (msg->what) { case M_NETWORK_DEFAULTS: if (fActiveNetwork.HasString ("name")) vision_app->SetNetwork (fActiveNetwork.FindString ("name"), &fActiveNetwork); fActiveNetwork = vision_app->GetNetwork ("defaults"); fNetworkMenu->MenuItem ()->SetLabel ("Defaults"); SetupDefaults (fActiveNetwork); fDupeItem->SetEnabled (false); fRemoveItem->SetEnabled (false); break; case M_CHOOSE_NETWORK: { BMenuItem *item (NULL); msg->FindPointer ("source", reinterpret_cast < void **>(&item)); SaveCurrentNetwork (); fActiveNetwork = vision_app->GetNetwork (item->Label ()); fNetworkMenu->MenuItem ()->SetLabel (item->Label ()); UpdatePersonalData (fActiveNetwork); UpdateNetworkData (fActiveNetwork); if (BMessenger (fServerPrefs).IsValid ()) fServerPrefs->SetNetworkData (&fActiveNetwork); fDupeItem->SetEnabled (true); fRemoveItem->SetEnabled (true); } break; case M_ADD_NEW_NETWORK: { if (msg->HasString ("text")) { fNetPrompt = NULL; BString network (msg->FindString ("text")); network.RemoveAll (" "); BMenu *menu (fNetworkMenu->Menu ()); for (int32 i = 0; i < menu->CountItems (); i++) { BMenuItem *item (menu->ItemAt (i)); if (item && network == item->Label ()) { dynamic_cast < BInvoker * >(item)->Invoke (); return; } } BMessage newNet (VIS_NETWORK_DATA); newNet.AddString ("name", network.String ()); vision_app->SetNetwork (network.String (), &newNet); BMenuItem *item (new BMenuItem (network.String (), new BMessage (M_CHOOSE_NETWORK))); menu->AddItem (item, 0); item->SetTarget (this); dynamic_cast < BInvoker * >(item)->Invoke (); } else { BString promptText = B_TRANSLATE("Network Name"); promptText += ": "; fNetPrompt = new PromptWindow (BPoint (Window ()->Frame ().left + Window ()->Frame ().Width () / 2, Window ()->Frame ().top + Window ()->Frame ().Height () / 2), promptText.String(), B_TRANSLATE("Add Network"), NULL, this, new BMessage (M_ADD_NEW_NETWORK), NULL, false); fNetPrompt->Show (); } } break; case M_REMOVE_CURRENT_NETWORK: { const char *name (fActiveNetwork.FindString ("name")); vision_app->RemoveNetwork (name); BMenu *menu (fNetworkMenu->Menu ()); for (int32 i = 0; i < menu->CountItems (); i++) { BMenuItem *item (menu->ItemAt (i)); if (!strcmp (item->Label (), name)) { delete menu->RemoveItem (i); fActiveNetwork.MakeEmpty (); dynamic_cast < BInvoker * >(menu->ItemAt (0))->Invoke (); break; } } } break; case M_DUPE_CURRENT_NETWORK: { if (msg->HasString ("text")) { fDupePrompt = NULL; BString network (msg->FindString ("text")); network.RemoveAll (" "); BMenu *menu (fNetworkMenu->Menu ()); for (int32 i = 0; i < menu->CountItems (); i++) { BMenuItem *item (menu->ItemAt (i)); if (item && network == item->Label ()) { dynamic_cast < BInvoker * >(item)->Invoke (); return; } } BMessage newNet = fActiveNetwork; newNet.ReplaceString ("name", network.String ()); vision_app->SetNetwork (network.String (), &newNet); BMenuItem *item (new BMenuItem (network.String (), new BMessage (M_CHOOSE_NETWORK))); menu->AddItem (item, 0); item->SetTarget (this); dynamic_cast < BInvoker * >(item)->Invoke (); } else { BString promptText = B_TRANSLATE("Network Name"); promptText += ": "; fDupePrompt = new PromptWindow (BPoint (Window ()->Frame ().left + Window ()->Frame ().Width () / 2, Window ()->Frame ().top + Window ()->Frame ().Height () / 2), promptText.String(), B_TRANSLATE("Duplicate Current Network"), NULL, this, new BMessage (M_DUPE_CURRENT_NETWORK), NULL, false); fDupePrompt->Show (); } } break; case M_SERVER_DATA_CHANGED: { UpdateNetworkData (fActiveNetwork); } break; case M_SERVER_DIALOG: { BMessenger msgr (fServerPrefs); if (msgr.IsValid ()) fServerPrefs->Activate (); else { fServerPrefs = new NetPrefServerWindow (this); fServerPrefs->SetNetworkData (&fActiveNetwork); fServerPrefs->Show (); } } break; case M_NET_CHECK_LAG: { bool value = msg->FindInt32 ("be:value"); if (fActiveNetwork.HasBool ("lagCheck")) fActiveNetwork.ReplaceBool ("lagCheck", value); else fActiveNetwork.AddBool ("lagCheck", value); } break; case M_CONNECT_ON_STARTUP: { bool value = msg->FindInt32 ("be:value"); if (fActiveNetwork.HasBool ("connectOnStartup")) fActiveNetwork.ReplaceBool ("connectOnStartup", value); else fActiveNetwork.AddBool ("connectOnStartup", value); } break; case M_USE_NICK_DEFAULTS: { bool value = msg->FindInt32 ("be:value"); if (fActiveNetwork.HasBool ("useDefaults")) fActiveNetwork.ReplaceBool ("useDefaults", value); else fActiveNetwork.AddBool ("useDefaults", value); UpdatePersonalData (fActiveNetwork); } break; case M_NETPREFS_TEXT_INVOKE: { if (fActiveNetwork.HasString("autoexec")) fActiveNetwork.ReplaceString("autoexec", fTextView->Text()); else fActiveNetwork.AddString("autoexec", fTextView->Text()); } break; case M_ADD_NICK: if (msg->HasString ("text")) { fNickPrompt = NULL; BString nick (msg->FindString ("text")); nick.RemoveAll (" "); for (int32 i = 0; i < fListView->CountItems (); i++) { BStringItem *item ((BStringItem *) fListView->ItemAt (i)); if (item && nick == item->Text ()) return; } fActiveNetwork.AddString ("nick", nick.String ()); fListView->AddItem (new BStringItem (nick.String ())); } else { BString promptString = B_TRANSLATE("Nickname"); promptString += ": "; fNickPrompt = new PromptWindow (BPoint (Window ()->Frame ().left + Window ()->Frame ().Width () / 2, Window ()->Frame ().top + Window ()->Frame ().Height () / 2), promptString.String(), B_TRANSLATE("Add Nickname"), NULL, this, new BMessage (M_ADD_NICK), NULL, false); fNickPrompt->Show (); } break; case M_REMOVE_NICK: { int32 current (fListView->CurrentSelection ()); if (current >= 0) { delete fListView->RemoveItem (current); fActiveNetwork.RemoveData ("nick", current); } } break; case M_NICK_UP: { int32 current (fListView->CurrentSelection ()); BString nick1, nick2; nick1 = fActiveNetwork.FindString ("nick", current); nick2 = fActiveNetwork.FindString ("nick", current - 1); fListView->SwapItems (current, current - 1); fActiveNetwork.ReplaceString ("nick", current - 1, nick1.String ()); fActiveNetwork.ReplaceString ("nick", current, nick2.String ()); current = fListView->CurrentSelection (); Window ()->DisableUpdates (); fListView->DeselectAll (); fListView->Select (current); Window ()->EnableUpdates (); } break; case M_NICK_DOWN: { int32 current (fListView->CurrentSelection ()); BString nick1, nick2; nick1 = fActiveNetwork.FindString ("nick", current); nick2 = fActiveNetwork.FindString ("nick", current + 1); fListView->SwapItems (current, current + 1); fActiveNetwork.ReplaceString ("nick", current + 1, nick1.String ()); fActiveNetwork.ReplaceString ("nick", current, nick2.String ()); current = fListView->CurrentSelection (); Window ()->DisableUpdates (); fListView->DeselectAll (); fListView->Select (current); Window ()->EnableUpdates (); } break; case M_NICK_SELECTED: { int32 index (msg->FindInt32 ("index")); if (index >= 0 && !fNickDefaultsBox->Value ()) { fNickUpButton->SetEnabled (index > 0); fNickDnButton->SetEnabled (index != (fListView->CountItems () - 1)); fNickRemoveButton->SetEnabled (true); } else { fNickUpButton->SetEnabled (false); fNickDnButton->SetEnabled (false); fNickRemoveButton->SetEnabled (false); } } break; default: BView::MessageReceived (msg); break; } }