Changeset 772 in dev for trunk/ab5.0/abdev/abdev/TabCtrl.cpp
- Timestamp:
- Aug 29, 2009, 7:55:19 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/abdev/TabCtrl.cpp
r700 r772 3 3 #include "Common.h" 4 4 5 struct ItemInfo 6 { 7 HWND hwndChild; 8 COLORREF Color; 9 10 ItemInfo( HWND hChild, COLORREF color) : 11 hwndChild( hChild ), 12 Color( color ) 13 { 14 } 15 }; 16 17 ItemInfo* GetItemInfo( HWND hTab, int i ) 18 { 19 TC_ITEM tcItem; 20 tcItem.mask=TCIF_PARAM; 21 TabCtrl_GetItem( hTab, i, &tcItem ); 22 return reinterpret_cast<ItemInfo*>( tcItem.lParam ); 23 } 24 25 void SetTabOrder( HWND hTab, ItemInfo* itemInfo, int pos ) 26 { 27 HWND next = 28 pos + 1 < TabCtrl_GetItemCount( hTab ) 29 ? GetItemInfo( hTab, pos + 1 )->hwndChild 30 : 0 31 ; 32 ActiveBasic::IDE::Program::mainFrame.SetTabOrder( itemInfo->hwndChild, next ); 33 } 5 34 6 35 CMainTab *pobj_MainTab=0; … … 57 86 58 87 indexDrag=iNewPos; 88 SetTabOrder( hwnd, GetItemInfo( hwnd, iNewPos ), iNewPos ); 59 89 60 90 LockWindowUpdate(0); … … 148 178 149 179 //サブクラス化 150 OldMainTabWndProc=(WNDPROC)GetWindowLongPtr(hTab,GWLP_WNDPROC); 151 SetWindowLongPtr(hTab,GWLP_WNDPROC,(LONG_PTR)MainTabWndProc); 180 OldMainTabWndProc = (WNDPROC)SetWindowLongPtr(hTab,GWLP_WNDPROC,(LONG_PTR)MainTabWndProc); 152 181 153 182 //ボールド体フォントを生成 … … 157 186 hBoldFont=CreateFontIndirect(&lf); 158 187 159 Se ndMessage(hTab,WM_SETFONT,(long)hBoldFont,0);188 SetWindowFont(hTab,hBoldFont,FALSE); 160 189 } 161 190 … … 164 193 } 165 194 166 void CMainTab::InsertItem( const char *lpszText, bool isResize, COLORREF color ){195 void CMainTab::InsertItem( HWND hwnd, const char *lpszText, bool isResize, COLORREF color ){ 167 196 int sw=0; 168 197 if(TabCtrl_GetItemCount(hTab)==0) sw=1; 169 198 OutputDebugString("CMainTab::InsertItem--------------------------------------------------------\r\n"); 170 199 if(color==-1) color=RGB(230,230,230); 200 201 ItemInfo* itemInfo = new ItemInfo( hwnd, color ); 171 202 172 203 TC_ITEM tcItem; 173 204 tcItem.mask=TCIF_TEXT|TCIF_PARAM; 174 205 tcItem.pszText=(LPSTR)lpszText; 175 tcItem.lParam= color;206 tcItem.lParam=reinterpret_cast<LPARAM>( itemInfo ); 176 207 TabCtrl_InsertItem(hTab,0,&tcItem); 177 208 TabCtrl_SetCurSel(hTab,0); 209 ActiveBasic::IDE::Program::mainFrame.AddChildWindow( hwnd ); 210 SetTabOrder( hTab, itemInfo, 0 ); 178 211 179 212 if(isResize){ … … 186 219 i2=SearchItemIndex(lpszText); 187 220 if(i2==-1) return; 188 221 OutputDebugString("CMainTab::DeleteItem--------------------------------------------------------\r\n"); 222 ItemInfo* p = GetItemInfo( hTab, i2 ); 223 ActiveBasic::IDE::Program::mainFrame.DeleteChildWindow( p->hwndChild ); 224 delete p; 189 225 TabCtrl_DeleteItem(hTab,i2); 190 226 … … 195 231 196 232 void CMainTab::RenameItem( const char *lpszOldText, const char *lpszNewText ){ 197 int i2; 198 i2=SearchItemIndex(lpszOldText); 233 int i2=SearchItemIndex(lpszOldText); 199 234 if(i2==-1) return; 200 235 … … 242 277 tcItem.mask = TCIF_PARAM; 243 278 TabCtrl_GetItem( hTab, index, &tcItem ); 244 return tcItem.lParam;279 return reinterpret_cast<ItemInfo*>( tcItem.lParam )->Color; 245 280 } 246 281 … … 272 307 273 308 TabCtrl_SetCurSel(hTab,i2); 309 // ActiveBasic::IDE::Program::mainFrame.ActivateChildWindow( *GetItemInfo( hTab, i2 )->TaskbarButtonWindow ); 274 310 } 275 311 … … 321 357 // タブ枠を描画 322 358 //////////////////////////// 323 colorGray= item.lParam;359 colorGray=reinterpret_cast<ItemInfo*>( item.lParam )->Color; 324 360 325 361 //ブラシを生成 … … 376 412 // タブ枠を描画 377 413 //////////////////////////// 378 colorGray= item.lParam;414 colorGray=reinterpret_cast<ItemInfo*>( item.lParam )->Color; 379 415 380 416 //ブラシを生成
Note:
See TracChangeset
for help on using the changeset viewer.