// Set the enabled state of the window void SetEnable(HWND hWnd, UINT id, bool b) { // Validate arguments if (hWnd == NULL) { return; } if (b == false) { if (IsEnable(hWnd, id)) { EnableWindow(DlgItem(hWnd, id), false); Refresh(DlgItem(hWnd, id)); } } else { if (IsDisable(hWnd, id)) { EnableWindow(DlgItem(hWnd, id), true); Refresh(DlgItem(hWnd, id)); } } }
void CIcon::Update( POINT ptMouse ) { if( IsEnable() ) m_dwIconDrawColor = m_dwIconDrawColor_Ori; else m_dwIconDrawColor = m_dwIconDrawColor_Gray; }
void GuiLabel::SetEnable(PLbool value) { if (value != IsEnable()) { sCaption.SetFontColor(value?cFontColor:cFontColorDisable); GuiEnControl::SetEnable(value); } }
void GuiLabel::AfterLoad() { GuiControl::AfterLoad(); sCaption.Lock(); // do lock sCaption.SetFontColor(IsEnable()?cFontColor:cFontColorDisable); sCaption.SetRenderRect(GetLeft(), GetTop(), GetWidth(), GetHeight()); sCaption.Unlock(); }
void CProgressBar::DoRender() { super::DoRender(); CTextureFrag* pFrag = m_fragForeGround.GetTextureFrag(); if (pFrag && pFrag->Texture()) { CWindowManager::GetInstance()->RenderTextureControl( pFrag, IsGrid9Scale(), GetGrid9ScaleOffset(), &m_foreQuadp, &m_foreQuadt, GetColor( m_bUseInheritColorScale ), IsClip(), !IsEnable(), GetClipRect(), &GetWorldTM() ); } }
bool GuiCheckbox::OnMouseDown(PLfloat x, PLfloat y, PLMouseButton button) { if (IsEnable()) { bChecked = !bChecked; OnChecked(bChecked); SetChangeFlag(); } return GuiEnControl::OnMouseDown(x, y, button); }
void SQRCheckButton::DrawWndBackground() { m_beBGDrawed = true; //处于选中状态 if( m_bCheck ) DrawBackImage( m_hWnd->m_Enable, m_hWnd->m_Disable, m_MouseOverImage, m_ClickDownImage, IsHeld() ); else { CFPos pt = GetCursorPos(); if( IsHeld() ) { SetEventStateMask(IP_UNCHECK_CLICKDOWN); DrawRect( m_UncheckClickDownImage ); } else if( IsInWndArea( pt.x, pt.y ) && IsEnable() && IsLastMouseMsgWnd() ) { SetEventStateMask(IP_UNCHECK_MOUSEOVER); DrawRect( m_UncheckMouseOverImage ); } else if( !IsEnable() ) { SetEventStateMask(IP_UNCHECK_DISABLE); DrawRect( m_UncheckDisableImage ); } else if( m_uFlashCircle && m_uFlashEndTime - m_uFlashStartTime > uint32(GetProcessTime()) - m_uFlashStartTime ) { float fAlpha = GetTransparent(); float fWeight = abs( (float)( ( uint32(GetProcessTime()) - m_uFlashStartTime )%( m_uFlashCircle*2 ) - m_uFlashCircle ) )/m_uFlashCircle; SetTransparent( fAlpha*fWeight ); SetEventStateMask(IP_UNCHECK_ENABLE); DrawRect( m_UncheckEnableImage ); SetTransparent( fAlpha*( 1.0f - fWeight ) ); SetEventStateMask(IP_UNCHECK_MOUSEOVER); DrawRect( m_UncheckMouseOverImage ); SetTransparent( fAlpha ); } else { SetEventStateMask(IP_UNCHECK_ENABLE); DrawRect( m_UncheckEnableImage ); } } }
void SQRButton::DrawBackImage( WND_IMAGE_LIST& Enable, WND_IMAGE_LIST& Disable, WND_IMAGE_LIST& MouseOver, WND_IMAGE_LIST& ClickDown, bool bClick ) { if(!Enable.IsImageLoadValid()&&!Disable.IsImageLoadValid()) return; CFPos pt = GetCursorPos(); if( bClick ) { SetEventStateMask(IP_CLICKDOWN); DrawRect( ClickDown ); } else if( IsInWndArea( pt.x, pt.y ) && IsEnable() && IsLastMouseMsgWnd() ) { SetEventStateMask(IP_MOUSEOVER); DrawRect( MouseOver ); } else if( !IsEnable() ) { SetEventStateMask(IP_DISABLE); DrawRect( Disable ); } else if( m_uFlashCircle && m_uFlashEndTime - m_uFlashStartTime > uint32(GetProcessTime()) - m_uFlashStartTime ) { float fAlpha = GetTransparent(); float fWeight = abs( (float)( ( uint32(GetProcessTime()) - m_uFlashStartTime )%( m_uFlashCircle*2 ) - m_uFlashCircle ) )/m_uFlashCircle; SetTransparent( fAlpha*fWeight ); SetEventStateMask(IP_ENABLE); DrawRect( Enable ); SetTransparent( fAlpha*( 1.0f - fWeight ) ); DrawRect( MouseOver ); SetTransparent( fAlpha ); } else { SetEventStateMask(IP_ENABLE); DrawRect( Enable ); } if( m_bFirstMouseOver && GetEventStateMask() == IP_MOUSEOVER ) OnPlayWndSound( eMS_MouseOver ); m_bFirstMouseOver = GetEventStateMask() == IP_MOUSEOVER ? false : true; }
// // 更新 // VOID CAffectorBase::Update(FLOAT deltaTime) { m_delta -= deltaTime; if (m_delta < EPSILON_E3) { m_delta = m_step; m_bActive = IsEnable() && IsPlaying() ? TRUE : FALSE; } else { m_bActive = FALSE; } }
void CBfDrawButton::DrawBtnText() { if (IsEnable()) m_WndTextInfo.TextColor = Color(254, 0, 0, 0); else m_WndTextInfo.TextColor = Color(254, 128, 128, 128); m_WndTextInfo.TextRectF = CUiMethod::CRect2RectF(m_WndRect); m_WndTextInfo.TextRectF.Y += 1; CGdiPlusDraw::DrawWndText(m_pDoGrap, m_WndTextInfo); }
void CCWidget::Draw(CCDrawContext* pDC){ if(m_bVisible==false) return; unsigned char nLastOpacity; nLastOpacity = pDC->GetOpacity(); sRect sr = GetScreenRect(); pDC->SetOrigin(sPoint(sr.x, sr.y)); if(m_pFont!=NULL) pDC->SetFont(m_pFont); else pDC->SetFont(CCFontManager::Get(NULL)); pDC->SetOpacity((unsigned char)(nLastOpacity * (float)(m_iOpacity / 255.0f))); if(!IsEnable()) pDC->SetOpacity((unsigned char)(pDC->GetOpacity()*0.70)); bool bIntersect = true; sRect rectScreen(0, 0, CCGetWorkspaceWidth()-1, CCGetWorkspaceHeight()-1); sRect PrevClipRect; if(GetParent()!=NULL) { sRect parentClipRect = CCClientToScreen(GetParent(), GetParent()->GetClientRect()); bIntersect = rectScreen.Intersect(&PrevClipRect,parentClipRect); }else PrevClipRect = rectScreen; sRect CurrClipRect = GetScreenRect(); sRect IntersectClipRect; if(m_bClipByParent==true){ if(PrevClipRect.Intersect(&IntersectClipRect, CurrClipRect)==true){ sRect test = IntersectClipRect; if(IntersectClipRect.w>0 && IntersectClipRect.h>0) { pDC->SetClipRect(IntersectClipRect); OnDraw(pDC); } } } else{ pDC->SetClipRect(CurrClipRect); OnDraw(pDC); } for(int i=0; i<m_Children.GetCount(); i++){ CCWidget* pCurWnd = m_Children.Get(i); if(pCurWnd==GetLatestExclusive()) continue; if(pCurWnd != NULL ) pCurWnd->Draw(pDC); } if(GetLatestExclusive()!=NULL) GetLatestExclusive()->Draw(pDC); pDC->SetOpacity(nLastOpacity); }
void CConfiger::SendToGS( long lSocketID ) const { if( !IsEnable() ) { return ; } CMessage msg( MSG_W2S_SERVER_SENDSETUP ); msg.Add( (long) SI_FBUSINESS ); DBWriteSet db; msg.GetDBWriteSet( db ); Encode( db ); msg.SendToSocket( lSocketID ); }
//---------------------------------------------------------------------------- //! @brief ストリームの設定を行う //! @return エラーコード //---------------------------------------------------------------------------- HRESULT CWMOutput::SetStream(void) { WMT_STREAM_SELECTION wmtSS = WMT_ON; HRESULT hr = S_OK; if( IsEnable() ) { if( FAILED( hr = WMReader()->SetStreamsSelected( 1, &m_StreamNum, &wmtSS ) ) ) return( hr ); if( FAILED(hr = WMReader()->SetReadStreamSamples( m_StreamNum, TRUE ) ) ) return( hr ); } return hr; }
void cgUIButton::DrawBackground( const cgRectF& clipRect ) { if (IfFillBackground()) { cgColor uDrawColor = m_uBackColor; if (!IsEnable()) uDrawColor = m_uDisableColor; else if (IsClickDown()) uDrawColor = m_uPressColor; else if (IsMouseOver()) uDrawColor = m_uHotColor; cgUIRender::GetRender()->FillRect(clipRect, uDrawColor); } }
void SQRButton::DrawWndText() { CFPos pt = GetCursorPos(); CFRect rt; GetWndRect( rt ); rt.right -= rt.left; rt.bottom -= rt.top; rt.left = rt.top = 0.0f; if( IsHeld() ) DrawText( GetWndTextW(), m_ClickDownColor, m_ClickDownBcColor ); else if( IsInWndArea( pt.x, pt.y ) && IsEnable() && IsLastMouseMsgWnd() ) DrawText( GetWndTextW(), m_MouseOverColor, m_MouseOverBcColor ); else SQRWnd::DrawWndText(); }
void GuiCheckbox::Render(const TMatrix4x4f& pViewMatrix) { if (!vboCheckImg) InitCheckImg(); RefTexture img(IsEnable()?(bChecked?tImgDown:tImgUp):(bChecked?tImgDownNE:tImgUpNE)); SetViewMatrix(pViewMatrix*GetAdjMatrix()); DrawImage(tImgFone, GetVertexObj(), GetStdTextureObj(), cColor); DrawImage(img, vboCheckImg, GetStdTextureObj(), cColor); sCaption.Render(*this,pViewMatrix); GuiEnControl::Render(pViewMatrix); }
void cgUIButton::DrawBackPic(const cgRectF& clipRect) { cgUIWidget::DrawBackPic(clipRect); cgUIImagePtr ptr; if (!IsEnable()) ptr = m_spDisablePic; else if (IsClickDown()) ptr = m_spPressPic; else if (IsMouseOver()) ptr = m_spHotPic; else ptr = m_spNormalPic; DoDrawPic(ptr, m_kRect, clipRect); }
hj_bool clsRigitBody::ApplyForce() { if( IsEnable() ){ return false; } // �d�� const hj::stcVector3 orsGravity = (m_pcRegistWorld != NULL) ? m_pcRegistWorld->GetGravity() : m_sGravity; m_sSpeed += orsGravity; // ���x���� m_sSpeed *= m_f32DumpingSpeed; // �ʒu m_sPosition += m_sSpeed; return true; }
// Examine whether the Window is disabled bool IsDisable(HWND hWnd, UINT id) { return IsEnable(hWnd, id) ? false : true; }
void GuiCheckbox::OnChecked(PLbool state) { if (IsEnable() && pfOnCheckedFunc) pfOnCheckedFunc(this, state); }
// License dialog UINT EmLicenseDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { RPC *s = (RPC *)param; NMHDR *n; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: EmLicenseDlgInit(hWnd, s); break; case WM_NOTIFY: n = (NMHDR *)lParam; switch (n->code) { case LVN_ITEMCHANGED: switch (n->idFrom) { case L_LIST: case L_STATUS: EmLicenseDlgUpdate(hWnd, s); break; } break; } break; case WM_COMMAND: switch (wParam) { case IDOK: if (IsEnable(hWnd, IDOK)) { UINT i = LvGetSelected(hWnd, L_LIST); if (i != INFINITE) { char *s = LvGetStrA(hWnd, L_LIST, i, 5); char tmp[MAX_SIZE]; Format(tmp, sizeof(tmp), _SS("LICENSE_SUPPORT_URL"), s); ShellExecute(hWnd, "open", tmp, NULL, NULL, SW_SHOW); Free(s); } } break; case B_OBTAIN: ShellExecute(hWnd, "open", _SS("LICENSE_INFO_URL"), NULL, NULL, SW_SHOW); break; case B_ADD: if (EmLicenseAdd(hWnd, s)) { EmLicenseDlgRefresh(hWnd, s); } break; case B_DEL: if (IsEnable(hWnd, B_DEL)) { UINT id = (UINT)LvGetParam(hWnd, L_LIST, LvGetSelected(hWnd, L_LIST)); if (id != 0) { if (MsgBox(hWnd, MB_ICONQUESTION | MB_YESNO | MB_DEFBUTTON2, _UU("SM_LICENSE_DELETE_MSG")) == IDYES) { RPC_TEST t; Zero(&t, sizeof(t)); t.IntValue = id; if (CALL(hWnd, EcDelLicenseKey(s, &t))) { EmLicenseDlgRefresh(hWnd, s); } } } } break; case IDCANCEL: Close(hWnd); break; } break; case WM_CLOSE: EndDialog(hWnd, 0); break; } LvStandardHandler(hWnd, msg, wParam, lParam, L_LIST); return 0; }
// Main dialog procedure UINT EmMainDlg(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { NMHDR *n; RPC *r = (RPC *)param; UINT i; char *name; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: EmMainInit(hWnd, r); break; case WM_COMMAND: switch (wParam) { case IDOK: // Edit i = LvGetSelected(hWnd, L_LIST); if (i != INFINITE) { wchar_t *tmp; tmp = LvGetStr(hWnd, L_LIST, i, 0); if (tmp != NULL) { name = CopyUniToStr(tmp); EmAdd(hWnd, r, name); Free(tmp); Free(name); } } break; case B_PASSWORD: // Admin password Dialog(hWnd, D_EM_PASSWORD, EmPasswordDlg, r); break; case B_LICENSE: // Admin password Dialog(hWnd, D_EM_LICENSE, EmLicenseDlg, r); break; case B_ADD: // Add EmAdd(hWnd, r, NULL); EmMainRefresh(hWnd, r); break; case B_DELETE: // Delete i = LvGetSelected(hWnd, L_LIST); if (i != INFINITE) { wchar_t *tmp; tmp = LvGetStr(hWnd, L_LIST, i, 0); if (tmp != NULL) { RPC_DELETE_DEVICE t; wchar_t msg[MAX_SIZE]; name = CopyUniToStr(tmp); UniFormat(msg, sizeof(msg), _UU("EM_DELETE_CONFIRM"), name); if (MsgBox(hWnd, MB_YESNO | MB_ICONEXCLAMATION | MB_DEFBUTTON2, msg) == IDYES) { Zero(&t, sizeof(t)); StrCpy(t.DeviceName, sizeof(t.DeviceName), name); if (CALL(hWnd, EcDelDevice(r, &t))) { EmMainRefresh(hWnd, r); } } Free(tmp); Free(name); } } break; case IDCANCEL: Close(hWnd); break; } break; case WM_TIMER: switch (wParam) { case 1: KillTimer(hWnd, 1); EmMainRefresh(hWnd, r); SetTimer(hWnd, 1, 1000, NULL); break; } break; case WM_NOTIFY: n = (NMHDR *)lParam; switch (n->code) { case NM_DBLCLK: switch (n->idFrom) { case L_LIST: if (IsEnable(hWnd, IDOK)) { Command(hWnd, IDOK); } break; } break; case LVN_ITEMCHANGED: switch (n->idFrom) { case L_LIST: EmMainUpdate(hWnd, r); break; } break; } break; case WM_CLOSE: EndDialog(hWnd, 0); break; } return 0; }
void GuiCheckbox::AfterLoad() { GuiEnControl::AfterLoad(); sCaption.Lock(); // do lock sCaption.SetFontColor(IsEnable()?cFontColor:cFontColorDisable); }
//window message process function LRESULT SLEditCtrlProc( HWND hWnd, int iMsg, WPARAM wParam, LPARAM lParam ) { PWindowsTree pWin; char* buffer; POINT point; PSLEditData pEditData; HPEN hPen; HBRUSH hBrush; COLORREF crColor; PWNDCLASSEX pWndClass; LRESULT res; char* passwdchar; int dispLen,len,iBorder; char* dispBuffer; HDC hDC; RECT rect; PAINTSTRUCT ps; pWin = (PWindowsTree)hWnd; switch(iMsg){ case LMSG_CREATE: pWin = (PWindowsTree)hWnd; pEditData = (void*)malloc(sizeof(SLEditData)); if(!pEditData) return false; if (!CreateCaret (hWnd, NULL, 1, GetSysCharHeight())){ printerror ("EDIT: Create Caret error!\n"); free (pEditData); return -1; } memset(pEditData,0,sizeof(SLEditData)); pEditData->iBufferLen = LEN_EDITBOX_BUFFER; pEditData->passwdChar = '*'; pEditData->iLeftMargin = MARGIN_EDIT_LEFT; pEditData->iTopMargin = MARGIN_EDIT_TOP; pEditData->iRightMargin = MARGIN_EDIT_RIGHT; pEditData->iBottomMargin = MARGIN_EDIT_BOTTOM; // memcpy (pEditData->buffer, pWin->lpszCaption,min (pEditData->iBufferLen, strlen(pWin->lpszCaption)+1); strncpy (pEditData->buffer, pWin->lpszCaption,pEditData->iBufferLen-1);//modify pWin->rect.bottom = pWin->rect.top + GetSysCharHeight() + MARGIN_EDIT_TOP + MARGIN_EDIT_BOTTOM + 2 * wndGetBorder(hWnd); pWin->dwData = (DWORD)pEditData; SetTimer(hWnd,1,50); break; case LMSG_TIMER: BlinkCaret(hWnd); break; case LMSG_DESTROY: free((void*)(pWin->dwData)); DestroyCaret(hWnd); KillTimer(hWnd,1); break; case LMSG_ERASEBKGND: pWndClass=GetRegClass(pWin->lpszClassName); if(!pWndClass) return (LRESULT)NULL; //is Enable ? hBrush=pWndClass->hbrBackground; crColor=((BRUSH*)hBrush)->crBrushColor; if(!IsEnable(hWnd)) ((BRUSH*)hBrush)->crBrushColor=RGB_SYSTEMLTGRAY; else ((BRUSH*)hBrush)->crBrushColor=RGB_SYSTEMWHITE; res=DefWindowProc(hWnd, iMsg, wParam, lParam); ((BRUSH*)hBrush)->crBrushColor=crColor; return res; case LMSG_KILLFOCUS: pEditData = (PSLEditData) (pWin->dwData); pEditData->dwStatus &= ~EST_FOCUSED; HideCaret (hWnd); NotifyParent (hWnd, EN_KILLFOCUS); break; case LMSG_SETFOCUS: pEditData = (PSLEditData) (pWin->dwData); if (pEditData->dwStatus & EST_FOCUSED) return 0; pEditData->dwStatus |= EST_FOCUSED; SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); ShowCaret (hWnd); NotifyParent (hWnd, EN_SETFOCUS); break; case LMSG_GETTEXTLENGTH: pEditData = (PSLEditData) (pWin->dwData); return pEditData->iDataLen; case LMSG_GETTEXT: buffer = (char*)lParam; pEditData = (PSLEditData) (pWin->dwData); len = min ((int)wParam, pEditData->iDataLen); memcpy (buffer, pEditData->buffer, len); buffer [len] = '\0'; return len; case LMSG_SETTEXT: pEditData = (PSLEditData)(pWin->dwData); if(pWin->dwStyle & ES_READONLY) return 0; pEditData = (PSLEditData) (pWin->dwData); len = min (strlen ((char*)lParam), pEditData->iBufferLen); pEditData->iDataLen = len; memcpy (pEditData->buffer, (char*)lParam, len); pEditData->iEditPos = 0; pEditData->iCaretPos = 0; pEditData->iStartPos = 0; if (pEditData->dwStatus & EST_FOCUSED) SetCaretPos (hWnd, pEditData->iLeftMargin, pEditData->iTopMargin); InvalidateRect (hWnd, NULL, TRUE); break; case EM_SETREADONLY: if (wParam) pWin->dwStyle |= ES_READONLY; else pWin->dwStyle &= ~ES_READONLY; break; case EM_SETPASSWORDCHAR: pEditData = (PSLEditData) (pWin->dwData); if (pEditData->passwdChar != (char)wParam) { if (pEditData->dwStatus & ES_PASSWORD) { pEditData->passwdChar = (char)wParam; InvalidateRect (hWnd, NULL, TRUE); } } break; case EM_GETPASSWORDCHAR: pEditData = (PSLEditData) (pWin->dwData); passwdchar = (char*) lParam; *passwdchar = pEditData->passwdChar; break; case LMSG_PENDOWN: { int x,y; int iRet; CaptureMouse(hWnd,BYCLIENT); pEditData = (PSLEditData) (pWin->dwData); x = (int)wParam; y = (int)lParam; ScreenToClient(hWnd, &x,&y); iRet = edtGetCaretPos (pEditData, x); //printf("%d\n",x); if (iRet != pEditData->iCaretPos) { pEditData->iEditPos += iRet - pEditData->iCaretPos; pEditData->iCaretPos = iRet; SetCaretPos (hWnd, pEditData->iCaretPos * GetSysCharWidth () + pEditData->iLeftMargin, pEditData->iTopMargin); } NotifyParent(hWnd,EN_CLICKED); break; } case LMSG_PENUP: DisCaptureMouse(); break; case LMSG_ENABLE: if((BOOL)wParam)///Enable pWin->dwStyle &=~WS_DISABLE; else//Disable pWin->dwStyle |=WS_DISABLE; break; case LMSG_NCPAINT: GetWindowRect(hWnd,&rect); SetRect(&rect,0,0,rect.right-rect.left,rect.bottom-rect.top); if(IsBorder(hWnd)){ hDC = (HDC)wParam; if(!hDC) return false; hPen=CreatePen(PS_SOLID,1,RGB(88,87,81)); SelectObject(hDC,hPen); DeleteObject(hPen); winMoveToEx(hDC,rect.left,rect.top,&point); winLineTo(hDC,rect.right,rect.top); winMoveToEx(hDC,rect.left,rect.top,&point); winLineTo(hDC,rect.left,rect.bottom); hPen=GetStockObject(LTGRAY_PEN); SelectObject(hDC,hPen); DeleteObject(hPen); winMoveToEx(hDC,rect.right,rect.top+1,&point); winLineTo(hDC,rect.right,rect.bottom); winMoveToEx(hDC,rect.right,rect.bottom,&point); winLineTo(hDC,rect.left,rect.bottom); } break; case LMSG_PAINT: ps.bPaintDirect=false; hDC=BeginPaint(hWnd, &ps); if(!hDC){ return true; } if(IsFocus(hWnd)){ HideCaret(hWnd); } GetWindowRect(hWnd,&rect); SetRect(&rect,0,0,rect.right-rect.left,rect.bottom-rect.top); pEditData = (PSLEditData) (pWin->dwData); iBorder = wndGetBorder(hWnd); InflateRect(&rect,(-1)*iBorder,(-1)*iBorder); dispLen = GetEditBoxDispLen (hWnd); if (dispLen == 0) { EndPaint(hWnd, &ps); break; } dispBuffer = malloc (dispLen + 1); if (pWin->dwStyle & ES_PASSWORD) memset (dispBuffer, '*', dispLen); else memcpy (dispBuffer, pEditData->buffer + pEditData->iStartPos, dispLen); dispBuffer [dispLen] = '\0'; rect.left += pEditData->iLeftMargin; rect.top += pEditData->iTopMargin; rect.right -= pEditData->iRightMargin; rect.bottom -= pEditData->iBottomMargin; DrawText(hDC,dispBuffer,strlen(dispBuffer),&rect,DT_LEFT); free(dispBuffer);//modify,this is added EndPaint(hWnd, &ps); if(IsFocus(hWnd)){ ShowCaret(hWnd); SetTimer(hWnd,1,50); } break; //keydown process case LMSG_KEYDOWN: edtProcessKeyDown(hWnd,wParam,lParam); break; case LMSG_CHAR: edtProcessChar(hWnd,wParam,lParam); break; default: return DefWindowProc(hWnd, iMsg, wParam, lParam); } return 0; }
HRESULT UITouchButton::Draw(DK_IMAGE drawingImg) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Start"); if (!m_bIsVisible) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: m_bIsVisible = false"); return S_OK; } if (drawingImg.pbData == NULL) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: m_bIsVisible = false"); return E_FAIL; } HRESULT hr(S_OK); DK_IMAGE imgSelf; DK_RECT rcSelf={m_iLeft, m_iTop, m_iLeft + m_iWidth, m_iTop + m_iHeight}; RTN_HR_IF_FAILED(CropImage( drawingImg, rcSelf, &imgSelf )); CTpGraphics grf(imgSelf); if (m_bUsingBackgroundPicture) { // draw background picture if there is if (IsFocus() || IsPressed()) { if (m_spFocusedBackground) { HRESULT hr(S_OK); DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background Image in focus"); int startx = (m_iWidth - m_spFocusedBackground.Get()->GetWidth()); if (startx >0) startx = startx / 2; else startx =0; int starty = (m_iHeight - m_spFocusedBackground.Get()->GetHeight()); if (starty >0) starty = starty / 2; else starty =0; RTN_HR_IF_FAILED(grf.DrawImage(m_spFocusedBackground.Get(),startx,starty,0,0,m_spFocusedBackground.Get()->GetWidth(), m_spFocusedBackground.Get()->GetHeight())); //RTN_HR_IF_FAILED(grf.DrawImage(m_spFocusedBackground.Get(), 0, 0)); } } else { if (m_spBackground) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background Image not in focus"); int startx = (m_iWidth - m_spBackground.Get()->GetWidth()); if (startx >0) startx = startx / 2; else startx =0; int starty = (m_iHeight - m_spBackground.Get()->GetHeight()); if (starty >0) starty = starty / 2; else starty =0; HRESULT hr(S_OK); RTN_HR_IF_FAILED(grf.DrawImage(m_spBackground.Get(), startx, starty, 0, 0, m_spBackground.Get()->GetWidth(), m_spBackground.Get()->GetHeight())); //RTN_HR_IF_FAILED(grf.DrawImage(m_spBackground.Get(), 0, 0)); } } } else { // draw background in color if (!m_bBackTransparent) { if (IsFocus() || IsPressed()) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background with color in focus"); RTN_HR_IF_FAILED(grf.FillRect( 0, 0, m_iWidth, m_iHeight, m_focusedBackgroundColor)); } else { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() Draw background with color not in focus"); RTN_HR_IF_FAILED(grf.FillRect( 0, 0, m_iWidth, m_iHeight, GetBackgroundColor())); } } } //draw string if (m_strText.Length() > 0) { m_ifontAttr.m_iFace=FONT_DEFAULT; ITpFont* pFont = NULL; if (IsFocus() || IsPressed()) { pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, m_iFocusedFontColor); } else { pFont = FontManager::GetInstance()->GetFont(m_ifontAttr, GetFontColor()); } if(NULL == pFont) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End: pFont = NULL"); return E_FAIL; } int _iStringWidth = pFont->StringWidth(m_strText); int _iStringHeight = pFont->GetHeight(); if (_iStringWidth > m_iWidth) { DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End:_iStringWidth > m_iWidth"); return E_FAIL; } int _H_offset = (m_iWidth - _iStringWidth) / 2; int _V_offset = (m_iHeight - _iStringHeight) / 2; grf.DrawStringUtf8(m_strText.GetBuffer(), _H_offset, _V_offset, pFont); } if (m_do2gray) { grf.Do2Gray(0,0,m_iWidth, m_iHeight, 80, FALSE, (IsEnable() ? 0xff : 0x66)); } DebugPrintf(DLC_CHENM, "UITouchButton::Draw() End."); return hr; }
// Main dialog procedure UINT NmMainDlgProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam, void *param) { #if 0 SM_HUB *r = (SM_HUB *)param; RPC_DUMMY dummy; SM_SERVER sm; // Validate arguments if (hWnd == NULL) { return 0; } switch (msg) { case WM_INITDIALOG: NmMainDlgInit(hWnd, r); SetTimer(hWnd, 1, NM_REFRESH_TIME, NULL); break; case WM_COMMAND: switch (wParam) { case B_SETTING: // Connection setting NmEditClientConfig(hWnd, r); break; case B_CONNECT: // Connection Zero(&dummy, sizeof(dummy)); CALL(hWnd, NcOnline(r, &dummy)); NmMainDlgRefresh(hWnd, r); break; case B_DISCONNECT: // Disconnect Zero(&dummy, sizeof(dummy)); CALL(hWnd, NcOffline(r, &dummy)); NmMainDlgRefresh(hWnd, r); break; case B_OPTION: // Operation setting NmEditVhOption(hWnd, r->Rpc); break; case B_NAT: // NAT NmNat(hWnd, r); break; case B_DHCP: // DHCP NmDhcp(hWnd, r); break; case B_STATUS: // Status Zero(&sm, sizeof(sm)); sm.Rpc = r; SmStatusDlg(hWnd, &sm, NULL, true, true, _UU("NM_STATUS"), ICO_ROUTER, NULL, NmStatus); break; case B_INFO: // Information Zero(&sm, sizeof(sm)); sm.Rpc = r; SmStatusDlg(hWnd, &sm, NULL, false, true, _UU("NM_INFO"), ICO_ROUTER, NULL, NmInfo); break; case B_REFRESH: // Refresh NmMainDlgRefresh(hWnd, r); break; case B_PASSWORD: // Change the password NmChangePassword(hWnd, r); break; case B_ABOUT: // Version information About(hWnd, nm->Cedar, CEDAR_ROUTER_STR); break; case IDCANCEL: Close(hWnd); break; } break; case WM_TIMER: switch (wParam) { case 1: KillTimer(hWnd, 1); if (IsEnable(hWnd, 0)) { NmMainDlgRefresh(hWnd, r); } SetTimer(hWnd, 1, NM_REFRESH_TIME, NULL); break; } break; case WM_CLOSE: EndDialog(hWnd, false); break; } #endif return 0; }
//---------------------------------------------------------------------------------------------------- /// @param /// @brief draw icon.. //---------------------------------------------------------------------------------------------------- void CSkill::DrawIcon( int iX, int iY, DWORD dwColor ) { CTDrawImpl* pDrawObj = g_itMGR.GetDrawImplPtr(); short nIconNo = SKILL_ICON_NO( GetSkillIndex() ); //----------------------------------------------------------------------------------------------------- /////////2005. 5. 30. 박 지호 if(CCountry::GetSingleton().IsUseItemDelayNewVersion()) { //스킬 딜레이 타입을 가져온다. int iDelayType = SKILL_RELOAD_TYPE( GetSkillIndex() ); float srcTick = 0.0f; float desTick = 0.0f; //그룹타입이라면 처음 선택 되어진 타입의 딜레이 틱을 가져온다. if(iDelayType) { srcTick = g_CurSkillDelayTick.GetUseItemDelay(iDelayType); desTick = g_UseSkillDelay.GetUseItemDelay( iDelayType ); } //단독으로 구동되는 스킬이라면 자신의 딜레이 틱을 설정한다. else { srcTick = g_SkillList.GetDelayTickCount( GetSkillIndex() ); desTick = g_SoloSkillDelayTick.GetUseItemDelay( GetSkillIndex() ); } //만약 딜레이 랜더링 중이라면... if(desTick > 0.0f) { float fProcessRate = (desTick / srcTick); CReloadProcess* pReloadProcess = g_itMGR.GetReloadProcess(); pReloadProcess->Draw( iX , iY, IMAGE_RES_SKILL_ICON, nIconNo, fProcessRate ); } else { if( IsEnable() ) pDrawObj->Draw( iX, iY, IMAGE_RES_SKILL_ICON, nIconNo, dwColor ); else pDrawObj->Draw( iX, iY, IMAGE_RES_SKILL_ICON, nIconNo, D3DCOLOR_RGBA( 128, 128, 128, 255 )); } } //------------------------------------------------------------------------------------------------------- else { if( this->m_iSkillDelayTimer > 0 ) { float fProcessRate = (float)m_iSkillDelayTimer / (float)( SKILL_RELOAD_TIME( this->GetSkillIndex() ) * 200 ); CReloadProcess* pReloadProcess = g_itMGR.GetReloadProcess(); pReloadProcess->Draw( iX , iY, IMAGE_RES_SKILL_ICON, nIconNo, fProcessRate ); }else { pDrawObj->Draw( iX, iY, IMAGE_RES_SKILL_ICON, nIconNo ); } CSkillCommandDelay::GetSingleton().Draw( iX, iY ); } }
void SQRCheckButton::DrawWndText() { UIWString str = GetWndTextW(); int32 nSize = str.size(); if( !nSize ) return; CFPos pt = GetCursorPos(); CFRect rt; GetWndRect(rt); rt.right -= rt.left; rt.bottom -= rt.top; rt.left = rt.top = 0; int32 i = 0; const wchar_t* szText = str.c_str(); for( ; i < nSize - 1; i++ ) { if( str[i] == '\\' && str[ i + 1 ] == 'n' ) str[i] = str[ i + 1 ] = 0; if( !str[i] && !str[ i + 1 ] ) { if( !m_bCheck ) szText += i + 2; break; } } //处于选中状态 if( m_bCheck ) { if( IsHeld() ) { if( IsInWndArea( pt.x, pt.y ) ) DrawText( szText, m_ClickDownColor, m_ClickDownBcColor); else if( IsEnable() ) DrawText( szText, m_hWnd->m_EnableColor, m_hWnd->m_EnableBcColor ); else DrawText( szText, m_hWnd->m_DisableColor, m_hWnd->m_DisableBcColor ); } else { if( IsInWndArea( pt.x, pt.y ) && IsEnable() ) DrawText( szText, m_MouseOverColor, m_MouseOverBcColor ); else if( IsEnable() ) DrawText( szText, m_hWnd->m_EnableColor, m_hWnd->m_EnableBcColor ); else DrawText( szText, m_hWnd->m_DisableColor, m_hWnd->m_DisableBcColor ); } } //非选中状态 else if( !m_bCheck ) { if( IsHeld() ) { if( IsInWndArea( pt.x, pt.y ) ) DrawText( szText, m_UncheckClickDownColor, m_UncheckClickDownBcColor ); else DrawText( szText, m_UncheckEnableColor, m_UncheckEnableBcColor ); } else { if( IsInWndArea( pt.x, pt.y ) && IsEnable() ) DrawText( szText, m_UncheckMouseOverColor, m_UncheckMouseOverBcColor ); else if( IsEnable() ) DrawText( szText, m_UncheckEnableColor, m_UncheckEnableBcColor ); else DrawText( szText, m_UncheckDisableColor, m_UncheckDisableBcColor ); } } }