[NEW_FEATURE] Add multiline and vertical capacity for tab bar.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@110 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
e8323985c0
commit
4b34c681af
@ -2949,7 +2949,7 @@ void Notepad_plus::command(int id)
|
||||
_toReduceTabBar = !_toReduceTabBar;
|
||||
|
||||
//Resize the icon
|
||||
int iconSize = _toReduceTabBar?12:20;
|
||||
int iconSize = _toReduceTabBar?12:18;
|
||||
|
||||
//Resize the tab height
|
||||
int tabHeight = _toReduceTabBar?20:25;
|
||||
@ -3026,6 +3026,27 @@ void Notepad_plus::command(int id)
|
||||
TabBarPlus::setDbClk2Close(!TabBarPlus::isDbClk2Close());
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_VIEW_DRAWTABBAR_VERTICAL :
|
||||
{
|
||||
TabBarPlus::setVertical(!TabBarPlus::isVertical());
|
||||
|
||||
RECT rc;
|
||||
getMainClientRect(rc);
|
||||
|
||||
_dockingManager.reSizeTo(rc);
|
||||
//::SendMessage(_hSelf, IDM_VIEW_REDUCETABBAR, 0, 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_VIEW_DRAWTABBAR_MULTILINE :
|
||||
{
|
||||
TabBarPlus::setMultiLine(!TabBarPlus::isMultiLine());
|
||||
RECT rc;
|
||||
getMainClientRect(rc);
|
||||
_dockingManager.reSizeTo(rc);
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_VIEW_STATUSBAR:
|
||||
{
|
||||
@ -3037,6 +3058,7 @@ void Notepad_plus::command(int id)
|
||||
::SendMessage(_hSelf, WM_SIZE, SIZE_RESTORED, MAKELONG(rc.bottom, rc.right));
|
||||
break;
|
||||
}
|
||||
|
||||
case IDM_VIEW_TAB_SPACE:
|
||||
{
|
||||
bool isChecked = !(::GetMenuState(_mainMenuHandle, IDM_VIEW_TAB_SPACE, MF_BYCOMMAND) == MF_CHECKED);
|
||||
@ -5717,6 +5739,8 @@ LRESULT Notepad_plus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPa
|
||||
TabBarPlus::setDrawInactiveTab((tabBarStatus & TAB_DRAWINACTIVETAB) != 0);
|
||||
TabBarPlus::setDrawTabCloseButton((tabBarStatus & TAB_CLOSEBUTTON) != 0);
|
||||
TabBarPlus::setDbClk2Close((tabBarStatus & TAB_DBCLK2CLOSE) != 0);
|
||||
TabBarPlus::setVertical((tabBarStatus & TAB_VERTICAL) != 0);
|
||||
TabBarPlus::setMultiLine((tabBarStatus & TAB_MULTILINE) != 0);
|
||||
|
||||
//--Splitter Section--//
|
||||
bool isVertical = (nppGUI._splitterPos == POS_VERTICAL);
|
||||
|
@ -157,7 +157,9 @@ public:
|
||||
(TabBarPlus::drawInactiveTab()?TAB_DRAWINACTIVETAB:0) | \
|
||||
(_toReduceTabBar?TAB_REDUCE:0) | \
|
||||
(TabBarPlus::drawTabCloseButton()?TAB_CLOSEBUTTON:0) | \
|
||||
(TabBarPlus::isDbClk2Close()?TAB_DBCLK2CLOSE:0);
|
||||
(TabBarPlus::isDbClk2Close()?TAB_DBCLK2CLOSE:0) | \
|
||||
(TabBarPlus::isVertical() ? TAB_VERTICAL:0) | \
|
||||
(TabBarPlus::isMultiLine() ? TAB_MULTILINE:0);
|
||||
nppGUI._splitterPos = _subSplitter.isVertical()?POS_VERTICAL:POS_HORIZOTAL;
|
||||
UserDefineDialog *udd = _pEditView->getUserDefineDlg();
|
||||
bool b = udd->isDocked();
|
||||
|
@ -380,6 +380,9 @@ BEGIN
|
||||
MENUITEM "Clone to another view", IDM_VIEW_CLONE_TO_ANOTHER_VIEW
|
||||
MENUITEM "Synchronize Vertical Scrolling", IDM_VIEW_SYNSCROLLV
|
||||
MENUITEM "Synchronize Horizontal Scrolling", IDM_VIEW_SYNSCROLLH
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Veritcal", IDM_VIEW_DRAWTABBAR_VERTICAL
|
||||
MENUITEM "Multiline", IDM_VIEW_DRAWTABBAR_MULTILINE
|
||||
END
|
||||
|
||||
POPUP "For&mat"
|
||||
|
@ -49,6 +49,8 @@ const int TAB_DRAGNDROP = 4; // 0000 0100
|
||||
const int TAB_REDUCE = 8; // 0000 1000
|
||||
const int TAB_CLOSEBUTTON = 16; // 0001 0000
|
||||
const int TAB_DBCLK2CLOSE = 32; // 0010 0000
|
||||
const int TAB_VERTICAL = 64; // 0100 0000
|
||||
const int TAB_MULTILINE = 128; // 1000 0000
|
||||
|
||||
enum formatType {WIN_FORMAT, MAC_FORMAT, UNIX_FORMAT};
|
||||
|
||||
@ -528,10 +530,13 @@ struct NppGUI
|
||||
toolBarStatusType _toolBarStatus; // small, large ou hide
|
||||
bool _statusBarShow; // show ou hide
|
||||
|
||||
// 1er bit : draw top bar;
|
||||
// 2nd bit : draw inactive tabs
|
||||
// 3eme bit : enable drag&drop
|
||||
// 4eme bit : reduce the height
|
||||
// 1st bit : draw top bar;
|
||||
// 2nd bit : draw inactive tabs
|
||||
// 3rd bit : enable drag & drop
|
||||
// 4th bit : reduce the height
|
||||
// 5th bit : enable vertical
|
||||
// 6th bit : enable multiline
|
||||
|
||||
// 0:don't draw; 1:draw top bar 2:draw inactive tabs 3:draw both 7:draw both+drag&drop
|
||||
int _tabStatus;
|
||||
|
||||
|
@ -77,11 +77,11 @@ public :
|
||||
if (!_hideTabBarStatus)
|
||||
{
|
||||
TabBar::reSizeTo(rc);
|
||||
//rc.left += 3;
|
||||
rc.top += 2;
|
||||
rc.right -= 4;
|
||||
rc.bottom -= 26;
|
||||
//rc.top += 2;
|
||||
//rc.right -= 4;
|
||||
//rc.bottom -= 26;
|
||||
}
|
||||
|
||||
_pView->reSizeTo(rc);
|
||||
};
|
||||
|
||||
|
@ -33,6 +33,8 @@ bool TabBarPlus::_drawTopBar = true;
|
||||
bool TabBarPlus::_drawInactiveTab = true;
|
||||
bool TabBarPlus::_drawTabCloseButton = false;
|
||||
bool TabBarPlus::_isDbClk2Close = false;
|
||||
bool TabBarPlus::_isCtrlVertical = false;
|
||||
bool TabBarPlus::_isCtrlMultiLine = false;
|
||||
|
||||
HWND TabBarPlus::_hwndArray[nbCtrlMax] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
|
||||
int TabBarPlus::_nbCtrl = 0;
|
||||
@ -42,6 +44,9 @@ void TabBar::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditio
|
||||
Window::init(hInst, parent);
|
||||
int vertical = isVertical?(TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY):0;
|
||||
_isTraditional = isTraditional;
|
||||
_isVertical = isVertical;
|
||||
_isMultiLine = isMultiLine;
|
||||
|
||||
INITCOMMONCONTROLSEX icce;
|
||||
icce.dwSize = sizeof(icce);
|
||||
icce.dwICC = ICC_TAB_CLASSES;
|
||||
@ -93,13 +98,67 @@ void TabBar::getCurrentTitle(char *title, int titleLen)
|
||||
|
||||
void TabBar::reSizeTo(RECT & rc2Ajust)
|
||||
{
|
||||
RECT RowRect;
|
||||
int RowCount, TabsLength;
|
||||
|
||||
// Important to do that!
|
||||
// Otherwise, the window(s) it contains will take all the resouce of CPU
|
||||
// We don't need to resiz the contained windows if they are even invisible anyway!
|
||||
// We don't need to resize the contained windows if they are even invisible anyway
|
||||
display(rc2Ajust.right > 10);
|
||||
RECT rc = rc2Ajust;
|
||||
Window::reSizeTo(rc);
|
||||
TabCtrl_AdjustRect(_hSelf, FALSE, &rc2Ajust);
|
||||
//TabCtrl_AdjustRect(_hSelf, FALSE, &rc2Ajust);
|
||||
|
||||
// Do our own calculations because TabCtrl_AdjustRect doesn't work
|
||||
// on vertical or multi-lined tab controls
|
||||
|
||||
RowCount = TabCtrl_GetRowCount(_hSelf);
|
||||
TabCtrl_GetItemRect(_hSelf, 0, &RowRect);
|
||||
if (_isTraditional)
|
||||
{
|
||||
TabCtrl_AdjustRect(_hSelf, FALSE, &rc2Ajust);
|
||||
}
|
||||
else if (_isVertical)
|
||||
{
|
||||
TabsLength = RowCount * (RowRect.right - RowRect.left);
|
||||
TabsLength += RowCount * GetSystemMetrics(SM_CXEDGE);
|
||||
|
||||
rc2Ajust.left += TabsLength;
|
||||
rc2Ajust.right -= TabsLength;
|
||||
rc2Ajust.top += 5;
|
||||
rc2Ajust.bottom -= 10;
|
||||
|
||||
if (_isMultiLine)
|
||||
{
|
||||
rc2Ajust.right -= 5;
|
||||
}
|
||||
else
|
||||
{
|
||||
rc2Ajust.left += 5;
|
||||
rc2Ajust.right -= 10;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
rc2Ajust.top += 3;
|
||||
rc2Ajust.bottom -= 8;
|
||||
rc2Ajust.left += 1;
|
||||
rc2Ajust.right -= 6;
|
||||
|
||||
if (_isMultiLine)
|
||||
{
|
||||
TabsLength = RowCount * (RowRect.bottom - RowRect.top);
|
||||
TabsLength += RowCount * GetSystemMetrics(SM_CYEDGE);
|
||||
|
||||
rc2Ajust.top += TabsLength;
|
||||
rc2Ajust.bottom -= TabsLength;
|
||||
}
|
||||
else
|
||||
{
|
||||
TabCtrl_AdjustRect(_hSelf, FALSE, &rc2Ajust);
|
||||
rc2Ajust.bottom -= 20;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTraditional, bool isMultiLine)
|
||||
@ -107,6 +166,9 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
|
||||
Window::init(hInst, parent);
|
||||
int vertical = isVertical?(TCS_VERTICAL | TCS_MULTILINE | TCS_RIGHTJUSTIFY):0;
|
||||
_isTraditional = isTraditional;
|
||||
_isVertical = isVertical;
|
||||
_isMultiLine = isMultiLine;
|
||||
|
||||
INITCOMMONCONTROLSEX icce;
|
||||
icce.dwSize = sizeof(icce);
|
||||
icce.dwICC = ICC_TAB_CLASSES;
|
||||
@ -167,26 +229,47 @@ void TabBarPlus::init(HINSTANCE hInst, HWND parent, bool isVertical, bool isTrad
|
||||
_tabBarDefaultProc = reinterpret_cast<WNDPROC>(::SetWindowLong(_hSelf, GWL_WNDPROC, reinterpret_cast<LONG>(TabBarPlus_Proc)));
|
||||
}
|
||||
|
||||
if (vertical)
|
||||
LOGFONT LogFont;
|
||||
|
||||
_hFont = (HFONT)::SendMessage(_hSelf, WM_GETFONT, 0, 0);
|
||||
|
||||
if (_hFont == NULL)
|
||||
_hFont = (HFONT)::GetStockObject(DEFAULT_GUI_FONT);
|
||||
|
||||
if (::GetObject(_hFont, sizeof(LOGFONT), &LogFont) != 0)
|
||||
{
|
||||
_hFont = ::CreateFont( 14, 0, 0, 0,
|
||||
FW_NORMAL,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
"Comic Sans MS");
|
||||
if (_hFont)
|
||||
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
||||
LogFont.lfEscapement = 900;
|
||||
LogFont.lfOrientation = 900;
|
||||
|
||||
_hVerticalFont = CreateFontIndirect(&LogFont);
|
||||
}
|
||||
/*
|
||||
if (isOwnerDrawTab() && (!_isTraditional))
|
||||
::SendMessage(_hSelf, TCM_SETPADDING, 0, MAKELPARAM(6, 5));
|
||||
*/
|
||||
}
|
||||
|
||||
LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
switch (Message)
|
||||
{
|
||||
// Custom window message to change tab control style on the fly
|
||||
case WM_TABSETSTYLE:
|
||||
{
|
||||
DWORD style;
|
||||
//::SendMessage(upDownWnd, UDM_SETBUDDY, NULL, 0);
|
||||
style = ::GetWindowLong(hwnd, GWL_STYLE);
|
||||
|
||||
if (wParam > 0)
|
||||
style |= lParam;
|
||||
else
|
||||
style &= ~lParam;
|
||||
|
||||
_isVertical = ((style & TCS_VERTICAL) != 0);
|
||||
_isMultiLine = ((style & TCS_MULTILINE) != 0);
|
||||
|
||||
::SetWindowLong(hwnd, GWL_STYLE, style);
|
||||
::InvalidateRect(hwnd, NULL, TRUE);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
case WM_LBUTTONDOWN :
|
||||
{
|
||||
if (_drawTabCloseButton)
|
||||
@ -257,16 +340,24 @@ LRESULT TabBarPlus::runProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lPara
|
||||
|
||||
if (index != -1)
|
||||
{
|
||||
::SendMessage(_hSelf, TCM_GETITEMRECT, index, (LPARAM)&_currentHoverTabRect);
|
||||
_currentHoverTabItem = index;
|
||||
}
|
||||
bool oldVal = _isCloseHover;
|
||||
_isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect);
|
||||
if (oldVal != _isCloseHover)
|
||||
::SendMessage(_hParent, WM_COMMAND, IDM_VIEW_REFRESHTABAR, 0);
|
||||
|
||||
}
|
||||
// Reduce flicker by only redrawing needed tabs
|
||||
|
||||
bool oldVal = _isCloseHover;
|
||||
int oldIndex = _currentHoverTabItem;
|
||||
RECT oldRect;
|
||||
|
||||
::SendMessage(_hSelf, TCM_GETITEMRECT, index, (LPARAM)&_currentHoverTabRect);
|
||||
::SendMessage(_hSelf, TCM_GETITEMRECT, oldIndex, (LPARAM)&oldRect);
|
||||
_currentHoverTabItem = index;
|
||||
_isCloseHover = _closeButtonZone.isHit(xPos, yPos, _currentHoverTabRect);
|
||||
|
||||
if (oldVal != _isCloseHover)
|
||||
{
|
||||
InvalidateRect(hwnd, &oldRect, FALSE);
|
||||
InvalidateRect(hwnd, &_currentHoverTabRect, FALSE);
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@ -397,10 +488,6 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
|
||||
int nSavedDC = ::SaveDC(hDC);
|
||||
|
||||
// For some bizarre reason the rcItem you get extends above the actual
|
||||
// drawing area. We have to workaround this "feature".
|
||||
rect.top += ::GetSystemMetrics(SM_CYEDGE);
|
||||
|
||||
::SetBkMode(hDC, TRANSPARENT);
|
||||
HBRUSH hBrush = ::CreateSolidBrush(::GetSysColor(COLOR_BTNFACE));
|
||||
::FillRect(hDC, &rect, hBrush);
|
||||
@ -411,7 +498,17 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
if (_drawTopBar)
|
||||
{
|
||||
RECT barRect = rect;
|
||||
barRect.bottom = 6;
|
||||
|
||||
if (_isVertical)
|
||||
{
|
||||
barRect.right = barRect.left + 6;
|
||||
rect.left += 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
barRect.bottom = barRect.top + 6;
|
||||
rect.top += 2;
|
||||
}
|
||||
|
||||
hBrush = ::CreateSolidBrush(RGB(250, 170, 60));
|
||||
::FillRect(hDC, &barRect, hBrush);
|
||||
@ -434,7 +531,19 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
{
|
||||
RECT closeButtonRect = _closeButtonZone.getButtonRectFrom(rect);
|
||||
if (isSelected)
|
||||
closeButtonRect.left -= 2;
|
||||
{
|
||||
if (!_isVertical)
|
||||
{
|
||||
//closeButtonRect.top += 2;
|
||||
closeButtonRect.left -= 2;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (_isVertical)
|
||||
closeButtonRect.left += 2;
|
||||
}
|
||||
|
||||
|
||||
// 3 status for each inactive tab and selected tab close item :
|
||||
// normal / hover / pushed
|
||||
@ -453,6 +562,11 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
HBITMAP hBmp = ::LoadBitmap(_hInst, MAKEINTRESOURCE(idCloseImg));
|
||||
BITMAP bmp;
|
||||
::GetObject(hBmp, sizeof(bmp), &bmp);
|
||||
|
||||
if (_isVertical)
|
||||
rect.top = closeButtonRect.top + bmp.bmHeight;
|
||||
else
|
||||
rect.right = closeButtonRect.left;
|
||||
|
||||
::SelectObject(hdcMemory, hBmp);
|
||||
::BitBlt(hDC, closeButtonRect.left, closeButtonRect.top, bmp.bmWidth, bmp.bmHeight, hdcMemory, 0, 0, SRCCOPY);
|
||||
@ -470,44 +584,100 @@ void TabBarPlus::drawItem(DRAWITEMSTRUCT *pDrawItemStruct)
|
||||
if (hImgLst && tci.iImage >= 0)
|
||||
{
|
||||
IMAGEINFO info;
|
||||
|
||||
int yPos = 0, xPos = 0;
|
||||
int marge = 0;
|
||||
|
||||
ImageList_GetImageInfo(hImgLst, tci.iImage, &info);
|
||||
|
||||
RECT & imageRect = info.rcImage;
|
||||
int yPos = (rect.top + (rect.bottom - rect.top)/2 + (isSelected?0:2)) - (imageRect.bottom - imageRect.top)/2;
|
||||
|
||||
int marge = 0;
|
||||
if (_isVertical)
|
||||
xPos = (rect.left + (rect.right - rect.left)/2 + 2) - (imageRect.right - imageRect.left)/2;
|
||||
else
|
||||
yPos = (rect.top + (rect.bottom - rect.top)/2 + (isSelected?0:2)) - (imageRect.bottom - imageRect.top)/2;
|
||||
|
||||
if (isSelected)
|
||||
{
|
||||
marge = spaceUnit*2;
|
||||
else
|
||||
marge = spaceUnit;
|
||||
|
||||
if (_isVertical)
|
||||
{
|
||||
rect.bottom -= imageRect.bottom - imageRect.top;
|
||||
ImageList_Draw(hImgLst, tci.iImage, hDC, xPos, rect.bottom - marge, isSelected?ILD_TRANSPARENT:ILD_SELECTED);
|
||||
rect.bottom += marge;
|
||||
}
|
||||
else
|
||||
{
|
||||
marge = spaceUnit;
|
||||
rect.left += marge;
|
||||
ImageList_Draw(hImgLst, tci.iImage, hDC, rect.left, yPos, isSelected?ILD_TRANSPARENT:ILD_SELECTED);
|
||||
rect.left += imageRect.right - imageRect.left;
|
||||
}
|
||||
|
||||
rect.left += marge;
|
||||
ImageList_Draw(hImgLst, tci.iImage, hDC, rect.left, yPos, isSelected?ILD_TRANSPARENT:ILD_SELECTED);
|
||||
rect.left += imageRect.right - imageRect.left;
|
||||
}
|
||||
|
||||
//if (_isVertical)
|
||||
//SelectObject(hDC, _hVerticalFont);
|
||||
//else
|
||||
//SelectObject(hDC, _hFont);
|
||||
|
||||
int Flags = DT_SINGLELINE;
|
||||
|
||||
if (_drawTabCloseButton)
|
||||
{
|
||||
Flags |= DT_LEFT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!_isVertical)
|
||||
Flags |= DT_CENTER;
|
||||
}
|
||||
|
||||
// the following uses pixel values the fix alignments issues with DrawText
|
||||
// and font's that are rotated 90 degrees
|
||||
if (isSelected)
|
||||
{
|
||||
COLORREF selectedColor = ::GetSysColor(COLOR_BTNTEXT);
|
||||
::SetTextColor(hDC, selectedColor);
|
||||
rect.top -= ::GetSystemMetrics(SM_CYEDGE);
|
||||
rect.top += 1;
|
||||
rect.left += _drawTabCloseButton?spaceUnit:0;
|
||||
::DrawText(hDC, label, strlen(label), &rect, DT_SINGLELINE | DT_VCENTER | (_drawTabCloseButton?DT_LEFT:DT_CENTER));
|
||||
|
||||
if (_isVertical)
|
||||
{
|
||||
rect.bottom -= 2;
|
||||
rect.left += ::GetSystemMetrics(SM_CXEDGE) + 4;
|
||||
rect.top += (_drawTabCloseButton)?spaceUnit:0;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.top -= ::GetSystemMetrics(SM_CYEDGE);
|
||||
rect.top += 3;
|
||||
rect.left += _drawTabCloseButton?spaceUnit:0;
|
||||
}
|
||||
|
||||
if (!_isVertical)
|
||||
Flags |= DT_VCENTER;
|
||||
else
|
||||
Flags |= DT_BOTTOM;
|
||||
}
|
||||
else
|
||||
{
|
||||
COLORREF unselectedColor = grey;
|
||||
::SetTextColor(hDC, unselectedColor);
|
||||
rect.left += _drawTabCloseButton?spaceUnit:0;
|
||||
::DrawText(hDC, label, strlen(label), &rect, DT_SINGLELINE| DT_BOTTOM | (_drawTabCloseButton?DT_LEFT:DT_CENTER));
|
||||
if (_isVertical)
|
||||
{
|
||||
rect.top += 2;
|
||||
rect.bottom += 4;
|
||||
rect.left += ::GetSystemMetrics(SM_CXEDGE) + 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.left += (_drawTabCloseButton)?spaceUnit:0;
|
||||
}
|
||||
|
||||
if (!_isVertical)
|
||||
Flags |= DT_BOTTOM;
|
||||
else
|
||||
Flags |= DT_BOTTOM;
|
||||
}
|
||||
::DrawText(hDC, label, strlen(label), &rect, Flags);
|
||||
::RestoreDC(hDC, nSavedDC);
|
||||
}
|
||||
|
||||
|
@ -29,6 +29,8 @@
|
||||
#define TCN_TABDROPPEDOUTSIDE (TCN_FIRST - 11)
|
||||
#define TCN_TABDELETE (TCN_FIRST - 12)
|
||||
|
||||
#define WM_TABSETSTYLE (WM_APP + 0x024)
|
||||
|
||||
const int marge = 8;
|
||||
const int nbCtrlMax = 10;
|
||||
|
||||
@ -47,6 +49,9 @@ public:
|
||||
if (_hFont)
|
||||
DeleteObject(_hFont);
|
||||
|
||||
if (_hVerticalFont)
|
||||
DeleteObject(_hVerticalFont);
|
||||
|
||||
::DestroyWindow(_hSelf);
|
||||
_hSelf = NULL;
|
||||
|
||||
@ -96,7 +101,9 @@ public:
|
||||
if (_hFont)
|
||||
::DeleteObject(_hFont);
|
||||
|
||||
_hFont = ::CreateFont( fontSize, 0, 0, 0,
|
||||
_hFont = ::CreateFont( fontSize, 0,
|
||||
(_isVertical) ? 900:0,
|
||||
(_isVertical) ? 900:0,
|
||||
FW_NORMAL,
|
||||
0, 0, 0, 0,
|
||||
0, 0, 0, 0,
|
||||
@ -104,17 +111,27 @@ public:
|
||||
if (_hFont)
|
||||
::SendMessage(_hSelf, WM_SETFONT, reinterpret_cast<WPARAM>(_hFont), 0);
|
||||
};
|
||||
|
||||
void setVertical(bool b) {
|
||||
_isVertical = b;
|
||||
};
|
||||
|
||||
void setMultiLine(bool b) {
|
||||
_isMultiLine = b;
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
size_t _nbItem;
|
||||
bool _hasImgLst;
|
||||
HFONT _hFont;
|
||||
|
||||
HFONT _hVerticalFont;
|
||||
|
||||
int _ctrlID;
|
||||
bool _isTraditional;
|
||||
|
||||
//static int _nbCtrl;
|
||||
//static HWND _hwndArray[nbCtrlMax];
|
||||
bool _isVertical;
|
||||
bool _isMultiLine;
|
||||
|
||||
long getRowCount() const {
|
||||
return long(::SendMessage(_hSelf, TCM_GETROWCOUNT, 0, 0));
|
||||
@ -202,11 +219,29 @@ public :
|
||||
}
|
||||
};
|
||||
|
||||
static void doVertical() {
|
||||
for (int i = 0 ; i < _nbCtrl ; i++)
|
||||
{
|
||||
if (_hwndArray[i])
|
||||
SendMessage(_hwndArray[i], WM_TABSETSTYLE, isVertical(), TCS_VERTICAL);
|
||||
}
|
||||
};
|
||||
|
||||
static void doMultiLine() {
|
||||
for (int i = 0 ; i < _nbCtrl ; i++)
|
||||
{
|
||||
if (_hwndArray[i])
|
||||
SendMessage(_hwndArray[i], WM_TABSETSTYLE, isMultiLine(), TCS_MULTILINE);
|
||||
}
|
||||
};
|
||||
|
||||
static bool isOwnerDrawTab() {return true;};//(_drawInactiveTab || _drawTopBar || _drawTabCloseButton);};
|
||||
static bool drawTopBar() {return _drawTopBar;};
|
||||
static bool drawInactiveTab() {return _drawInactiveTab;};
|
||||
static bool drawTabCloseButton() {return _drawTabCloseButton;};
|
||||
static bool isDbClk2Close() {return _isDbClk2Close;};
|
||||
static bool isVertical() { return _isCtrlVertical;};
|
||||
static bool isMultiLine() { return _isCtrlMultiLine;};
|
||||
|
||||
static void setDrawTopBar(bool b) {
|
||||
_drawTopBar = b;
|
||||
@ -225,6 +260,16 @@ public :
|
||||
_isDbClk2Close = b;
|
||||
};
|
||||
|
||||
static void setVertical(bool b) {
|
||||
_isCtrlVertical = b;
|
||||
doVertical();
|
||||
};
|
||||
|
||||
static void setMultiLine(bool b) {
|
||||
_isCtrlMultiLine = b;
|
||||
doMultiLine();
|
||||
};
|
||||
|
||||
protected:
|
||||
// it's the boss to decide if we do the drag N drop
|
||||
static bool _doDragNDrop;
|
||||
@ -257,6 +302,8 @@ protected:
|
||||
static bool _drawTopBar;
|
||||
static bool _drawTabCloseButton;
|
||||
static bool _isDbClk2Close;
|
||||
static bool _isCtrlVertical;
|
||||
static bool _isCtrlMultiLine;
|
||||
|
||||
static int _nbCtrl;
|
||||
static HWND _hwndArray[nbCtrlMax];
|
||||
|
@ -145,6 +145,8 @@
|
||||
#define IDM_VIEW_REFRESHTABAR (IDM_VIEW + 40)
|
||||
#define IDM_VIEW_WRAP_SYMBOL (IDM_VIEW + 41)
|
||||
#define IDM_VIEW_HIDELINES (IDM_VIEW + 42)
|
||||
#define IDM_VIEW_DRAWTABBAR_VERTICAL (IDM_VIEW + 43)
|
||||
#define IDM_VIEW_DRAWTABBAR_MULTILINE (IDM_VIEW + 44)
|
||||
|
||||
#define IDM_VIEW_FOLD (IDM_VIEW + 50)
|
||||
#define IDM_VIEW_FOLD_1 (IDM_VIEW_FOLD + 1)
|
||||
|
@ -134,7 +134,7 @@
|
||||
FavorSizeOrSpeed="2"
|
||||
OmitFramePointers="false"
|
||||
WholeProgramOptimization="false"
|
||||
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd"
|
||||
AdditionalIncludeDirectories="..\src\WinControls\AboutDlg;..\..\scintilla\include;..\include;..\src\WinControls;..\src\WinControls\ImageListSet;..\src\WinControls\OpenSaveFileDialog;..\src\WinControls\SplitterContainer;..\src\WinControls\StaticDialog;..\src\WinControls\TabBar;..\src\WinControls\ToolBar;..\src\MISC\Process;..\src\ScitillaComponent;..\src\MISC;..\src\MISC\SysMsg;..\src\WinControls\StatusBar;..\src;..\src\WinControls\StaticDialog\RunDlg;..\src\tinyxml;..\src\WinControls\ColourPicker;..\src\Win32Explr;..\src\MISC\RegExt;..\src\WinControls\TrayIcon;..\src\WinControls\shortcut;..\src\WinControls\Grid;..\src\WinControls\ContextMenu;..\src\MISC\PluginsManager;..\src\WinControls\Preference;..\src\WinControls\WindowsDlg;..\src\WinControls\TaskList;..\src\WinControls\DockingWnd;..\src\WinControls\ToolTip"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="0"
|
||||
@ -577,11 +577,11 @@
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
RelativePath="..\src\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\src\resource.h"
|
||||
RelativePath="..\src\WinControls\Preference\resource.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
|
Loading…
Reference in New Issue
Block a user