void Mint::DrawCompositionAttributes(MDrawContext* pDC, MPOINT& p, const char* szComposition) { if(strlen(szComposition)==0) return; int nWidth = 0; for(int i=0; szComposition[i]!=NULL; i++){ bool bTwoByteChar = IsHangul(szComposition[i]); nWidth += DrawCompositionAttribute(pDC, MPOINT(p.x+nWidth, p.y), szComposition, i); if(bTwoByteChar) i++; } }
MBFrameLook::MBFrameLook(void) : MScalableLook() { m_szDefaultTitle[0]=0; m_TitlePosition = MPOINT(14, 10); m_FontColor = MCOLOR(255,255,255,255); m_bStretch = true; for(int i=0; i<FRAME_BITMAP_COUNT; i++){ m_pFrameBitmaps[i] = NULL; } for (int i=0; i<FRAME_BUTTON_BITMAP_COUNT; i++) { m_pCloseButtonBitmaps[i] = NULL; m_pMinimizeButtonBitmaps[i] = NULL; } m_iCustomLook = 0; }
bool MFrame::OnEvent(MEvent* pEvent, MListener* pListener) { if (IsFocusEnable() == false) return false; MRECT TitleBarRect(0, 0, m_Rect.w, MTITLEBAR_HEIGHT); MRECT WidgetRect(0, 0, m_Rect.w, m_Rect.h); MPOINT sp = MClientToScreen(this, pEvent->Pos); switch(pEvent->nMessage){ case MWM_LBUTTONDOWN: if(m_bTitleBar==true && TitleBarRect.InPoint(pEvent->Pos)==true) { if ( m_BtnClose.m_Rect.InPoint(pEvent->Pos)==true) { m_BtnClose.m_bLButtonDown = true; } else if (m_BtnMinimize.m_Rect.InPoint(pEvent->Pos)==true) { m_BtnMinimize.m_bLButtonDown = true; } else { SetCapture(); m_bDragWidget = true; MPOINT wp = MClientToScreen(GetParent(), MPOINT(m_Rect.x, m_Rect.y)); sp.x -= wp.x; sp.y -= wp.y; m_DragPoint = sp; } return true; } else if(WidgetRect.InPoint(pEvent->Pos)==true){ return true; } break; case MWM_LBUTTONUP: if (m_bTitleBar==true && m_BtnClose.m_Rect.InPoint(pEvent->Pos)==true) { if (m_BtnClose.m_bLButtonDown==true) OnCloseButtonClick(); } else if (m_bTitleBar==true && m_BtnMinimize.m_Rect.InPoint(pEvent->Pos)==true) { if (m_BtnMinimize.m_bLButtonDown==true) OnMinimizeButtonClick(); } m_BtnClose.m_bLButtonDown = m_BtnMinimize.m_bLButtonDown = false; if(m_bDragWidget==true){ ReleaseCapture(); m_bDragWidget = false; return true; } break; case MWM_MOUSEMOVE: if(m_bDragWidget==true){ sp.x -= m_DragPoint.x; sp.y -= m_DragPoint.y; if(sp.x<0) sp.x = 0; if(sp.y<0) sp.y = 0; if(sp.x+m_Rect.w>MGetWorkspaceWidth()-1) sp.x = MGetWorkspaceWidth()-m_Rect.w-1; if(sp.y+m_Rect.h>MGetWorkspaceHeight()-1) sp.y = MGetWorkspaceHeight()-m_Rect.h-1; MPOINT p = MScreenToClient(GetParent(), sp); if (m_bMovable == true) { SetPosition(p.x, p.y); } return true; } else if(m_bTitleBar==true) { if(m_BtnClose.m_Rect.InPoint(pEvent->Pos)==true) { if(m_BtnClose.m_bMouseOver==false) m_BtnClose.m_bMouseOver = true; } else { if(m_BtnClose.m_bMouseOver==true) m_BtnClose.m_bMouseOver = false; } if(m_BtnMinimize.m_Rect.InPoint(pEvent->Pos)==true) { if(m_BtnMinimize.m_bMouseOver==false) m_BtnMinimize.m_bMouseOver = true; } else { if(m_BtnMinimize.m_bMouseOver==true) m_BtnMinimize.m_bMouseOver = false; } } break; case MWM_LBUTTONDBLCLK: break; } return false; }
void Mint::Draw(void) { if(!m_pMainFrame) return; MDrawContext* pDC = m_pDC; if(pDC==NULL) return; pDC->SetOpacity(0xFF); m_pMainFrame->Draw(pDC); MRECT sr = m_pMainFrame->GetScreenRect(); pDC->SetOrigin(MPOINT(sr.x, sr.y)); pDC->SetClipRect(sr); // Candidate List ±×¸®±â DrawCandidateList(pDC, m_CandidateListPos); // Drag & Drop /* MDragObject* pDragObject = MGetDragObject(); if(pDragObject!=NULL){ pDC->SetBitmap(pDragObject->GetBitmap()); MPOINT p = MEvent::GetMousePos(); pDC->Draw(p); pDC->Text(p, pDragObject->GetString()); } */ //int nDragObjectID = GetDragObject(); MWidget* pDragSourceObject = GetDragObject(); if(pDragSourceObject!=NULL && m_bVisibleDragObject==true){ // ÇöÀç À§Ä¡¿¡¼ µå·ÓÇÒ ¼ö ÀÖ´Â À§Á¬À» Ç¥½Ã if(m_pDropableObject!=NULL){ MRECT r = m_pDropableObject->GetScreenRect(); pDC->SetColor(0, 0, 0, 32); pDC->FillRectangle(r); } // Ä¿¼¿¡ ºÙ´Â µå·¡±× ¿ÀºêÁ§Æ® ±×¸®±â pDC->SetBitmap(m_pDragObjectBitmap); MPOINT p = MEvent::GetMousePos(); p.x-=(m_pDragObjectBitmap!=NULL?m_pDragObjectBitmap->GetWidth()/2:0); p.y-=(m_pDragObjectBitmap!=NULL?m_pDragObjectBitmap->GetHeight()/2:0); if (m_pDragObjectBitmap) { pDC->SetOpacity(128); pDC->Draw(p.x, p.y, m_pDragObjectBitmap->GetWidth(), m_pDragObjectBitmap->GetHeight()); pDC->SetOpacity(0xFF); } p.x+=((m_pDragObjectBitmap!=NULL?m_pDragObjectBitmap->GetWidth():0) + 2); p.y+=((m_pDragObjectBitmap!=NULL?m_pDragObjectBitmap->GetHeight()/2:0)-pDC->GetFont()->GetHeight()/2); pDC->SetColor(0, 0, 0, 128); pDC->Text(p, m_szDragObjectString); pDC->SetColor(255, 255, 255, 128); p.x--; p.y--; pDC->Text(p, m_szDragObjectString); } }