/*!
 * Set the style in the XP layer from the selection in the GUI.
 */
void AP_UnixDialog_Stylist::styleClicked(UT_sint32 row, UT_sint32 col)
{
	UT_UTF8String sStyle;
	UT_DEBUGMSG(("row %d col %d clicked \n",row,col));

	if((col == 0) && (getStyleTree()->getNumCols(row) == 1))
		return;
	else if(col == 0)
		getStyleTree()->getStyleAtRowCol(sStyle,row,col);
	else
		getStyleTree()->getStyleAtRowCol(sStyle,row,col-1);

	UT_DEBUGMSG(("StyleClicked row %d col %d style %s \n",row,col,sStyle.utf8_str()));
	setCurStyle(sStyle);
}
예제 #2
0
BOOL AP_Win32Dialog_Stylist::_styleClicked(void)
{

	UT_sint32 row, col;
	TVITEM tvi;		

	HWND hTree = GetDlgItem(m_hWnd, AP_RID_DIALOG_STYLIST_TREE_STYLIST);

	// Selected item
	tvi.hItem =  TreeView_GetSelection(hTree);
			
	if (!tvi.hItem)
		return 0;

	// Associated data		 
	tvi.mask = TVIF_HANDLE | TVIF_CHILDREN;
	TreeView_GetItem(hTree, &tvi);

	// Retrieve the row/column information from the treeview
	// This maps back to the pStyleList's row&column identifiers
	if (TreeView_GetParent(hTree, tvi.hItem) == NULL)
	{
		if (tvi.cChildren == 1)
			return 0; // we've clicked on a style category, not a style

		row = tvi.lParam;
		col = 0;
	}
	else
	{
		col = tvi.lParam;
		// Get parent node for row information
		tvi.mask = TVIF_HANDLE;
		tvi.hItem = TreeView_GetParent(hTree, tvi.hItem);
		TreeView_GetItem(hTree, &tvi);
		row = tvi.lParam;
	}

	UT_UTF8String sStyle;

	getStyleTree()->getStyleAtRowCol(sStyle,row,col);
	
	UT_DEBUGMSG(("StyleClicked row %d col %d style %s \n",row,col,sStyle.utf8_str()));
	setCurStyle(sStyle);
	return 1;
}