Ignore:
Timestamp:
Aug 29, 2009, 7:55:19 AM (15 years ago)
Author:
イグトランス (egtra)
Message:

Windows 7タスクバーへの対応を実装。
(#245)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/abdev/TabCtrl.cpp

    r700 r772  
    33#include "Common.h"
    44
     5struct 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
     17ItemInfo* 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
     25void 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}
    534
    635CMainTab *pobj_MainTab=0;
     
    5786
    5887                    indexDrag=iNewPos;
     88                    SetTabOrder( hwnd, GetItemInfo( hwnd, iNewPos ), iNewPos );
    5989
    6090                    LockWindowUpdate(0);
     
    148178
    149179    //サブクラス化
    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);
    152181
    153182    //ボールド体フォントを生成
     
    157186    hBoldFont=CreateFontIndirect(&lf);
    158187
    159     SendMessage(hTab,WM_SETFONT,(long)hBoldFont,0);
     188    SetWindowFont(hTab,hBoldFont,FALSE);
    160189}
    161190
     
    164193}
    165194
    166 void CMainTab::InsertItem( const char *lpszText, bool isResize, COLORREF color ){
     195void CMainTab::InsertItem( HWND hwnd, const char *lpszText, bool isResize, COLORREF color ){
    167196    int sw=0;
    168197    if(TabCtrl_GetItemCount(hTab)==0) sw=1;
    169 
     198OutputDebugString("CMainTab::InsertItem--------------------------------------------------------\r\n");
    170199    if(color==-1) color=RGB(230,230,230);
     200
     201    ItemInfo* itemInfo = new ItemInfo( hwnd, color );
    171202
    172203    TC_ITEM tcItem;
    173204    tcItem.mask=TCIF_TEXT|TCIF_PARAM;
    174205    tcItem.pszText=(LPSTR)lpszText;
    175     tcItem.lParam=color;
     206    tcItem.lParam=reinterpret_cast<LPARAM>( itemInfo );
    176207    TabCtrl_InsertItem(hTab,0,&tcItem);
    177208    TabCtrl_SetCurSel(hTab,0);
     209    ActiveBasic::IDE::Program::mainFrame.AddChildWindow( hwnd );
     210    SetTabOrder( hTab, itemInfo, 0 );
    178211
    179212    if(isResize){
     
    186219    i2=SearchItemIndex(lpszText);
    187220    if(i2==-1) return;
    188 
     221OutputDebugString("CMainTab::DeleteItem--------------------------------------------------------\r\n");
     222    ItemInfo* p = GetItemInfo( hTab, i2 );
     223    ActiveBasic::IDE::Program::mainFrame.DeleteChildWindow( p->hwndChild );
     224    delete p;
    189225    TabCtrl_DeleteItem(hTab,i2);
    190226
     
    195231
    196232void CMainTab::RenameItem( const char *lpszOldText, const char *lpszNewText ){
    197     int i2;
    198     i2=SearchItemIndex(lpszOldText);
     233    int i2=SearchItemIndex(lpszOldText);
    199234    if(i2==-1) return;
    200235
     
    242277    tcItem.mask = TCIF_PARAM;
    243278    TabCtrl_GetItem( hTab, index, &tcItem );
    244     return tcItem.lParam;
     279    return reinterpret_cast<ItemInfo*>( tcItem.lParam )->Color;
    245280}
    246281
     
    272307
    273308    TabCtrl_SetCurSel(hTab,i2);
     309//  ActiveBasic::IDE::Program::mainFrame.ActivateChildWindow( *GetItemInfo( hTab, i2 )->TaskbarButtonWindow );
    274310}
    275311
     
    321357        // タブ枠を描画
    322358        ////////////////////////////
    323         colorGray=item.lParam;
     359        colorGray=reinterpret_cast<ItemInfo*>( item.lParam )->Color;
    324360
    325361        //ブラシを生成
     
    376412        // タブ枠を描画
    377413        ////////////////////////////
    378         colorGray=item.lParam;
     414        colorGray=reinterpret_cast<ItemInfo*>( item.lParam )->Color;
    379415
    380416        //ブラシを生成
Note: See TracChangeset for help on using the changeset viewer.