Ejemplo n.º 1
0
void XAP_UnixDialog_WindowMore::_populateWindowData(void)
{
	GtkListStore *model;
	GtkTreeIter iter;

	model = gtk_list_store_new (2, 
							    G_TYPE_STRING,
								G_TYPE_INT);
	
	for (UT_sint32 i = 0; i < m_pApp->getFrameCount(); i++)
    {		
		XAP_Frame * f = m_pApp->getFrame(i);
		UT_return_if_fail(f);

		// Add a new row to the model
		gtk_list_store_append (model, &iter);		
		gtk_list_store_set (model, &iter,
							0, f->getTitle().utf8_str(),
							1, i,
							-1);
    } 
	
	gtk_tree_view_set_model(GTK_TREE_VIEW(m_listWindows), reinterpret_cast<GtkTreeModel *>(model));
	
	g_object_unref (model);	
	
	// now select first item in box
 	gtk_widget_grab_focus (m_listWindows);
	
	GtkTreePath* path = gtk_tree_path_new ();
	gtk_tree_path_append_index (path, m_ndxSelFrame);
	
	gtk_tree_view_set_cursor(GTK_TREE_VIEW(m_listWindows),
							 path, 
							 gtk_tree_view_get_column (GTK_TREE_VIEW(m_listWindows), 0), 
							 FALSE);
	
	gtk_tree_path_free (path);
}
BOOL XAP_Win32Dialog_WindowMore::_onInitDialog(HWND /*hWnd*/, WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	// localize controls
	localizeDialogTitle(XAP_STRING_ID_DLG_MW_MoreWindows);

	localizeControlText(XAP_RID_DIALOG_WINDOWMORE_TEXT_ACTIVATE,	XAP_STRING_ID_DLG_MW_Activate);
	localizeControlText(XAP_RID_DIALOG_WINDOWMORE_BTN_OK,			XAP_STRING_ID_DLG_OK);
	localizeControlText(XAP_RID_DIALOG_WINDOWMORE_BTN_CANCEL,		XAP_STRING_ID_DLG_Cancel);

	// load each frame name into the list
	for (UT_sint32 i=0; i<m_pApp->getFrameCount(); i++)
	{
		XAP_Frame * f = m_pApp->getFrame(i);
		UT_continue_if_fail(f);

		int nIndex = addItemToList(XAP_RID_DIALOG_WINDOWMORE_LIST, f->getTitle().utf8_str());
		setListDataItem(XAP_RID_DIALOG_WINDOWMORE_LIST, nIndex, (DWORD) i);
     } 

	// select the one we're in
	selectListItem(XAP_RID_DIALOG_WINDOWMORE_LIST, m_ndxSelFrame);

	return 1;							// 1 == we did not call SetFocus()
}