Beispiel #1
0
// Insert a new view into the array at the specified tab and view position.
// Will shift all remaining array elements if necessary.
// Returns the index to the new ViewInfo object (position in array).
// Note: Both tab and view are zero-based.
//, this is not fully implemented yet, at least as far as adding new tabs goes
int BDataViews::InsertView(int nTab, int nView, ULONG lngViewID, ULONG lngViewHeight)
{
	ASSERT_VALID(this);
	ASSERT(lngViewID);
//	ASSERT(nAfter == 0); //, for now

	// Get index of first view within specified tab
	int nIndex = GetTabIndex(nTab);

	// If tab not found, add a 0 and try again
	if (nIndex == -1)
	{
		ViewInfo vi;
		vi.m_lngViewID = 0;
		vi.m_lngViewHeight = 0;
		m_avi.Add(vi);
		nIndex = GetTabIndex(nTab);
	}

	if (nIndex != -1)
	{
		// Create a new ViewInfo object
		ViewInfo vi;
		vi.m_lngViewID = lngViewID;
		vi.m_lngViewHeight = lngViewHeight;

		// Insert the new view into the array
		nIndex += nView;
		m_avi.InsertAt(nIndex, vi); // may throw memory exception
	}

	// Return the index of the new ViewInfo object
	return nIndex;
}
Beispiel #2
0
// Gets the height of the specified view.
// nTab and nView are zero-based, nHeight is in %
int BDataViews::GetViewHeight(int nTab, int nView)
{
	ASSERT(nTab < GetTabCount());
	ASSERT(nView < GetViewCount(nTab));
	int nIndex = GetTabIndex(nTab) + nView;
	return m_avi[nIndex].m_lngViewHeight;
}
Beispiel #3
0
void CNavPaneWnd::SetTabSettings(CWnd* pTabContent, bool bHasSettings)
{
	int nTab = GetTabIndex(pTabContent);
	if (nTab == -1)
		return;

	SetTabSettings(nTab, bHasSettings);
}
Beispiel #4
0
void CNavPaneWnd::SetTabBorder(CWnd* pTabContent, bool bHasBorder)
{
	int nTab = GetTabIndex(pTabContent);
	if (nTab == -1)
		return;

	SetTabBorder(nTab, bHasBorder);
}
Beispiel #5
0
void CNavPaneWnd::SetTabName(CWnd* pTabContent, const CString& strName)
{
	int nTab = GetTabIndex(pTabContent);
	if (nTab == -1)
		return;

	SetTabName(nTab, strName);
}
Beispiel #6
0
void CNavPaneWnd::ActivateTab(CWnd* pTabContent, bool bExpand)
{
	int nTab = GetTabIndex(pTabContent);
	if (nTab == -1)
		return;

	ActivateTab(nTab, bExpand);
}
Beispiel #7
0
// Sets the height of the specified view.
// nTab and nView are zero-based, nHeight is in %
BOOL BDataViews::SetViewHeight(int nTab, int nView, int nHeight)
{
	ASSERT(nTab < GetTabCount());
	ASSERT(nView < GetViewCount(nTab));
	int nIndex = GetTabIndex(nTab) + nView;
	m_avi[nIndex].m_lngViewHeight = nHeight;
	return TRUE;
}
Beispiel #8
0
// Get the name for the specified tab, made up of its view names (eg "Text, Contents")
//, could also store custom name for tab
BOOL BDataViews::GetTabName(int nTab, CString& strName, BDoc* pDoc)
{
	ASSERT_VALID(this);
	ASSERT_VALID(pDoc);

	// Walk through views to build up name for tab

	// Clear string first
	strName.Empty();

	// first we need to walk through the array till we get to the specified tab
	// then continue walking through array till we reach the end or hit a 0 0
	int nStart = GetTabIndex(nTab);
	int nIndex = nStart;
	int nItems = m_avi.GetSize();
	int nViews = 0;
	while (TRUE)
	{
		ViewInfo& rvi = GetViewInfo(nIndex);
		ULONG lngViewID = rvi.m_lngViewID;

		// Exit if we've reached the end of the views for this tab
		if (lngViewID == 0)
			break;

		ASSERT(lngViewID);

		BObject* pobjView = pDoc->GetObject(lngViewID);

		// Get view caption
		CString strView = pobjView->GetPropertyString(propCaption);
		if (strView.IsEmpty()) // if caption property is empty, just use the name
			strView = pobjView->GetPropertyString(propName);

		if (nViews > 0)
		{
			// Remove any ampersand so only first view name will get underline character.
			// (otherwise Windows will just underline the last &'d character in the string).
			strView.Remove(_T('&'));
			strName += ", "; 
			strName += strView;
		}
		else
		{			
			strName += strView;
		}

		nIndex++;
		nViews++;

		// Exit if we're past the end of the array
		if (nIndex >= nItems)
			break;
	}

	return TRUE;
}
Beispiel #9
0
bool
HTMLObjectElement::IsHTMLFocusable(bool aWithMouse,
                                   bool *aIsFocusable, int32_t *aTabIndex)
{
  // TODO: this should probably be managed directly by IsHTMLFocusable.
  // See bug 597242.
  nsIDocument *doc = GetComposedDoc();
  if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) {
    if (aTabIndex) {
      GetTabIndex(aTabIndex);
    }

    *aIsFocusable = false;

    return false;
  }

  // This method doesn't call nsGenericHTMLFormElement intentionally.
  // TODO: It should probably be changed when bug 597242 will be fixed.
  if (Type() == eType_Plugin || IsEditableRoot() ||
      (Type() == eType_Document && nsContentUtils::IsSubDocumentTabbable(this))) {
    // Has plugin content: let the plugin decide what to do in terms of
    // internal focus from mouse clicks
    if (aTabIndex) {
      GetTabIndex(aTabIndex);
    }

    *aIsFocusable = true;

    return false;
  }

  // TODO: this should probably be managed directly by IsHTMLFocusable.
  // See bug 597242.
  const nsAttrValue* attrVal = mAttrsAndChildren.GetAttr(nsGkAtoms::tabindex);

  *aIsFocusable = attrVal && attrVal->Type() == nsAttrValue::eInteger;

  if (aTabIndex && *aIsFocusable) {
    *aTabIndex = attrVal->GetIntegerValue();
  }

  return false;
}
PRBool
nsHTMLObjectElement::IsHTMLFocusable(PRBool *aIsFocusable, PRInt32 *aTabIndex)
{
  if (Type() == eType_Plugin) {
    // Has plugin content: let the plugin decide what to do in terms of
    // internal focus from mouse clicks
    if (aTabIndex) {
      GetTabIndex(aTabIndex);
    }
  
    *aIsFocusable = PR_TRUE;

    return PR_FALSE;
  }

  return nsGenericHTMLFormElement::IsHTMLFocusable(aIsFocusable, aTabIndex);
}
Beispiel #11
0
// Get the number of views on the specified tab
int BDataViews::GetViewCount(int nTab)
{
	ASSERT_VALID(this);
	ASSERT_VALID(&m_avi);

	int nStart = GetTabIndex(nTab);
	int nItems = m_avi.GetSize();
	int nViews = 0;
	for (int i = nStart; i < nItems; i++)
	{
		ViewInfo& rvi = m_avi[i];
		// Skip if this is a zero (indicates end of tab)
		if (rvi.m_lngViewID == 0)
			break;
		nViews++;
	}
	return nViews;
}
PRBool
nsHTMLSharedObjectElement::IsHTMLFocusable(PRBool *aIsFocusable,
                                           PRInt32 *aTabIndex)
{
  if (mNodeInfo->Equals(nsGkAtoms::embed) || Type() == eType_Plugin) {
    // Has plugin content: let the plugin decide what to do in terms of
    // internal focus from mouse clicks
    if (aTabIndex) {
      GetTabIndex(aTabIndex);
    }

    *aIsFocusable = PR_TRUE;

    // Let the plugin decide, so override.
    return PR_TRUE;
  }

  return nsGenericHTMLElement::IsHTMLFocusable(aIsFocusable, aTabIndex);
}
bool
HTMLSharedObjectElement::IsHTMLFocusable(bool aWithMouse,
                                         bool *aIsFocusable,
                                         int32_t *aTabIndex)
{
  if (mNodeInfo->Equals(nsGkAtoms::embed) || Type() == eType_Plugin) {
    // Has plugin content: let the plugin decide what to do in terms of
    // internal focus from mouse clicks
    if (aTabIndex) {
      GetTabIndex(aTabIndex);
    }

    *aIsFocusable = true;

    // Let the plugin decide, so override.
    return true;
  }

  return nsGenericHTMLElement::IsHTMLFocusable(aWithMouse, aIsFocusable, aTabIndex);
}