void CEmotionButton::SetPage(int page) { curPage = page; SwitchPage(curPage); }
bool MY_UI::Controls::Tab_Control::Erase(MY_UI::Controls::Simple_Window* widget){ int index =-1; for(size_t i(0); i <Pages.size(); i++){ if(Pages[i] == widget){// found the index of the page index = static_cast<int>(i); break; } } if(index == -1) return false;// could not find it delete Tabs[index]; Tabs.erase(Tabs.begin() + index); delete Pages[index]; Pages.erase(Pages.begin() + index); if(Tabs.empty()){ CurrentPage =-1; return true; } CurrentPage = Utilities::Clamp<int>(CurrentPage, 0, static_cast<int>(Tabs.size()));// ensure proper value SwitchPage( *(Tabs.begin() + CurrentPage) );// swtich pages return true; }
CEmotionButton::CEmotionButton(void) { m_CxImages=NULL; //窗口大小 QQFACEDLG_WIDTH = 446; QQFACEDLG_HEIGHT = 239; //网格左上角坐标 CELLS_LEFT = 6; CELLS_TOP =3; CELLS_RIGHT = 441; //(6 + 29*15) CELLS_BOTTOM = 259; //(28 + 29*8) CELLSIZE = 29; //每个网格= 29*30,(图片尺寸是24*24) CELLCOUNT_LINE = 15; //每行 CELLCOUNT_COLUMN = 8; //每列 CELLCOUNT_PAGE = 120; //每页120个表情 rcLeft.left = CELLS_LEFT+1; rcLeft.top = CELLS_TOP+1; rcLeft.right = rcLeft.left + (CELLSIZE*3-1); rcLeft.bottom = rcLeft.top + (CELLSIZE*3-1); rcRight.left = CELLS_LEFT+(CELLSIZE*12)+1; rcRight.top = CELLS_TOP+1; rcRight.right = rcRight.left + (CELLSIZE*3-1); rcRight.bottom = rcRight.top + (CELLSIZE*3-1); //开始时隐藏动画窗口 pvstatus = _PVStatus::Hide; TCHAR facepath[MAX_PATH]; GetFaceFolderPath(facepath, _T("Face")); //加载所有表情! m_ImageCount = LoadImages(facepath); //表情页数量 m_PageCount = (m_ImageCount + CELLCOUNT_PAGE - 1) / CELLCOUNT_PAGE; curPage=0; //创建内存DC HDC hdc = GetDC(NULL); m_hMemDC = CreateCompatibleDC(hdc); m_hMemDCBkGnd = CreateCompatibleDC(hdc); m_hMemBitmap = CreateCompatibleBitmap(hdc, QQFACEDLG_WIDTH, QQFACEDLG_HEIGHT); m_hMemBitmapBkGnd = CreateCompatibleBitmap(hdc, QQFACEDLG_WIDTH, QQFACEDLG_HEIGHT); ReleaseDC(NULL, hdc); SelectObject(m_hMemDC, m_hMemBitmap); SelectObject(m_hMemDCBkGnd, m_hMemBitmapBkGnd); TCHAR szPageInfo[16]; //设置页信息 wsprintf(szPageInfo, _T("%d/%d"), curPage+1, m_PageCount); SwitchPage(curPage); }