From 58a8ab88685a72ac030d5e2ade62b4d796f11bed Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Sun, 21 Mar 1999 22:39:45 +0000 Subject: [PATCH] Added wxTreeCtrl::SetItemDropHighlight (wxMSW only); added WS_CLIPCHILDREN style to wxNotebook. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1947 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- distrib/msw/generic.rsp | 3 +++ docs/changes.txt | 17 +++++++++++++++++ include/wx/defs.h | 11 +++++------ include/wx/msw/notebook.h | 4 ++++ include/wx/msw/treectrl.h | 3 +++ src/common/image.cpp | 7 ++++++- src/msw/notebook.cpp | 31 +++++++++++++++++++++++++++---- src/msw/treectrl.cpp | 14 ++++++++++++++ 8 files changed, 79 insertions(+), 11 deletions(-) diff --git a/distrib/msw/generic.rsp b/distrib/msw/generic.rsp index 8c108c03d6..7dacd802e9 100644 --- a/distrib/msw/generic.rsp +++ b/distrib/msw/generic.rsp @@ -36,6 +36,8 @@ src/generic/*.cpp src/generic/*.c src/generic/*.inc +src/unix/*.cpp + src/png/*.c src/png/*.h src/png/makefile* @@ -66,6 +68,7 @@ include/wx/protocol/*.h include/wx/wx_setup.vms include/wx/common/*.h include/wx/generic/*.h +include/wx/unix/*.h lib/dummy bin/*.* diff --git a/docs/changes.txt b/docs/changes.txt index 4361ed5d79..807a411a06 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -1,6 +1,23 @@ wxWindows 2 Change Log ---------------------- +2.0.2, March ?? 1999 +--------------------- + +wxGTK: + + +wxMSW: + +- wxNotebook changes: can add image only; wxNB_FIXEDWIDTH added; + SetTabSize added. + +wxMotif: + + +General: + + 2.0.1 (release), March 1st 1999 ------------------------------- diff --git a/include/wx/defs.h b/include/wx/defs.h index 086127f369..d0d54f441a 100644 --- a/include/wx/defs.h +++ b/include/wx/defs.h @@ -591,17 +591,16 @@ typedef void (*wxFunction) (wxObject&, wxEvent&); * wxTabCtrl flags */ -#define wxTAB_MULTILINE 0x0000 -#define wxTAB_RIGHTJUSTIFY 0x0004 -#define wxTAB_FIXEDWIDTH 0x0008 -#define wxTAB_OWNERDRAW 0x0010 - -// Sorry, I changed my mind about these names... #define wxTC_MULTILINE 0x0000 #define wxTC_RIGHTJUSTIFY 0x0004 #define wxTC_FIXEDWIDTH 0x0008 #define wxTC_OWNERDRAW 0x0010 +/* + * wxNotebook flags + */ +#define wxNB_FIXEDWIDTH 0x0008 + /* * wxStatusBar95 flags */ diff --git a/include/wx/msw/notebook.h b/include/wx/msw/notebook.h index 4fe6aa40a0..3f4697fab9 100644 --- a/include/wx/msw/notebook.h +++ b/include/wx/msw/notebook.h @@ -166,6 +166,10 @@ public: // get the panel which represents the given page wxNotebookPage *GetPage(int nPage) { return m_aPages[nPage]; } + // Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH + // style. + void SetTabSize(const wxSize& sz); + // callbacks // --------- void OnSize(wxSizeEvent& event); diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 51e1e02d3c..f20bb7501e 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -253,6 +253,9 @@ public: // the item will be shown in bold void SetItemBold(const wxTreeItemId& item, bool bold = TRUE); + // the item will be shown with a drop highlight + void SetItemDropHighlight(const wxTreeItemId& item, bool highlight = TRUE); + // item status inquiries // --------------------- diff --git a/src/common/image.cpp b/src/common/image.cpp index 3bd976b987..151ba3b73e 100644 --- a/src/common/image.cpp +++ b/src/common/image.cpp @@ -36,6 +36,9 @@ extern "C" { #include "wx/intl.h" #include "wx/module.h" +// For memcpy +#include + #ifdef __SALFORDC__ #ifdef FAR #undef FAR @@ -256,9 +259,11 @@ char unsigned *wxImage::GetData() const return M_IMGDATA->m_data; } -void wxImage::SetData( char unsigned *WXUNUSED(data) ) +void wxImage::SetData( char unsigned *data ) { wxCHECK_RET( Ok(), "invalid image" ); + + memcpy(M_IMGDATA->m_data, data, M_IMGDATA->m_width * M_IMGDATA->m_height * 3); } void wxImage::SetMaskColour( unsigned char r, unsigned char g, unsigned char b ) diff --git a/src/msw/notebook.cpp b/src/msw/notebook.cpp index 34e0b589af..4a1d57d6b7 100644 --- a/src/msw/notebook.cpp +++ b/src/msw/notebook.cpp @@ -133,11 +133,13 @@ bool wxNotebook::Create(wxWindow *parent, // style m_windowStyle = style | wxTAB_TRAVERSAL; - long tabStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | TCS_TABS; + long tabStyle = WS_CHILD | WS_VISIBLE | WS_TABSTOP | TCS_TABS | WS_CLIPCHILDREN; if ( m_windowStyle & wxTC_MULTILINE ) tabStyle |= TCS_MULTILINE; if ( m_windowStyle & wxBORDER ) tabStyle &= WS_BORDER; + if (m_windowStyle & wxNB_FIXEDWIDTH) + tabStyle |= TCS_FIXEDWIDTH ; // create the tab control. m_hWnd = (WXHWND)CreateWindowEx @@ -332,9 +334,23 @@ bool wxNotebook::InsertPage(int nPage, // add the tab to the control TC_ITEM tcItem; - tcItem.mask = TCIF_TEXT | TCIF_IMAGE; - tcItem.pszText = (char *)strText.c_str(); - tcItem.iImage = imageId; + tcItem.mask = 0; + + if (imageId != -1) + { + tcItem.mask |= TCIF_IMAGE; + tcItem.iImage = imageId; + } + else + tcItem.iImage = 0; + + if (!strText.IsEmpty()) + { + tcItem.mask |= TCIF_TEXT; + tcItem.pszText = (char *)strText.c_str(); + } + else + tcItem.pszText = (char *) NULL; if ( TabCtrl_InsertItem(m_hwnd, nPage, &tcItem) == -1 ) { wxLogError("Can't create the notebook page '%s'.", strText.c_str()); @@ -525,3 +541,10 @@ void wxNotebook::OnEraseBackground(wxEraseEvent& event) Default(); } +// Windows-only at present. Also, you must use the wxNB_FIXEDWIDTH +// style. +void wxNotebook::SetTabSize(const wxSize& sz) +{ + ::SendMessage((HWND) GetHWND(), TCM_SETITEMSIZE, 0, MAKELPARAM(sz.x, sz.y)); +} + diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index 7f8fd2847b..0446ef1aed 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -377,6 +377,13 @@ void wxTreeCtrl::SetItemBold(const wxTreeItemId& item, bool bold) DoSetItem(&tvItem); } +void wxTreeCtrl::SetItemDropHighlight(const wxTreeItemId& item, bool highlight) +{ + wxTreeViewItem tvItem(item, TVIF_STATE, TVIS_DROPHILITED); + tvItem.state = highlight ? TVIS_DROPHILITED : 0; + DoSetItem(&tvItem); +} + // ---------------------------------------------------------------------------- // Item status // ---------------------------------------------------------------------------- @@ -522,6 +529,13 @@ wxTreeItemId wxTreeCtrl::DoInsertItem(const wxTreeItemId& parent, TV_INSERTSTRUCT tvIns; tvIns.hParent = (HTREEITEM) (WXHTREEITEM)parent; tvIns.hInsertAfter = (HTREEITEM) (WXHTREEITEM) hInsertAfter; + + // This is how we insert the item as the first child: supply a NULL hInsertAfter + if (tvIns.hInsertAfter == (HTREEITEM) 0) + { + tvIns.hInsertAfter = TVI_FIRST; + } + UINT mask = 0; if ( !text.IsEmpty() ) { -- 2.45.2