本文整理汇总了C++中ShowCaret函数的典型用法代码示例。如果您正苦于以下问题:C++ ShowCaret函数的具体用法?C++ ShowCaret怎么用?C++ ShowCaret使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ShowCaret函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowCursor
static void ShowCursor(void)
{
CreateCaret(CrtWindow, 0, CharSize.x, 2);
SetCaretPos((_Cursor.x - _Origin.x) * CharSize.x,
(_Cursor.y - _Origin.y) * CharSize.y + CharAscent);
ShowCaret(CrtWindow);
}
示例2: _DisplayCursor
/*
* _DisplayCursor - show the current cursor position
*/
void _DisplayCursor( LPWDATA w )
{
HDC dc;
SIZE size;
dc = GetDC( w->hwnd );
SelectObject( dc, _FixedFont );
#ifdef _MBCS
#ifdef __NT__
GetTextExtentPoint32( dc, w->tmpbuff->data,
FAR_mbsnbcnt( (LPBYTE)w->tmpbuff->data,w->buffoff+w->curr_pos),
&size );
#else
GetTextExtentPoint( dc, w->tmpbuff->data,
FAR_mbsnbcnt( (LPBYTE)w->tmpbuff->data, w->buffoff + w->curr_pos),
&size );
#endif
#else
#ifdef __NT__
GetTextExtentPoint32( dc, w->tmpbuff->data, w->buffoff+w->curr_pos,
&size );
#else
GetTextExtentPoint( dc, w->tmpbuff->data, w->buffoff+w->curr_pos,
&size );
#endif
#endif
SetCaretPos( size.cx+1, (w->LastLineNumber-w->TopLineNumber)*w->ychar );
ReleaseDC( w->hwnd, dc );
ShowCaret( w->hwnd );
} /* _DisplayCursor */
示例3: DisplayCaret
void DisplayCaret( LPCLASSDATA lpcd, BOOL bShow )
{
/*
* Only when we have the focus.
*/
if ( lpcd->bHasFocus == FALSE )
return;
/*
* Anything changed?
*/
if ( bShow != lpcd->bCaretVisible )
{
/*
* Change it.
*/
if (( lpcd->bCaretVisible = bShow ) == TRUE )
{
int cy = ( Parser->nCaretType == CARET_HORIZONTAL && ! lpcd->bOverwrite ) ? Parser->szCharSize.cy - ( 2 * GetSystemMetrics( SM_CYBORDER )) : 0;
SetCaretPos( GetMarginWidth( lpcd ) + GetLineMarginWidth( lpcd ) + (( GetCaretOffset( lpcd, lpcd->ptCaretPos.x ) - lpcd->ptViewPos.x ) * Parser->szCharSize.cx ), ( lpcd->ptCaretPos.y - lpcd->ptViewPos.y ) * Parser->szCharSize.cy + cy );
ShowCaret( lpcd->hWnd );
}
else
HideCaret( lpcd->hWnd );
}
/*
* Send caret position message.
*/
SendCaretMessage( lpcd );
}
示例4: SetFocus
void CHexEdit::OnLButtonDown(UINT nFlags, CPoint point)
{
SetFocus();
if(!m_pData)
return;
CPoint pt = CalcPos(point.x, point.y);
if(pt.x > -1)//点合法
{
m_editPos = pt;
pt.x *= m_nullWidth;
pt.y *= m_lineHeight;
if(pt.x == 0 && m_bShowAddress)
CreateAddressCaret();
else
CreateEditCaret();
if(nFlags & MK_SHIFT)//按下SHIFT
m_selEnd = m_currentAddress;
else
{
m_selStart= m_currentAddress;
m_selEnd = m_selStart;
//if(DragDetect(m_hWnd,point))//按下左键时拖动
if(DragDetect(point))//按下左键时拖动
SetCapture();
}
SetCaretPos(pt);
ShowCaret();
Invalidate(FALSE);
}
}
示例5: NOTEPAD_OnSetFocus
/***********************************************************************
* NOTEPAD_SetFocus
*
* WM_SETFOCUS window message handle function
*
* ARGUMENTS:
* - handle of window:
* HWND hWnd
* - (not used):
* HWND lostFocusWnd
* RETURNS: none
*/
static void NOTEPAD_OnSetFocus(HWND hWnd, HWND lostFocusWnd)
{
CreateCaret(hWnd, NULL, 0, Globals.CharH);
//SetCaretPos(marginX + caretXpos * tm.tmAveCharWidth, caretYpos * tm.tmHeight + marginY);
SendMessage(Globals.hMainWnd, WM_KEYDOWN, 0, 0); // Restore caret position
ShowCaret(hWnd);
}
示例6: SetCaretPos
void CChildView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
if ( nChar == VK_RETURN ) //return 키
{
pCaret.y += cyChar;
pCaret.x = 0;
SetCaretPos( pCaret );
return ;
}
CClientDC dc(this);
CFont* old = (CFont*)dc.SelectStockObject( SYSTEM_FIXED_FONT );
// 출력전에 caret 감추기.
HideCaret();
char msg[] = { nChar }; // 1개의 문자를 문자열로 바꾸기.
dc.TextOut( pCaret.x, pCaret.y, msg, 1);
pCaret.x += cxChar;
SetCaretPos( pCaret );
ShowCaret(); // 출력후 다시 Caret를 보여 준다.
dc.SelectObject( old); // dc 복구.
}
示例7: FaderSetPosition
void FaderSetPosition( HWND hFader, int nPos )
/////////////////////////////////////////////////////////////////////////////
{
PFADERINFO pFI;
HDC hDC;
pFI = (PFADERINFO)GetWindowLong( hFader, GWL_USERDATA );
if( !pFI )
return;
if( !pFI->nMax )
return;
pFI->nPos = nPos;
if( pFI->bHasFocus )
HideCaret( hFader );
hDC = GetDC( hFader );
// MoveKnob updates pFI->nBitmapPos
MoveKnob( hDC, (pFI->nMax - pFI->nPos) * (pFI->nWindowY - pFI->bmFader.bmHeight) / pFI->nMax, pFI );
ReleaseDC( hFader, hDC );
if( pFI->bHasFocus )
{
SetCaretPos( pFI->nBitmapX + 2, pFI->nBitmapPos + (CARET_OFFSET/2) );
ShowCaret( hFader );
}
}
示例8: wlog
void wlog(const char* buffer){
char* buf;
int hloglen=GetWindowTextLength(hlog)+1;
int slen=strlen(buffer)+1;
if(slen<30000){
buf= new char[2];//hloglen+slen+1];
buf = (char*)Mrealloc(buf,hloglen+slen+1);
memset(buf,0,hloglen+slen+1);
if((hloglen+slen)<30000)GetWindowText(hlog,buf,hloglen);
else{
char* tmpbuf=new char[2];tmpbuf = (char*)Mrealloc(tmpbuf,hloglen+1);GetWindowText(hlog,&tmpbuf[0],hloglen);
//int oldsize;oldsize=sizeof(globallog);
globallog = (char*)Mrealloc(globallog,hloglen+globallogsize+1);
memcpy(&globallog[globallogsize],tmpbuf,hloglen-1);globallogsize+=hloglen;
}
lstrcat(buf,buffer);
SetWindowText(hlog, buf);
Edit_Scroll(hlog,Edit_GetLineCount(hlog),0);
int wlen=GetWindowTextLength(hlog);
Edit_SetSel(hlog,wlen-1,wlen);
Edit_SetSel(hlog,wlen,wlen);
SetFocus(hlog);
ShowCaret(hlog);
delete[] buf;
}
}
示例9: ME_LButtonDown
void ME_LButtonDown(ME_TextEditor *editor, int x, int y)
{
ME_Cursor tmp_cursor;
int is_selection = 0;
editor->nUDArrowX = -1;
y += ME_GetYScrollPos(editor);
tmp_cursor = editor->pCursors[0];
is_selection = ME_IsSelection(editor);
ME_FindPixelPos(editor, x, y, &editor->pCursors[0], &editor->bCaretAtEnd);
if (GetKeyState(VK_SHIFT)>=0)
{
editor->pCursors[1] = editor->pCursors[0];
}
else
{
if (!is_selection) {
editor->pCursors[1] = tmp_cursor;
is_selection = 1;
}
}
ME_InvalidateSelection(editor);
HideCaret(editor->hWnd);
ME_MoveCaret(editor);
ShowCaret(editor->hWnd);
ME_ClearTempStyle(editor);
ME_SendSelChange(editor);
}
示例10: WCUSER_PosCursor
/******************************************************************
* WCUSER_PosCursor
*
* Set a new position for the cursor
*/
static void WCUSER_PosCursor(const struct inner_data* data)
{
if (PRIVATE(data)->hWnd != GetFocus() || !data->curcfg.cursor_visible) return;
SetCaretPos((data->cursor.X - data->curcfg.win_pos.X) * data->curcfg.cell_width,
(data->cursor.Y - data->curcfg.win_pos.Y) * data->curcfg.cell_height);
ShowCaret(PRIVATE(data)->hWnd);
}
示例11: MyShowCaret
/*
* MyShowCaret - ShowCaret w/o additive effects
*/
void MyShowCaret( window_id wid )
{
if( !caretDisplayed && !caretKilled ) {
ShowCaret( wid );
caretDisplayed = true;
}
} /* MyShowCaret */
示例12: MyRaiseCaret
void MyRaiseCaret( window_id wid )
{
if( caretKilled ) {
ShowCaret( wid );
caretKilled = false;
MyShowCaret( wid );
}
}
示例13: ITextHostImpl_TxShowCaret
DECLSPEC_HIDDEN BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow)
{
ITextHostImpl *This = impl_from_ITextHost(iface);
if (fShow)
return ShowCaret(This->hWnd);
else
return HideCaret(This->hWnd);
}
示例14: SetFocus
void CHexEditor::OnLButtonDown(UINT nFlags, CPoint point)
{
SetFocus();
if(!m_pData)
return;
if(nFlags & MK_SHIFT)
{
m_selStart = m_currentAddress;
}
CPoint pt = CalcPos(point.x, point.y);
if(pt.x > -1)
{
m_editPos = pt;
pt.x *= m_nullWidth;
pt.y *= m_lineHeight;
if(pt.x == 0 && m_bShowAddress)
CreateAddressCaret();
else
CreateEditCaret();
SetCaretPos(pt);
if(nFlags & MK_SHIFT)
{
m_selEnd = m_currentAddress;
if(m_currentMode == EDIT_HIGH || m_currentMode == EDIT_LOW)
m_selEnd++;
RedrawWindow();
}
}
if(!(nFlags & MK_SHIFT))
{
#ifdef _VS6_USED
if(DragDetect(this->m_hWnd, point))
#else
if(DragDetect(point))
#endif
{
m_selStart = m_currentAddress;
m_selEnd = m_selStart;
SetCapture();
}
else
{
BOOL bsel = m_selStart != 0xffffffff;
m_selStart = 0xffffffff;
m_selEnd = 0xffffffff;
if(bsel)
RedrawWindow();
}
}
if(!IsSelected())
{
ShowCaret();
}
}
示例15: ImeUIClearData
//**********************************************************************
//
// void ImeUIClearData()
//
// Handler routine of WM_IME_SELECT message.
//
//**********************************************************************
void ImeUIClearData(
HWND hwnd )
{
RECT rect;
int i;
SetWindowText( hwnd, szSteTitle );
//
// If user switches to other IME, here we destroy all candidate
// windows which has been opened and erase all composition
// chars if any.
//
for( i = 0; i < MAX_LISTCAND; i++ )
{
if ( gImeUIData.hListCand[ i ] )
{
//
// The i-th candidate list has already been displayed,
// destroy it and free memory which stores candidate
// strings.
//
DestroyWindow( gImeUIData.hListCand[ i] );
GlobalFree( gImeUIData.hListCandMem[ i ] );
gImeUIData.hListCand[ i ] =
gImeUIData.hListCandMem[ i ] = NULL;
}
}
//
// Update client area.
//
GetClientRect( hwnd, &rect );
InvalidateRect( hwnd, &rect, FALSE );
//
// Reset IMEUI's global data.
//
gImeUIData.uCompLen = gImeUIData.ImeState = 0;
//
// Reset caret to the original position.
//
HideCaret( hwnd );
ResetCaret( hwnd );
ShowCaret( hwnd );
}