LLFloaterDirectory::LLFloaterDirectory(const std::string& name)
:	LLFloater(name, std::string("FloaterFindRect2"), LLStringUtil::null),
	mMinimizing(false)
{
	sInstance = this;

	mFindAllPanel = NULL;
	mClassifiedPanel = NULL;
	mEventsPanel = NULL;
	mLandPanel = NULL;

	mPanelAvatarp = NULL;
	mPanelEventp = NULL;
	mPanelGroupp = NULL;
	mPanelGroupHolderp = NULL;
	mPanelPlacep = NULL;
	mPanelPlaceSmallp = NULL;
	mPanelClassifiedp = NULL;
	
	// Build the floater with our tab panel classes
	bool secondlife = gHippoGridManager->getConnectedGrid()->isSecondLife();

	LLCallbackMap::map_t factory_map;
	factory_map["classified_panel"] = LLCallbackMap(createClassified, this);
	factory_map["events_panel"] = LLCallbackMap(createEvents, this);
	factory_map["places_panel"] = LLCallbackMap(createPlaces, this);
	factory_map["land_sales_panel"] = LLCallbackMap(createLand, this);
	factory_map["people_panel"] = LLCallbackMap(createPeople, this);
	factory_map["groups_panel"] = LLCallbackMap(createGroups, this);
	factory_map[market_panel] = LLCallbackMap(LLPanelDirMarket::create, this);
	factory_map["find_all_panel"] = LLCallbackMap(createFindAll, this);
	factory_map["showcase_panel"] = LLCallbackMap(createShowcase, this);
	if (secondlife)
	{
		factory_map["web_panel"] = LLCallbackMap(createWebPanel, this);
	}
	else
	{
		factory_map["find_all_old_panel"] = LLCallbackMap(createFindAllOld, this);
	}

	factory_map["classified_details_panel"] = LLCallbackMap(createClassifiedDetail, this);
	factory_map["event_details_panel"] = LLCallbackMap(createEventDetail, this);
	factory_map["group_details_panel"] = LLCallbackMap(createGroupDetail, this);
	factory_map["group_details_panel_holder"] = LLCallbackMap(createGroupDetailHolder, this);
	factory_map["place_details_panel"] = LLCallbackMap(createPlaceDetail, this);
	factory_map["place_details_small_panel"] = LLCallbackMap(createPlaceDetailSmall, this);

	factory_map["Panel Avatar"] = LLCallbackMap(createPanelAvatar, this);
	
	mCommitCallbackRegistrar.add("Search.WebFloater", boost::bind(&LLFloaterSearch::open, boost::bind(LLFloaterSearch::getInstance)));
	LLUICtrlFactory::getInstance()->buildFloater(this, "floater_directory.xml", &factory_map);
	moveResizeHandlesToFront();

	if (mPanelAvatarp)
	{
		mPanelAvatarp->selectTab(0);
	}
	
	LLTabContainer* container = getChild<LLTabContainer>("Directory Tabs");
	if (secondlife)
	{
		container->removeTabPanel(getChild<LLPanel>("find_all_old_panel")); // Not used
	}
	else
	{
		container->removeTabPanel(getChild<LLPanel>("web_panel")); // Not needed
		LLPanel* panel(getChild<LLPanel>("find_all_panel"));
		LLPanel* prev_tab(getChild<LLPanel>("find_all_old_panel"));
		LFSimFeatureHandler& inst(LFSimFeatureHandler::instance());
		set_tab_visible(container, panel, !inst.searchURL().empty(), prev_tab);
		inst.setSearchURLCallback(boost::bind(set_tab_visible, container, panel, !boost::bind(&std::string::empty, _1), prev_tab));
		panel = getChild<LLPanel>("showcase_panel");
		prev_tab = getChild<LLPanel>("events_panel");
		set_tab_visible(container, panel, !inst.destinationGuideURL().empty(), prev_tab);
		inst.setDestinationGuideURLCallback(boost::bind(set_tab_visible, container, panel, !boost::bind(&std::string::empty, _1), prev_tab));

		LLPanelDirMarket* marketp = static_cast<LLPanelDirMarket*>(container->getPanelByName(market_panel));
		container->removeTabPanel(marketp); // Until we get a MarketPlace URL, tab is removed.
		marketp->handleRegionChange(container);
		gAgent.addRegionChangedCallback(boost::bind(&LLPanelDirMarket::handleRegionChange, marketp, container));
	}
	container->setCommitCallback(boost::bind(&LLFloaterDirectory::onTabChanged,_2));
}
Пример #2
0
LLFloaterTestImpl::LLFloaterTestImpl()
:	LLFloater(std::string("test"), LLRect(0, 500, 700, 0), std::string("Test UI"))
{
	const S32 HPAD = 5;
	const S32 VPAD = 5;
	const S32 LEFT = HPAD;
	const S32 RIGHT = getRect().getWidth() - HPAD;
	const S32 TOP = getRect().getHeight() - LLFLOATER_HEADER_SIZE - VPAD;
	const S32 BOTTOM = VPAD;
	const S32 LINE = 15;

	//S32 x = LEFT;
	S32 y = TOP;

	LLTextBox* text = NULL;
	LLButton* btn = NULL;
	LLTabContainer* tab = NULL;
	LLPanel* panel = NULL;
	LLCheckBoxCtrl* check = NULL;
	LLComboBox* combo = NULL;

	btn = new LLButton(std::string("can't click"),
		LLRect(LEFT+150, y, LEFT+150+100, y-LINE),
		LLStringUtil::null,
		boost::bind(&LLFloaterTestImpl::onClickButton));
	btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
	btn->setFont(LLFontGL::getFontSansSerifSmall());
	addChild(btn);

	text = new LLTextBox(std::string("simple_text"), 
		std::string("simple sans-serif text that is mouse opaque opaque opaque"),
		50,	// max_width
		LLFontGL::getFontSansSerifSmall(),
		TRUE);	// mouse_opaque
	text->setClickedCallback(boost::bind(&onClickText));
	text->setRect(LLRect(LEFT, y, RIGHT, y-LINE));
	addChild(text);

	y -= VPAD + LINE;

	btn = new LLButton(std::string("can click"),
		LLRect(LEFT+150, y, LEFT+150+100, y-LINE),
		LLStringUtil::null,
		boost::bind(&LLFloaterTestImpl::onClickButton));
	btn->setFollows(FOLLOWS_LEFT|FOLLOWS_TOP);
	btn->setFont(LLFontGL::getFontSansSerifSmall());
	addChild(btn);

	text = new LLTextBox(std::string("simple2_text"), 
		LLRect(LEFT, y, RIGHT, y-LINE),
		std::string("monospaced, non-opaque text with tooltip, non-opaque non-opaque"),
		LLFontGL::getFontMonospace(),
		FALSE);	// mouse_opaque
	text->setToolTip(std::string("I'm a tooltip"));
	addChild(text);

	y -= VPAD + LINE;

	tab = new LLTabContainer(std::string("test_tab"), 
		LLRect(LEFT, y, RIGHT, BOTTOM),
		LLTabContainer::TOP,
		TRUE,	// bordered
		FALSE); // horizontal
	addChild(tab);
	mTab = tab;

	tab->setCommitCallback(boost::bind(&LLFloaterTestImpl::onClickTab));

	//-----------------------------------------------------------------------
	// First tab container panel
	//-----------------------------------------------------------------------
	panel = new LLPanel(std::string("first_tab_panel"),
		LLRect(0, 400, 400, 0),	// dummy rect
		TRUE);	// bordered
	tab->addTabPanel(panel, std::string("First"), 
		TRUE);	// select

	y = panel->getRect().getHeight() - VPAD;

	text = new LLTextBox(std::string("unicode_text"),
		LLRect(LEFT, y, RIGHT, y-LINE),
		std::string("File"),
		LLFontGL::getFontSansSerif(),
		TRUE);	// mouse_opaque
	text->setToolTip(std::string("This should be Unicode text"));
	panel->addChild(text);

	y -= VPAD + LINE;

	btn = new LLButton(std::string("unicode_btn"), LLRect(LEFT, y, LEFT+100, y-20));
	btn->setLabel(std::string("unicode"));
	panel->addChild(btn);

	y -= VPAD + 20;

	btn = new LLButton(std::string("image_btn"),
		LLRect(LEFT, y, LEFT+32, y-32),
		std::string("tool_zoom.tga"),
		std::string("tool_zoom_active.tga"),
		LLStringUtil::null,
		boost::bind(&LLFloaterTestImpl::onClickButton),
		LLFontGL::getFontSansSerifSmall());
	btn->setFollows(FOLLOWS_LEFT | FOLLOWS_TOP);
	panel->addChild(btn);

	y -= VPAD + 32;

	check = new LLCheckBoxCtrl(std::string("simple_check"),
		LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT),
		std::string("Simple Checkbox"),
		LLFontGL::getFontSansSerifSmall(),
		boost::bind(&LLFloaterTestImpl::onCommitCheck),
		TRUE,	// initial_value
		FALSE,	// radio_style
		std::string("UIFloaterTestBool"));	// control_which
	panel->addChild(check);

	y -= VPAD + LLCHECKBOXCTRL_HEIGHT;

	check = new LLCheckBoxCtrl(std::string("unicode_check"),
		LLRect(LEFT, y, LEFT+150, y-LLCHECKBOXCTRL_HEIGHT),
		std::string("TODO: Unicode Checkbox"),
		LLFontGL::getFontSansSerifSmall(),
		boost::bind(&LLFloaterTestImpl::onCommitCheck),
		TRUE,	// initial_value
		FALSE,	// radio_style
		LLStringUtil::null);	// control_which
	panel->addChild(check);
	mCheckUnicode = check;

	y -= VPAD + LLCHECKBOXCTRL_HEIGHT;

	combo = new LLComboBox(std::string("combo"),
		LLRect(LEFT, y, LEFT+100, y-LLCOMBOBOX_HEIGHT),
		std::string("Combobox Label"),
		boost::bind(&LLFloaterTestImpl::onCommitCombo, _1,_2) );
	combo->add(std::string("first item"));
	combo->add(std::string("second item"));
	combo->add(std::string("should go to the top"), ADD_TOP);
	combo->add(std::string("disabled item"), NULL, ADD_BOTTOM, FALSE);
	panel->addChild(combo);

	y -= VPAD + LLCOMBOBOX_HEIGHT;

	LLIconCtrl* icon = new LLIconCtrl(
		std::string("test_icon"),
		LLRect(LEFT, y, LEFT+32, y-32),
		std::string("object_cone.tga") );
	panel->addChild(icon);
	mIcon = icon;

	y -= VPAD + 32;

	LLLineEditor* line = new LLLineEditor(
		std::string("test_line"),
		LLRect(LEFT, y, LEFT+200, y-20),
		std::string("test some unicode text here"),
		LLFontGL::getFontSansSerif(),
		200,	// max_length_bytes
		boost::bind(&LLFloaterTestImpl::onCommitLine),
		boost::bind(&LLFloaterTestImpl::onKeyLine),
		boost::bind(&LLFloaterTestImpl::onFocusLostLine));
	line->setHandleEditKeysDirectly(true);
	panel->addChild(line);

	y -= VPAD + 20;

	LLRadioGroup* group = new LLRadioGroup(
		std::string("radio_group"),
		LLRect(LEFT, y, LEFT+200, y - 50),
		0,	// initial_index
		boost::bind(&LLFloaterTestImpl::onChangeRadioGroup),
		TRUE);	// border
	panel->addChild(group);

	S32 yy = 100;
	group->addRadioButton(std::string("Radio1"), std::string("Radio 1"), LLRect(0, yy, 200, yy-LINE), LLFontGL::getFontSansSerifSmall());
	yy -= LINE;
	group->addRadioButton(std::string("Radio2"), std::string("Radio 2"), LLRect(0, yy, 200, yy-LINE), LLFontGL::getFontSansSerifSmall());
	yy -= LINE;
	group->addRadioButton(std::string("Radio3"), std::string("Radio 3"), LLRect(0, yy, 200, yy-LINE), LLFontGL::getFontSansSerifSmall());
	yy -= LINE;

	//-----------------------------------------------------------------------
	// Second tab container panel
	//-----------------------------------------------------------------------
	panel = new LLPanel(std::string("second_tab_panel"),
		LLRect(0, 400, 400, 0),	// dummy rect
		TRUE);	// bordered
	tab->addTabPanel(panel, std::string("Second"), 
		FALSE);	// select

	y = panel->getRect().getHeight() - VPAD;

	btn = new LLButton(std::string("Simple Button"),
		LLRect(LEFT, y, LEFT+100, y - 20),
		LLStringUtil::null,
		boost::bind(&LLFloaterTestImpl::onClickButton));
	btn->setFollows(FOLLOWS_TOP|FOLLOWS_LEFT);
	panel->addChild(btn);
	mBtnSimple = btn;

	//-----------------------------------------------------------------------
	// Hook us up with the floater view
	//-----------------------------------------------------------------------
	open();		/* Flawfinder: ignore */
	center();
}
Пример #3
0
BOOL LLSidepanelInventory::postBuild()
{
	// UI elements from inventory panel
	{
		mInventoryPanel = getChild<LLPanel>("sidepanel__inventory_panel");

		mInfoBtn = mInventoryPanel->getChild<LLButton>("info_btn");
		mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this));
		
		mShareBtn = mInventoryPanel->getChild<LLButton>("share_btn");
		mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this));
		
		mShopBtn = mInventoryPanel->getChild<LLButton>("shop_btn");
		mShopBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShopButtonClicked, this));

		mWearBtn = mInventoryPanel->getChild<LLButton>("wear_btn");
		mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this));
		
		mPlayBtn = mInventoryPanel->getChild<LLButton>("play_btn");
		mPlayBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onPlayButtonClicked, this));
		
		mTeleportBtn = mInventoryPanel->getChild<LLButton>("teleport_btn");
		mTeleportBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onTeleportButtonClicked, this));
		
		mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn");
		mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this));
		
		mPanelMainInventory = mInventoryPanel->getChild<LLPanelMainInventory>("panel_main_inventory");
		mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
		LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");
		tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));

		/* 
		   EXT-4846 : "Can we suppress the "Landmarks" and "My Favorites" folder since they have their own Task Panel?"
		   Deferring this until 2.1.
		LLInventoryPanel *my_inventory_panel = mPanelMainInventory->getChild<LLInventoryPanel>("All Items");
		my_inventory_panel->addHideFolderType(LLFolderType::FT_LANDMARK);
		my_inventory_panel->addHideFolderType(LLFolderType::FT_FAVORITE);
		*/

		LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
	}

	// UI elements from item panel
	{
		mItemPanel = getChild<LLSidepanelItemInfo>("sidepanel__item_panel");
		
		LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn");
		back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
	}

	// UI elements from task panel
	{
		mTaskPanel = findChild<LLSidepanelTaskInfo>("sidepanel__task_panel");
		if (mTaskPanel)
		{
			LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn");
			back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
		}
	}
	
	// Received items inbox setup
	{
		LLLayoutStack* inv_stack = getChild<LLLayoutStack>(INVENTORY_LAYOUT_STACK_NAME);

		// Collapse inbox panel
		inv_stack->collapsePanel(getChild<LLLayoutPanel>(INBOX_LAYOUT_PANEL_NAME), true);
		
		// Set up button states and callbacks
		LLButton * inbox_button = getChild<LLButton>(INBOX_BUTTON_NAME);

		inbox_button->setToggleState(false);
		inbox_button->setCommitCallback(boost::bind(&LLSidepanelInventory::onToggleInboxBtn, this));

		// Set the inbox visible based on debug settings (final setting comes from http request below)
		enableInbox(gSavedSettings.getBOOL("InventoryDisplayInbox"));

		// Trigger callback for after login so we can setup to track inbox changes after initial inventory load
		LLAppViewer::instance()->setOnLoginCompletedCallback(boost::bind(&LLSidepanelInventory::updateInbox, this));
	}

	gSavedSettings.getControl("InventoryDisplayInbox")->getCommitSignal()->connect(boost::bind(&handleInventoryDisplayInboxChanged));

	// Update the verbs buttons state.
	updateVerbs();

	return TRUE;
}
BOOL LLSidepanelInventory::postBuild()
{
	// UI elements from inventory panel
	{
		mInventoryPanel = getChild<LLPanel>("sidepanel__inventory_panel");

		mInfoBtn = mInventoryPanel->getChild<LLButton>("info_btn");
		mInfoBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onInfoButtonClicked, this));
		
		mShareBtn = mInventoryPanel->getChild<LLButton>("share_btn");
		mShareBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShareButtonClicked, this));
		
		mShopBtn = mInventoryPanel->getChild<LLButton>("shop_btn");
		mShopBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onShopButtonClicked, this));

		mWearBtn = mInventoryPanel->getChild<LLButton>("wear_btn");
		mWearBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onWearButtonClicked, this));
		
		mPlayBtn = mInventoryPanel->getChild<LLButton>("play_btn");
		mPlayBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onPlayButtonClicked, this));
		
		mTeleportBtn = mInventoryPanel->getChild<LLButton>("teleport_btn");
		mTeleportBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onTeleportButtonClicked, this));
		
		mOverflowBtn = mInventoryPanel->getChild<LLButton>("overflow_btn");
		mOverflowBtn->setClickedCallback(boost::bind(&LLSidepanelInventory::onOverflowButtonClicked, this));
		
		mPanelMainInventory = mInventoryPanel->findChild<LLPanelMainInventory>("panel_main_inventory");
		mPanelMainInventory->setSelectCallback(boost::bind(&LLSidepanelInventory::onSelectionChange, this, _1, _2));
		LLTabContainer* tabs = mPanelMainInventory->getChild<LLTabContainer>("inventory filter tabs");
		tabs->setCommitCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));

		/* 
		   EXT-4846 : "Can we suppress the "Landmarks" and "My Favorites" folder since they have their own Task Panel?"
		   Deferring this until 2.1.
		LLInventoryPanel *my_inventory_panel = mPanelMainInventory->getChild<LLInventoryPanel>("All Items");
		my_inventory_panel->addHideFolderType(LLFolderType::FT_LANDMARK);
		my_inventory_panel->addHideFolderType(LLFolderType::FT_FAVORITE);
		*/

		LLOutfitObserver::instance().addCOFChangedCallback(boost::bind(&LLSidepanelInventory::updateVerbs, this));
	}

	// UI elements from item panel
	{
		mItemPanel = findChild<LLSidepanelItemInfo>("sidepanel__item_panel");
		
		LLButton* back_btn = mItemPanel->getChild<LLButton>("back_btn");
		back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
	}

	// UI elements from task panel
	{
		mTaskPanel = findChild<LLSidepanelTaskInfo>("sidepanel__task_panel");
		if (mTaskPanel)
		{
			LLButton* back_btn = mTaskPanel->getChild<LLButton>("back_btn");
			back_btn->setClickedCallback(boost::bind(&LLSidepanelInventory::onBackButtonClicked, this));
		}
	}
	
	return TRUE;
}