本文整理汇总了C++中GetSelectionRange函数的典型用法代码示例。如果您正苦于以下问题:C++ GetSelectionRange函数的具体用法?C++ GetSelectionRange怎么用?C++ GetSelectionRange使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetSelectionRange函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: GetMaskedCol
bool SjColumnMixer::GetSelectionAnchor(long& colIndex__, long& rowIndex__)
{
SjCol* currCol;
// verify stored anchor
if( m_selAnchorColIndex != -1 )
{
currCol = GetMaskedCol(m_selAnchorColIndex);
if( currCol == NULL )
{
m_selAnchorColIndex = -1; // recalculate anchor - this is no error!
}
else
{
if( m_selAnchorRowIndex<0 || m_selAnchorRowIndex>=currCol->m_rowCount
|| !currCol->m_rows[m_selAnchorRowIndex]->IsSelected() )
{
m_selAnchorColIndex = -1; // recalculate anchor - this is no error!
}
delete currCol;
}
}
// recalculate anchor if needed
if( m_selAnchorColIndex == -1 || GetSelectedUrlCount() == 1 )
{
GetSelectionRange(m_selAnchorColIndex, m_selAnchorRowIndex);
}
// done
colIndex__ = m_selAnchorColIndex;
rowIndex__ = m_selAnchorRowIndex;
return m_selAnchorColIndex!=-1;
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:35,代码来源:columnmixer.cpp
示例2: GetSelectionDirection
void
HTMLTextAreaElement::SetSelectionEnd(uint32_t aSelectionEnd, ErrorResult& aError)
{
if (mState.IsSelectionCached()) {
mState.GetSelectionProperties().mEnd = aSelectionEnd;
return;
}
nsAutoString direction;
nsresult rv = GetSelectionDirection(direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
int32_t start, end;
rv = GetSelectionRange(&start, &end);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
end = aSelectionEnd;
if (start > end) {
start = end;
}
rv = SetSelectionRange(start, end, direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:29,代码来源:HTMLTextAreaElement.cpp
示例3: GetSelectionDirection
void
HTMLTextAreaElement::SetSelectionEnd(const Nullable<uint32_t>& aSelectionEnd,
ErrorResult& aError)
{
int32_t selEnd = 0;
if (!aSelectionEnd.IsNull()) {
selEnd = aSelectionEnd.Value();
}
if (mState.IsSelectionCached()) {
mState.GetSelectionProperties().SetEnd(selEnd);
return;
}
nsAutoString direction;
nsresult rv = GetSelectionDirection(direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
int32_t start, end;
rv = GetSelectionRange(&start, &end);
if (NS_FAILED(rv)) {
aError.Throw(rv);
return;
}
end = selEnd;
if (start > end) {
start = end;
}
rv = SetSelectionRange(start, end, direction);
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:35,代码来源:HTMLTextAreaElement.cpp
示例4: NS_ENSURE_ARG_POINTER
NS_IMETHODIMP
nsHTMLTextAreaElement::GetSelectionEnd(PRInt32 *aSelectionEnd)
{
NS_ENSURE_ARG_POINTER(aSelectionEnd);
PRInt32 selStart;
return GetSelectionRange(&selStart, aSelectionEnd);
}
开发者ID:AllenDou,项目名称:firefox,代码行数:8,代码来源:nsHTMLTextAreaElement.cpp
示例5: GetSelectionRange
uint32_t
HTMLTextAreaElement::GetSelectionEnd(ErrorResult& aError)
{
int32_t selStart, selEnd;
nsresult rv = GetSelectionRange(&selStart, &selEnd);
if (NS_FAILED(rv) && mState.IsSelectionCached()) {
return mState.GetSelectionProperties().mEnd;
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return selEnd;
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:14,代码来源:HTMLTextAreaElement.cpp
示例6: GetSelectionRange
Nullable<uint32_t>
HTMLTextAreaElement::GetSelectionStart(ErrorResult& aError)
{
int32_t selStart, selEnd;
nsresult rv = GetSelectionRange(&selStart, &selEnd);
if (NS_FAILED(rv) && mState.IsSelectionCached()) {
return Nullable<uint32_t>(mState.GetSelectionProperties().GetStart());
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
return Nullable<uint32_t>(selStart);
}
开发者ID:alphan102,项目名称:gecko-dev,代码行数:14,代码来源:HTMLTextAreaElement.cpp
示例7: if
void
HTMLTextAreaElement::SetSelectionDirection(const nsAString& aDirection, ErrorResult& aError)
{
if (mState.IsSelectionCached()) {
nsITextControlFrame::SelectionDirection dir = nsITextControlFrame::eNone;
if (aDirection.EqualsLiteral("forward")) {
dir = nsITextControlFrame::eForward;
} else if (aDirection.EqualsLiteral("backward")) {
dir = nsITextControlFrame::eBackward;
}
mState.GetSelectionProperties().mDirection = dir;
return;
}
int32_t start, end;
nsresult rv = GetSelectionRange(&start, &end);
if (NS_SUCCEEDED(rv)) {
rv = SetSelectionRange(start, end, aDirection);
}
if (NS_FAILED(rv)) {
aError.Throw(rv);
}
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:23,代码来源:HTMLTextAreaElement.cpp
示例8: GetValueInternal
void
HTMLTextAreaElement::SetRangeText(const nsAString& aReplacement,
uint32_t aStart, uint32_t aEnd,
const SelectionMode& aSelectMode,
ErrorResult& aRv, int32_t aSelectionStart,
int32_t aSelectionEnd)
{
if (aStart > aEnd) {
aRv.Throw(NS_ERROR_DOM_INDEX_SIZE_ERR);
return;
}
nsAutoString value;
GetValueInternal(value, false);
uint32_t inputValueLength = value.Length();
if (aStart > inputValueLength) {
aStart = inputValueLength;
}
if (aEnd > inputValueLength) {
aEnd = inputValueLength;
}
if (aSelectionStart == -1 && aSelectionEnd == -1) {
aRv = GetSelectionRange(&aSelectionStart, &aSelectionEnd);
if (aRv.Failed()) {
if (mState.IsSelectionCached()) {
aSelectionStart = mState.GetSelectionProperties().mStart;
aSelectionEnd = mState.GetSelectionProperties().mEnd;
aRv = NS_OK;
}
}
}
if (aStart <= aEnd) {
value.Replace(aStart, aEnd - aStart, aReplacement);
SetValueInternal(value, false);
}
uint32_t newEnd = aStart + aReplacement.Length();
int32_t delta = aReplacement.Length() - (aEnd - aStart);
switch (aSelectMode) {
case mozilla::dom::SelectionMode::Select:
{
aSelectionStart = aStart;
aSelectionEnd = newEnd;
}
break;
case mozilla::dom::SelectionMode::Start:
{
aSelectionStart = aSelectionEnd = aStart;
}
break;
case mozilla::dom::SelectionMode::End:
{
aSelectionStart = aSelectionEnd = newEnd;
}
break;
case mozilla::dom::SelectionMode::Preserve:
{
if ((uint32_t)aSelectionStart > aEnd) {
aSelectionStart += delta;
} else if ((uint32_t)aSelectionStart > aStart) {
aSelectionStart = aStart;
}
if ((uint32_t)aSelectionEnd > aEnd) {
aSelectionEnd += delta;
} else if ((uint32_t)aSelectionEnd > aStart) {
aSelectionEnd = newEnd;
}
}
break;
}
Optional<nsAString> direction;
SetSelectionRange(aSelectionStart, aSelectionEnd, direction, aRv);
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:80,代码来源:HTMLTextAreaElement.cpp
示例9: SelectShifted
bool SjColumnMixer::SelectShifted(int keyPressed/*-1=up, +1=down*/, long& retScopeColIndex, long& retScopeRowIndex)
{
long firstSelColIndex, firstSelRowIndex,
lastSelColIndex, lastSelRowIndex;
bool prevNextOk;
// get selection anchor and the first/last selected row
if( !GetSelectionAnchor(firstSelColIndex/*dummy*/, firstSelRowIndex/*dummy*/)
|| !GetSelectionRange(firstSelColIndex, firstSelRowIndex, &lastSelColIndex, &lastSelRowIndex) )
{
return FALSE; // no anchor, the caller should preform a "simple" selection
}
// calculate the new selection...
if( firstSelColIndex == lastSelColIndex && firstSelRowIndex == lastSelRowIndex )
{
if( keyPressed == -1 )
{
// ...initial selection from anchor to top
prevNextOk = PrevNextRow(firstSelColIndex, firstSelRowIndex, -1);
retScopeColIndex = firstSelColIndex;
retScopeRowIndex = firstSelRowIndex;
}
else
{
// ...initial selection from anchor to bottom
prevNextOk = PrevNextRow(lastSelColIndex, lastSelRowIndex, +1);
retScopeColIndex = lastSelColIndex;
retScopeRowIndex = lastSelRowIndex;
}
}
else if( firstSelColIndex < m_selAnchorColIndex
|| (firstSelColIndex == m_selAnchorColIndex && firstSelRowIndex < m_selAnchorRowIndex) )
{
// ...selected stuff above the anchor...
prevNextOk = PrevNextRow(firstSelColIndex, firstSelRowIndex, keyPressed);
retScopeColIndex = firstSelColIndex;
retScopeRowIndex = firstSelRowIndex;
}
else
{
// ...select stuff below the anchor...
prevNextOk = PrevNextRow(lastSelColIndex, lastSelRowIndex, keyPressed);
retScopeColIndex = lastSelColIndex;
retScopeRowIndex = lastSelRowIndex;
}
if( prevNextOk )
{
// set the new selection
SetSelectionRange(firstSelColIndex, firstSelRowIndex, lastSelColIndex, lastSelRowIndex, TRUE);
// make sure, the anchor is always selected
SjCol* col = GetMaskedCol(m_selAnchorColIndex);
if( col )
{
if( m_selAnchorRowIndex >= 0 && m_selAnchorRowIndex < col->m_rowCount )
{
col->m_rows[m_selAnchorRowIndex]->Select(TRUE);
}
delete col;
}
}
return TRUE;
}
开发者ID:antonivich,项目名称:Silverjuke,代码行数:70,代码来源:columnmixer.cpp
示例10: GetSelectionRange
Nullable<uint32_t> HTMLTextAreaElement::GetSelectionEnd(ErrorResult& aError) {
uint32_t selStart, selEnd;
GetSelectionRange(&selStart, &selEnd, aError);
return Nullable<uint32_t>(selEnd);
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:5,代码来源:HTMLTextAreaElement.cpp
注:本文中的GetSelectionRange函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论