Merge branch 'owner-draw-headers'

Implement support for changing fonts and colours in wxMSW header control.
This commit is contained in:
Vadim Zeitlin
2016-04-23 17:52:49 +02:00
48 changed files with 1065 additions and 231 deletions

View File

@@ -3872,6 +3872,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \
wx/systhemectrl.h \ wx/systhemectrl.h \
wx/collheaderctrl.h \ wx/collheaderctrl.h \
wx/generic/collheaderctrl.h \ wx/generic/collheaderctrl.h \
wx/itemattr.h \
$(LOWLEVEL_HDR) \ $(LOWLEVEL_HDR) \
$(GUI_CORE_HEADERS) \ $(GUI_CORE_HEADERS) \
$(ADVANCED_HDR) \ $(ADVANCED_HDR) \
@@ -5351,6 +5352,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS = \
monodll_msw_tglbtn.o \ monodll_msw_tglbtn.o \
monodll_treectrl.o \ monodll_treectrl.o \
monodll_systhemectrl.o \ monodll_systhemectrl.o \
monodll_customdraw.o \
monodll_msw_checklst.o \ monodll_msw_checklst.o \
monodll_msw_fdrepdlg.o \ monodll_msw_fdrepdlg.o \
monodll_msw_fontdlg.o monodll_msw_fontdlg.o
@@ -7365,6 +7367,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_1 = \
monolib_msw_tglbtn.o \ monolib_msw_tglbtn.o \
monolib_treectrl.o \ monolib_treectrl.o \
monolib_systhemectrl.o \ monolib_systhemectrl.o \
monolib_customdraw.o \
monolib_msw_checklst.o \ monolib_msw_checklst.o \
monolib_msw_fdrepdlg.o \ monolib_msw_fdrepdlg.o \
monolib_msw_fontdlg.o monolib_msw_fontdlg.o
@@ -9520,6 +9523,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_2 = \
coredll_msw_tglbtn.o \ coredll_msw_tglbtn.o \
coredll_treectrl.o \ coredll_treectrl.o \
coredll_systhemectrl.o \ coredll_systhemectrl.o \
coredll_customdraw.o \
coredll_msw_checklst.o \ coredll_msw_checklst.o \
coredll_msw_fdrepdlg.o \ coredll_msw_fdrepdlg.o \
coredll_msw_fontdlg.o coredll_msw_fontdlg.o
@@ -10989,6 +10993,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_3 = \
corelib_msw_tglbtn.o \ corelib_msw_tglbtn.o \
corelib_treectrl.o \ corelib_treectrl.o \
corelib_systhemectrl.o \ corelib_systhemectrl.o \
corelib_customdraw.o \
corelib_msw_checklst.o \ corelib_msw_checklst.o \
corelib_msw_fdrepdlg.o \ corelib_msw_fdrepdlg.o \
corelib_msw_fontdlg.o corelib_msw_fontdlg.o
@@ -16390,6 +16395,9 @@ monodll_treectrl.o: $(srcdir)/src/msw/treectrl.cpp $(MONODLL_ODEP)
monodll_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(MONODLL_ODEP) monodll_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp
monodll_customdraw.o: $(srcdir)/src/msw/customdraw.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/customdraw.cpp
monodll_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(MONODLL_ODEP) monodll_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp
@@ -21220,6 +21228,9 @@ monolib_treectrl.o: $(srcdir)/src/msw/treectrl.cpp $(MONOLIB_ODEP)
monolib_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(MONOLIB_ODEP) monolib_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp
monolib_customdraw.o: $(srcdir)/src/msw/customdraw.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/customdraw.cpp
monolib_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(MONOLIB_ODEP) monolib_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(MONOLIB_ODEP)
$(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp $(CXXC) -c -o $@ $(MONOLIB_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp
@@ -26701,6 +26712,9 @@ coredll_treectrl.o: $(srcdir)/src/msw/treectrl.cpp $(COREDLL_ODEP)
coredll_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(COREDLL_ODEP) coredll_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp
coredll_customdraw.o: $(srcdir)/src/msw/customdraw.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/customdraw.cpp
coredll_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(COREDLL_ODEP) coredll_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(COREDLL_ODEP)
$(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp $(CXXC) -c -o $@ $(COREDLL_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp
@@ -30088,6 +30102,9 @@ corelib_treectrl.o: $(srcdir)/src/msw/treectrl.cpp $(CORELIB_ODEP)
corelib_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(CORELIB_ODEP) corelib_systhemectrl.o: $(srcdir)/src/msw/systhemectrl.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/systhemectrl.cpp
corelib_customdraw.o: $(srcdir)/src/msw/customdraw.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/customdraw.cpp
corelib_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(CORELIB_ODEP) corelib_msw_checklst.o: $(srcdir)/src/msw/checklst.cpp $(CORELIB_ODEP)
$(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp

View File

@@ -1181,6 +1181,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
wx/systhemectrl.h wx/systhemectrl.h
wx/collheaderctrl.h wx/collheaderctrl.h
wx/generic/collheaderctrl.h wx/generic/collheaderctrl.h
wx/itemattr.h
</set> </set>
<!-- ====================================================================== --> <!-- ====================================================================== -->
@@ -1982,6 +1983,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file!
src/msw/tglbtn.cpp src/msw/tglbtn.cpp
src/msw/treectrl.cpp src/msw/treectrl.cpp
src/msw/systhemectrl.cpp src/msw/systhemectrl.cpp
src/msw/customdraw.cpp
</set> </set>
<set var="MSW_HDR" hints="files"> <set var="MSW_HDR" hints="files">
wx/generic/clrpickerg.h wx/generic/clrpickerg.h

View File

@@ -1039,6 +1039,7 @@ GUI_CMN_HDR =
wx/imagtga.h wx/imagtga.h
wx/imagtiff.h wx/imagtiff.h
wx/imagxpm.h wx/imagxpm.h
wx/itemattr.h
wx/listbase.h wx/listbase.h
wx/listbook.h wx/listbook.h
wx/listctrl.h wx/listctrl.h
@@ -1797,6 +1798,7 @@ MSW_SRC =
src/msw/combo.cpp src/msw/combo.cpp
src/msw/combobox.cpp src/msw/combobox.cpp
src/msw/control.cpp src/msw/control.cpp
src/msw/customdraw.cpp
src/msw/dialog.cpp src/msw/dialog.cpp
src/msw/dirdlg.cpp src/msw/dirdlg.cpp
src/msw/dragimag.cpp src/msw/dragimag.cpp

View File

@@ -1897,6 +1897,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_msw_tglbtn.obj \ $(OBJS)\monodll_msw_tglbtn.obj \
$(OBJS)\monodll_treectrl.obj \ $(OBJS)\monodll_treectrl.obj \
$(OBJS)\monodll_systhemectrl.obj \ $(OBJS)\monodll_systhemectrl.obj \
$(OBJS)\monodll_customdraw.obj \
$(OBJS)\monodll_msw_checklst.obj \ $(OBJS)\monodll_msw_checklst.obj \
$(OBJS)\monodll_msw_fdrepdlg.obj \ $(OBJS)\monodll_msw_fdrepdlg.obj \
$(OBJS)\monodll_fontdlg.obj \ $(OBJS)\monodll_fontdlg.obj \
@@ -2728,6 +2729,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_msw_tglbtn.obj \ $(OBJS)\monolib_msw_tglbtn.obj \
$(OBJS)\monolib_treectrl.obj \ $(OBJS)\monolib_treectrl.obj \
$(OBJS)\monolib_systhemectrl.obj \ $(OBJS)\monolib_systhemectrl.obj \
$(OBJS)\monolib_customdraw.obj \
$(OBJS)\monolib_msw_checklst.obj \ $(OBJS)\monolib_msw_checklst.obj \
$(OBJS)\monolib_msw_fdrepdlg.obj \ $(OBJS)\monolib_msw_fdrepdlg.obj \
$(OBJS)\monolib_fontdlg.obj \ $(OBJS)\monolib_fontdlg.obj \
@@ -3431,6 +3433,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_msw_tglbtn.obj \ $(OBJS)\coredll_msw_tglbtn.obj \
$(OBJS)\coredll_treectrl.obj \ $(OBJS)\coredll_treectrl.obj \
$(OBJS)\coredll_systhemectrl.obj \ $(OBJS)\coredll_systhemectrl.obj \
$(OBJS)\coredll_customdraw.obj \
$(OBJS)\coredll_msw_checklst.obj \ $(OBJS)\coredll_msw_checklst.obj \
$(OBJS)\coredll_msw_fdrepdlg.obj \ $(OBJS)\coredll_msw_fdrepdlg.obj \
$(OBJS)\coredll_fontdlg.obj \ $(OBJS)\coredll_fontdlg.obj \
@@ -4002,6 +4005,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_msw_tglbtn.obj \ $(OBJS)\corelib_msw_tglbtn.obj \
$(OBJS)\corelib_treectrl.obj \ $(OBJS)\corelib_treectrl.obj \
$(OBJS)\corelib_systhemectrl.obj \ $(OBJS)\corelib_systhemectrl.obj \
$(OBJS)\corelib_customdraw.obj \
$(OBJS)\corelib_msw_checklst.obj \ $(OBJS)\corelib_msw_checklst.obj \
$(OBJS)\corelib_msw_fdrepdlg.obj \ $(OBJS)\corelib_msw_fdrepdlg.obj \
$(OBJS)\corelib_fontdlg.obj \ $(OBJS)\corelib_fontdlg.obj \
@@ -6927,6 +6931,9 @@ $(OBJS)\monodll_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\monodll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monodll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\monodll_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\monodll_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\monodll_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\checklst.cpp
@@ -9462,6 +9469,9 @@ $(OBJS)\monolib_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\monolib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monolib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\monolib_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\monolib_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\monolib_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) -q -c -P -o$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\checklst.cpp
@@ -12405,6 +12415,9 @@ $(OBJS)\coredll_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\coredll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\coredll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\coredll_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\coredll_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\coredll_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) -q -c -P -o$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\checklst.cpp
@@ -13882,6 +13895,9 @@ $(OBJS)\corelib_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\corelib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\corelib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\corelib_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\corelib_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\corelib_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\checklst.cpp

View File

@@ -1916,6 +1916,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_msw_tglbtn.o \ $(OBJS)\monodll_msw_tglbtn.o \
$(OBJS)\monodll_treectrl.o \ $(OBJS)\monodll_treectrl.o \
$(OBJS)\monodll_systhemectrl.o \ $(OBJS)\monodll_systhemectrl.o \
$(OBJS)\monodll_customdraw.o \
$(OBJS)\monodll_msw_checklst.o \ $(OBJS)\monodll_msw_checklst.o \
$(OBJS)\monodll_msw_fdrepdlg.o \ $(OBJS)\monodll_msw_fdrepdlg.o \
$(OBJS)\monodll_fontdlg.o \ $(OBJS)\monodll_fontdlg.o \
@@ -2753,6 +2754,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_msw_tglbtn.o \ $(OBJS)\monolib_msw_tglbtn.o \
$(OBJS)\monolib_treectrl.o \ $(OBJS)\monolib_treectrl.o \
$(OBJS)\monolib_systhemectrl.o \ $(OBJS)\monolib_systhemectrl.o \
$(OBJS)\monolib_customdraw.o \
$(OBJS)\monolib_msw_checklst.o \ $(OBJS)\monolib_msw_checklst.o \
$(OBJS)\monolib_msw_fdrepdlg.o \ $(OBJS)\monolib_msw_fdrepdlg.o \
$(OBJS)\monolib_fontdlg.o \ $(OBJS)\monolib_fontdlg.o \
@@ -3472,6 +3474,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_msw_tglbtn.o \ $(OBJS)\coredll_msw_tglbtn.o \
$(OBJS)\coredll_treectrl.o \ $(OBJS)\coredll_treectrl.o \
$(OBJS)\coredll_systhemectrl.o \ $(OBJS)\coredll_systhemectrl.o \
$(OBJS)\coredll_customdraw.o \
$(OBJS)\coredll_msw_checklst.o \ $(OBJS)\coredll_msw_checklst.o \
$(OBJS)\coredll_msw_fdrepdlg.o \ $(OBJS)\coredll_msw_fdrepdlg.o \
$(OBJS)\coredll_fontdlg.o \ $(OBJS)\coredll_fontdlg.o \
@@ -4051,6 +4054,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_msw_tglbtn.o \ $(OBJS)\corelib_msw_tglbtn.o \
$(OBJS)\corelib_treectrl.o \ $(OBJS)\corelib_treectrl.o \
$(OBJS)\corelib_systhemectrl.o \ $(OBJS)\corelib_systhemectrl.o \
$(OBJS)\corelib_customdraw.o \
$(OBJS)\corelib_msw_checklst.o \ $(OBJS)\corelib_msw_checklst.o \
$(OBJS)\corelib_msw_fdrepdlg.o \ $(OBJS)\corelib_msw_fdrepdlg.o \
$(OBJS)\corelib_fontdlg.o \ $(OBJS)\corelib_fontdlg.o \
@@ -7102,6 +7106,9 @@ $(OBJS)\monodll_treectrl.o: ../../src/msw/treectrl.cpp
$(OBJS)\monodll_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\monodll_systhemectrl.o: ../../src/msw/systhemectrl.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_customdraw.o: ../../src/msw/customdraw.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_msw_checklst.o: ../../src/msw/checklst.cpp $(OBJS)\monodll_msw_checklst.o: ../../src/msw/checklst.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<
@@ -9639,6 +9646,9 @@ $(OBJS)\monolib_treectrl.o: ../../src/msw/treectrl.cpp
$(OBJS)\monolib_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\monolib_systhemectrl.o: ../../src/msw/systhemectrl.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_customdraw.o: ../../src/msw/customdraw.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monolib_msw_checklst.o: ../../src/msw/checklst.cpp $(OBJS)\monolib_msw_checklst.o: ../../src/msw/checklst.cpp
$(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(MONOLIB_CXXFLAGS) $(CPPDEPS) $<
@@ -12584,6 +12594,9 @@ $(OBJS)\coredll_treectrl.o: ../../src/msw/treectrl.cpp
$(OBJS)\coredll_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\coredll_systhemectrl.o: ../../src/msw/systhemectrl.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\coredll_customdraw.o: ../../src/msw/customdraw.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\coredll_msw_checklst.o: ../../src/msw/checklst.cpp $(OBJS)\coredll_msw_checklst.o: ../../src/msw/checklst.cpp
$(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(COREDLL_CXXFLAGS) $(CPPDEPS) $<
@@ -14061,6 +14074,9 @@ $(OBJS)\corelib_treectrl.o: ../../src/msw/treectrl.cpp
$(OBJS)\corelib_systhemectrl.o: ../../src/msw/systhemectrl.cpp $(OBJS)\corelib_systhemectrl.o: ../../src/msw/systhemectrl.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\corelib_customdraw.o: ../../src/msw/customdraw.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\corelib_msw_checklst.o: ../../src/msw/checklst.cpp $(OBJS)\corelib_msw_checklst.o: ../../src/msw/checklst.cpp
$(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -2197,6 +2197,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \
$(OBJS)\monodll_msw_tglbtn.obj \ $(OBJS)\monodll_msw_tglbtn.obj \
$(OBJS)\monodll_treectrl.obj \ $(OBJS)\monodll_treectrl.obj \
$(OBJS)\monodll_systhemectrl.obj \ $(OBJS)\monodll_systhemectrl.obj \
$(OBJS)\monodll_customdraw.obj \
$(OBJS)\monodll_msw_checklst.obj \ $(OBJS)\monodll_msw_checklst.obj \
$(OBJS)\monodll_msw_fdrepdlg.obj \ $(OBJS)\monodll_msw_fdrepdlg.obj \
$(OBJS)\monodll_fontdlg.obj \ $(OBJS)\monodll_fontdlg.obj \
@@ -3034,6 +3035,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \
$(OBJS)\monolib_msw_tglbtn.obj \ $(OBJS)\monolib_msw_tglbtn.obj \
$(OBJS)\monolib_treectrl.obj \ $(OBJS)\monolib_treectrl.obj \
$(OBJS)\monolib_systhemectrl.obj \ $(OBJS)\monolib_systhemectrl.obj \
$(OBJS)\monolib_customdraw.obj \
$(OBJS)\monolib_msw_checklst.obj \ $(OBJS)\monolib_msw_checklst.obj \
$(OBJS)\monolib_msw_fdrepdlg.obj \ $(OBJS)\monolib_msw_fdrepdlg.obj \
$(OBJS)\monolib_fontdlg.obj \ $(OBJS)\monolib_fontdlg.obj \
@@ -3803,6 +3805,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \
$(OBJS)\coredll_msw_tglbtn.obj \ $(OBJS)\coredll_msw_tglbtn.obj \
$(OBJS)\coredll_treectrl.obj \ $(OBJS)\coredll_treectrl.obj \
$(OBJS)\coredll_systhemectrl.obj \ $(OBJS)\coredll_systhemectrl.obj \
$(OBJS)\coredll_customdraw.obj \
$(OBJS)\coredll_msw_checklst.obj \ $(OBJS)\coredll_msw_checklst.obj \
$(OBJS)\coredll_msw_fdrepdlg.obj \ $(OBJS)\coredll_msw_fdrepdlg.obj \
$(OBJS)\coredll_fontdlg.obj \ $(OBJS)\coredll_fontdlg.obj \
@@ -4380,6 +4383,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \
$(OBJS)\corelib_msw_tglbtn.obj \ $(OBJS)\corelib_msw_tglbtn.obj \
$(OBJS)\corelib_treectrl.obj \ $(OBJS)\corelib_treectrl.obj \
$(OBJS)\corelib_systhemectrl.obj \ $(OBJS)\corelib_systhemectrl.obj \
$(OBJS)\corelib_customdraw.obj \
$(OBJS)\corelib_msw_checklst.obj \ $(OBJS)\corelib_msw_checklst.obj \
$(OBJS)\corelib_msw_fdrepdlg.obj \ $(OBJS)\corelib_msw_fdrepdlg.obj \
$(OBJS)\corelib_fontdlg.obj \ $(OBJS)\corelib_fontdlg.obj \
@@ -7619,6 +7623,9 @@ $(OBJS)\monodll_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\monodll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monodll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\monodll_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\monodll_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\monodll_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) ..\..\src\msw\checklst.cpp
@@ -10154,6 +10161,9 @@ $(OBJS)\monolib_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\monolib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\monolib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\monolib_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\monolib_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\monolib_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONOLIB_CXXFLAGS) ..\..\src\msw\checklst.cpp
@@ -13097,6 +13107,9 @@ $(OBJS)\coredll_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\coredll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\coredll_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\coredll_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\coredll_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\coredll_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) /c /nologo /TP /Fo$@ $(COREDLL_CXXFLAGS) ..\..\src\msw\checklst.cpp
@@ -14574,6 +14587,9 @@ $(OBJS)\corelib_treectrl.obj: ..\..\src\msw\treectrl.cpp
$(OBJS)\corelib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp $(OBJS)\corelib_systhemectrl.obj: ..\..\src\msw\systhemectrl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\systhemectrl.cpp
$(OBJS)\corelib_customdraw.obj: ..\..\src\msw\customdraw.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\customdraw.cpp
$(OBJS)\corelib_msw_checklst.obj: ..\..\src\msw\checklst.cpp $(OBJS)\corelib_msw_checklst.obj: ..\..\src\msw\checklst.cpp
$(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\checklst.cpp $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\checklst.cpp

View File

@@ -1007,6 +1007,7 @@
<ClCompile Include="..\..\src\xrc\xmlreshandler.cpp" /> <ClCompile Include="..\..\src\xrc\xmlreshandler.cpp" />
<ClCompile Include="..\..\src\generic\collheaderctrlg.cpp" /> <ClCompile Include="..\..\src\generic\collheaderctrlg.cpp" />
<ClCompile Include="..\..\src\msw\rt\utilsrt.cpp" /> <ClCompile Include="..\..\src\msw\rt\utilsrt.cpp" />
<ClCompile Include="..\..\src\msw\customdraw.cpp" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc"> <ResourceCompile Include="..\..\src\msw\version.rc">
@@ -1379,6 +1380,7 @@
<ClInclude Include="..\..\include\wx\collheaderctrl.h" /> <ClInclude Include="..\..\include\wx\collheaderctrl.h" />
<ClInclude Include="..\..\include\wx\generic\collheaderctrl.h" /> <ClInclude Include="..\..\include\wx\generic\collheaderctrl.h" />
<ClInclude Include="..\..\include\wx\msw\rt\utils.h" /> <ClInclude Include="..\..\include\wx\msw\rt\utils.h" />
<ClInclude Include="..\..\include\wx\itemattr.h" />
</ItemGroup> </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets"> <ImportGroup Label="ExtensionTargets">

View File

@@ -612,6 +612,9 @@
<ClCompile Include="..\..\src\msw\cursor.cpp"> <ClCompile Include="..\..\src\msw\cursor.cpp">
<Filter>MSW Sources</Filter> <Filter>MSW Sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\msw\customdraw.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\msw\data.cpp"> <ClCompile Include="..\..\src\msw\data.cpp">
<Filter>MSW Sources</Filter> <Filter>MSW Sources</Filter>
</ClCompile> </ClCompile>
@@ -690,6 +693,9 @@
<ClCompile Include="..\..\src\msw\graphics.cpp"> <ClCompile Include="..\..\src\msw\graphics.cpp">
<Filter>MSW Sources</Filter> <Filter>MSW Sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\msw\graphicsd2d.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
<ClCompile Include="..\..\src\msw\headerctrl.cpp"> <ClCompile Include="..\..\src\msw\headerctrl.cpp">
<Filter>MSW Sources</Filter> <Filter>MSW Sources</Filter>
</ClCompile> </ClCompile>
@@ -897,9 +903,6 @@
<ClCompile Include="..\..\src\xrc\xmlreshandler.cpp"> <ClCompile Include="..\..\src\xrc\xmlreshandler.cpp">
<Filter>Common Sources</Filter> <Filter>Common Sources</Filter>
</ClCompile> </ClCompile>
<ClCompile Include="..\..\src\msw\graphicsd2d.cpp">
<Filter>MSW Sources</Filter>
</ClCompile>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<ResourceCompile Include="..\..\src\msw\version.rc"> <ResourceCompile Include="..\..\src\msw\version.rc">
@@ -928,6 +931,9 @@
<ClInclude Include="..\..\include\wx\anybutton.h"> <ClInclude Include="..\..\include\wx\anybutton.h">
<Filter>Common Headers</Filter> <Filter>Common Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\include\wx\appprogress.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\artprov.h"> <ClInclude Include="..\..\include\wx\artprov.h">
<Filter>Common Headers</Filter> <Filter>Common Headers</Filter>
</ClInclude> </ClInclude>
@@ -1312,6 +1318,9 @@
<ClInclude Include="..\..\include\wx\infobar.h"> <ClInclude Include="..\..\include\wx\infobar.h">
<Filter>Common Headers</Filter> <Filter>Common Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\include\wx\itemattr.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\itemid.h"> <ClInclude Include="..\..\include\wx\itemid.h">
<Filter>Common Headers</Filter> <Filter>Common Headers</Filter>
</ClInclude> </ClInclude>
@@ -1672,9 +1681,6 @@
<ClInclude Include="..\..\include\wx\msw\window.h"> <ClInclude Include="..\..\include\wx\msw\window.h">
<Filter>MSW Headers</Filter> <Filter>MSW Headers</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="..\..\include\wx\appprogress.h">
<Filter>Common Headers</Filter>
</ClInclude>
<ClInclude Include="..\..\include\wx\nativewin.h"> <ClInclude Include="..\..\include\wx\nativewin.h">
<Filter>Common Headers</Filter> <Filter>Common Headers</Filter>
</ClInclude> </ClInclude>

View File

@@ -769,6 +769,9 @@
<File <File
RelativePath="..\..\src\msw\cursor.cpp"> RelativePath="..\..\src\msw\cursor.cpp">
</File> </File>
<File
RelativePath="..\..\src\msw\customdraw.cpp">
</File>
<File <File
RelativePath="..\..\src\msw\data.cpp"> RelativePath="..\..\src\msw\data.cpp">
</File> </File>
@@ -2285,6 +2288,9 @@
<File <File
RelativePath="..\..\include\wx\infobar.h"> RelativePath="..\..\include\wx\infobar.h">
</File> </File>
<File
RelativePath="..\..\include\wx\itemattr.h">
</File>
<File <File
RelativePath="..\..\include\wx\itemid.h"> RelativePath="..\..\include\wx\itemid.h">
</File> </File>

View File

@@ -1430,6 +1430,10 @@
RelativePath="..\..\src\msw\cursor.cpp" RelativePath="..\..\src\msw\cursor.cpp"
> >
</File> </File>
<File
RelativePath="..\..\src\msw\customdraw.cpp"
>
</File>
<File <File
RelativePath="..\..\src\msw\data.cpp" RelativePath="..\..\src\msw\data.cpp"
> >
@@ -3548,6 +3552,10 @@
RelativePath="..\..\include\wx\infobar.h" RelativePath="..\..\include\wx\infobar.h"
> >
</File> </File>
<File
RelativePath="..\..\include\wx\itemattr.h"
>
</File>
<File <File
RelativePath="..\..\include\wx\itemid.h" RelativePath="..\..\include\wx\itemid.h"
> >

View File

@@ -1426,6 +1426,10 @@
RelativePath="..\..\src\msw\cursor.cpp" RelativePath="..\..\src\msw\cursor.cpp"
> >
</File> </File>
<File
RelativePath="..\..\src\msw\customdraw.cpp"
>
</File>
<File <File
RelativePath="..\..\src\msw\data.cpp" RelativePath="..\..\src\msw\data.cpp"
> >
@@ -3544,6 +3548,10 @@
RelativePath="..\..\include\wx\infobar.h" RelativePath="..\..\include\wx\infobar.h"
> >
</File> </File>
<File
RelativePath="..\..\include\wx\itemattr.h"
>
</File>
<File <File
RelativePath="..\..\include\wx\itemid.h" RelativePath="..\..\include\wx\itemid.h"
> >

View File

@@ -71,6 +71,8 @@ All (GUI):
- Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius). - Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius).
- Update Scintilla to v3.6.3 (Paul Kulchenko). - Update Scintilla to v3.6.3 (Paul Kulchenko).
- Make wxDataViewCtrl::Expand() expand ancestors in native ports too. - Make wxDataViewCtrl::Expand() expand ancestors in native ports too.
- Add wxDataViewCtrl::SetHeaderAttr().
- Add wxListCtrl::SetHeaderAttr().
wxGTK: wxGTK:

View File

@@ -29,6 +29,8 @@
#include "wx/systhemectrl.h" #include "wx/systhemectrl.h"
class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_FWD_CORE wxImageList;
class WXDLLIMPEXP_FWD_CORE wxItemAttr;
class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl;
#if !(defined(__WXGTK20__) || defined(__WXOSX__) ) || defined(__WXUNIVERSAL__) #if !(defined(__WXGTK20__) || defined(__WXOSX__) ) || defined(__WXUNIVERSAL__)
// #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__) // #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__)
@@ -128,7 +130,7 @@ private:
// wxDataViewItemAttr: a structure containing the visual attributes of an item // wxDataViewItemAttr: a structure containing the visual attributes of an item
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// TODO: this should be renamed to wxItemAttr or something general like this // TODO: Merge with wxItemAttr somehow.
class WXDLLIMPEXP_ADV wxDataViewItemAttr class WXDLLIMPEXP_ADV wxDataViewItemAttr
{ {
@@ -732,6 +734,10 @@ public:
// define control visual attributes // define control visual attributes
// -------------------------------- // --------------------------------
// Header attributes: only implemented in the generic version currently.
virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr))
{ return false; }
virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE virtual wxVisualAttributes GetDefaultAttributes() const wxOVERRIDE
{ {
return GetClassDefaultAttributes(GetWindowVariant()); return GetClassDefaultAttributes(GetWindowVariant());

View File

@@ -256,11 +256,18 @@ public:
virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE; virtual void EditItem(const wxDataViewItem& item, const wxDataViewColumn *column) wxOVERRIDE;
virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE;
// These methods are specific to generic wxDataViewCtrl implementation and // These methods are specific to generic wxDataViewCtrl implementation and
// should not be used in portable code. // should not be used in portable code.
wxColour GetAlternateRowColour() const { return m_alternateRowColour; } wxColour GetAlternateRowColour() const { return m_alternateRowColour; }
void SetAlternateRowColour(const wxColour& colour); void SetAlternateRowColour(const wxColour& colour);
// The returned pointer is null if the control has wxDV_NO_HEADER style.
//
// This method is only available in the generic versions.
wxHeaderCtrl* GenericGetHeader() const;
protected: protected:
void EnsureVisibleRowCol( int row, int column ); void EnsureVisibleRowCol( int row, int column );

View File

@@ -85,8 +85,8 @@ public:
void GetItem( wxListItem &info ) const; void GetItem( wxListItem &info ) const;
void SetAttr(wxListItemAttr *attr) { m_attr = attr; } void SetAttr(wxItemAttr *attr) { m_attr = attr; }
wxListItemAttr *GetAttr() const { return m_attr; } wxItemAttr *GetAttr() const { return m_attr; }
public: public:
// the item image or -1 // the item image or -1
@@ -103,7 +103,7 @@ public:
wxListMainWindow *m_owner; wxListMainWindow *m_owner;
// custom attributes or NULL // custom attributes or NULL
wxListItemAttr *m_attr; wxItemAttr *m_attr;
protected: protected:
// common part of all ctors // common part of all ctors
@@ -263,8 +263,8 @@ public:
wxString GetText(int index) const; wxString GetText(int index) const;
void SetText( int index, const wxString& s ); void SetText( int index, const wxString& s );
wxListItemAttr *GetAttr() const; wxItemAttr *GetAttr() const;
void SetAttr(wxListItemAttr *attr); void SetAttr(wxItemAttr *attr);
// return true if the highlighting really changed // return true if the highlighting really changed
bool Highlight( bool on ); bool Highlight( bool on );

79
include/wx/itemattr.h Normal file
View File

@@ -0,0 +1,79 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/itemattr.h
// Purpose: wxItemAttr class declaration
// Author: Vadim Zeitlin
// Created: 2016-04-16 (extracted from wx/listctrl.h)
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_ITEMATTR_H_
#define _WX_ITEMATTR_H_
// ----------------------------------------------------------------------------
// wxItemAttr: a structure containing the visual attributes of an item
// ----------------------------------------------------------------------------
class wxItemAttr
{
public:
// ctors
wxItemAttr() { }
wxItemAttr(const wxColour& colText,
const wxColour& colBack,
const wxFont& font)
: m_colText(colText), m_colBack(colBack), m_font(font)
{
}
// default copy ctor, assignment operator and dtor are ok
bool operator==(const wxItemAttr& other) const
{
return m_colText == other.m_colText &&
m_colBack == other.m_colBack &&
m_font == other.m_font;
}
bool operator!=(const wxItemAttr& other) const
{
return !(*this == other);
}
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
void SetFont(const wxFont& font) { m_font = font; }
// accessors
bool HasTextColour() const { return m_colText.IsOk(); }
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
bool HasColours() const { return HasTextColour() || HasBackgroundColour(); }
bool IsDefault() const { return !HasColours() && !HasFont(); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxFont& GetFont() const { return m_font; }
// this is almost like assignment operator except it doesn't overwrite the
// fields unset in the source attribute
void AssignFrom(const wxItemAttr& source)
{
if ( source.HasTextColour() )
SetTextColour(source.GetTextColour());
if ( source.HasBackgroundColour() )
SetBackgroundColour(source.GetBackgroundColour());
if ( source.HasFont() )
SetFont(source.GetFont());
}
private:
wxColour m_colText,
m_colBack;
wxFont m_font;
};
#endif // _WX_ITEMATTR_H_

View File

@@ -16,6 +16,7 @@
#include "wx/gdicmn.h" #include "wx/gdicmn.h"
#include "wx/event.h" #include "wx/event.h"
#include "wx/control.h" #include "wx/control.h"
#include "wx/itemattr.h"
#include "wx/systhemectrl.h" #include "wx/systhemectrl.h"
class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_FWD_CORE wxImageList;
@@ -158,60 +159,10 @@ enum
wxLIST_FIND_RIGHT wxLIST_FIND_RIGHT
}; };
// ---------------------------------------------------------------------------- // For compatibility, define the old name for this class. There is no need to
// wxListItemAttr: a structure containing the visual attributes of an item // deprecate it as it doesn't cost us anything to keep this typedef, but the
// ---------------------------------------------------------------------------- // new code should prefer to use the new wxItemAttr name.
typedef wxItemAttr wxListItemAttr;
// TODO: this should be renamed to wxItemAttr or something general like this
// and used as base class for wxTextAttr which duplicates this class
// entirely currently
class WXDLLIMPEXP_CORE wxListItemAttr
{
public:
// ctors
wxListItemAttr() { }
wxListItemAttr(const wxColour& colText,
const wxColour& colBack,
const wxFont& font)
: m_colText(colText), m_colBack(colBack), m_font(font)
{
}
// default copy ctor, assignment operator and dtor are ok
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
void SetFont(const wxFont& font) { m_font = font; }
// accessors
bool HasTextColour() const { return m_colText.IsOk(); }
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxFont& GetFont() const { return m_font; }
// this is almost like assignment operator except it doesn't overwrite the
// fields unset in the source attribute
void AssignFrom(const wxListItemAttr& source)
{
if ( source.HasTextColour() )
SetTextColour(source.GetTextColour());
if ( source.HasBackgroundColour() )
SetBackgroundColour(source.GetBackgroundColour());
if ( source.HasFont() )
SetFont(source.GetFont());
}
private:
wxColour m_colText,
m_colBack;
wxFont m_font;
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxListItem: the item or column info, used to exchange data with wxListCtrl // wxListItem: the item or column info, used to exchange data with wxListCtrl
@@ -237,7 +188,7 @@ public:
{ {
// copy list item attributes // copy list item attributes
if ( item.HasAttributes() ) if ( item.HasAttributes() )
m_attr = new wxListItemAttr(*item.GetAttributes()); m_attr = new wxItemAttr(*item.GetAttributes());
} }
wxListItem& operator=(const wxListItem& item) wxListItem& operator=(const wxListItem& item)
@@ -254,7 +205,7 @@ public:
m_data = item.m_data; m_data = item.m_data;
m_format = item.m_format; m_format = item.m_format;
m_width = item.m_width; m_width = item.m_width;
m_attr = item.m_attr ? new wxListItemAttr(*item.m_attr) : NULL; m_attr = item.m_attr ? new wxItemAttr(*item.m_attr) : NULL;
} }
return *this; return *this;
@@ -310,7 +261,7 @@ public:
int GetWidth() const { return m_width; } int GetWidth() const { return m_width; }
wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; } wxListColumnFormat GetAlign() const { return (wxListColumnFormat)m_format; }
wxListItemAttr *GetAttributes() const { return m_attr; } wxItemAttr *GetAttributes() const { return m_attr; }
bool HasAttributes() const { return m_attr != NULL; } bool HasAttributes() const { return m_attr != NULL; }
wxColour GetTextColour() const wxColour GetTextColour() const
@@ -342,10 +293,10 @@ public:
protected: protected:
// creates m_attr if we don't have it yet // creates m_attr if we don't have it yet
wxListItemAttr& Attributes() wxItemAttr& Attributes()
{ {
if ( !m_attr ) if ( !m_attr )
m_attr = new wxListItemAttr; m_attr = new wxItemAttr;
return *m_attr; return *m_attr;
} }
@@ -364,7 +315,7 @@ protected:
m_width = 0; m_width = 0;
} }
wxListItemAttr *m_attr; // optional pointer to the items style wxItemAttr *m_attr; // optional pointer to the items style
private: private:
wxDECLARE_DYNAMIC_CLASS(wxListItem); wxDECLARE_DYNAMIC_CLASS(wxListItem);
@@ -443,7 +394,7 @@ public:
virtual bool SetColumnWidth(int col, int width) = 0; virtual bool SetColumnWidth(int col, int width) = 0;
// return the attribute for the item (may return NULL if none) // return the attribute for the item (may return NULL if none)
virtual wxListItemAttr *OnGetItemAttr(long item) const; virtual wxItemAttr *OnGetItemAttr(long item) const;
// Other miscellaneous accessors. // Other miscellaneous accessors.
// ------------------------------ // ------------------------------
@@ -460,6 +411,9 @@ public:
void SetAlternateRowColour(const wxColour& colour); void SetAlternateRowColour(const wxColour& colour);
wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); } wxColour GetAlternateRowColour() const { return m_alternateRowColour.GetBackgroundColour(); }
// Header attributes support: only implemented in wxMSW currently.
virtual bool SetHeaderAttr(const wxItemAttr& WXUNUSED(attr)) { return false; }
// Checkboxes support: only implemented in wxMSW currently. // Checkboxes support: only implemented in wxMSW currently.
virtual bool HasCheckboxes() const { return false; } virtual bool HasCheckboxes() const { return false; }
virtual bool EnableCheckboxes(bool WXUNUSED(enable) = true) { return false; } virtual bool EnableCheckboxes(bool WXUNUSED(enable) = true) { return false; }
@@ -475,7 +429,7 @@ protected:
private: private:
// user defined color to draw row lines, may be invalid // user defined color to draw row lines, may be invalid
wxListItemAttr m_alternateRowColour; wxItemAttr m_alternateRowColour;
}; };
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------

View File

@@ -12,6 +12,8 @@
class WXDLLIMPEXP_FWD_CORE wxImageList; class WXDLLIMPEXP_FWD_CORE wxImageList;
class wxMSWHeaderCtrlCustomDraw;
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxHeaderCtrl // wxHeaderCtrl
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -45,7 +47,11 @@ public:
virtual ~wxHeaderCtrl(); virtual ~wxHeaderCtrl();
// Override to implement colours support via custom drawing.
virtual bool SetBackgroundColour(const wxColour& colour) wxOVERRIDE;
virtual bool SetForegroundColour(const wxColour& colour) wxOVERRIDE;
virtual bool SetFont(const wxFont& font) wxOVERRIDE;
protected: protected:
// override wxWindow methods which must be implemented by a new control // override wxWindow methods which must be implemented by a new control
virtual wxSize DoGetBestSize() const; virtual wxSize DoGetBestSize() const;
@@ -98,6 +104,10 @@ private:
// mouse button // mouse button
wxEventType GetClickEventType(bool dblclk, int button); wxEventType GetClickEventType(bool dblclk, int button);
// allocate m_customDraw if we need it or free it if it no longer is,
// return the pointer which can be used to update it if it's non-null
wxMSWHeaderCtrlCustomDraw* GetCustomDraw();
// the number of columns in the control, including the hidden ones (not // the number of columns in the control, including the hidden ones (not
// taken into account by the native control, see comment in DoGetCount()) // taken into account by the native control, see comment in DoGetCount())
@@ -129,6 +139,10 @@ private:
// actual column we are dragging or -1 if not dragging anything // actual column we are dragging or -1 if not dragging anything
int m_colBeingDragged; int m_colBeingDragged;
// the custom draw helper: initially NULL, created on demand, use
// GetCustomDraw() to do it
wxMSWHeaderCtrlCustomDraw *m_customDraw;
wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl); wxDECLARE_NO_COPY_CLASS(wxHeaderCtrl);
}; };

View File

@@ -16,6 +16,7 @@
#include "wx/vector.h" #include "wx/vector.h"
class wxMSWListItemData; class wxMSWListItemData;
class wxMSWListHeaderCustomDraw;
// define this symbol to indicate the availability of SetColumnsOrder() and // define this symbol to indicate the availability of SetColumnsOrder() and
// related functions // related functions
@@ -115,6 +116,9 @@ public:
bool SetForegroundColour(const wxColour& col); bool SetForegroundColour(const wxColour& col);
bool SetBackgroundColour(const wxColour& col); bool SetBackgroundColour(const wxColour& col);
// Header attributes
virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE;
// Gets information about this column // Gets information about this column
bool GetColumn(int col, wxListItem& item) const; bool GetColumn(int col, wxListItem& item) const;
@@ -402,7 +406,7 @@ protected:
// get the item attribute, either by quering it for virtual control, or by // get the item attribute, either by quering it for virtual control, or by
// returning the one previously set using setter methods for a normal one // returning the one previously set using setter methods for a normal one
wxListItemAttr *DoGetItemColumnAttr(long item, long column) const; wxItemAttr *DoGetItemColumnAttr(long item, long column) const;
wxTextCtrl* m_textCtrl; // The control used for editing a label wxTextCtrl* m_textCtrl; // The control used for editing a label
@@ -437,7 +441,7 @@ protected:
virtual int OnGetItemColumnImage(long item, long column) const; virtual int OnGetItemColumnImage(long item, long column) const;
// return the attribute for the given item and column (may return NULL if none) // return the attribute for the given item and column (may return NULL if none)
virtual wxListItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const virtual wxItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const
{ {
return OnGetItemAttr(item); return OnGetItemAttr(item);
} }
@@ -461,6 +465,10 @@ private:
void OnCharHook(wxKeyEvent& event); void OnCharHook(wxKeyEvent& event);
// Object using for header custom drawing if necessary, may be NULL.
wxMSWListHeaderCustomDraw* m_headerCustomDraw;
wxDECLARE_DYNAMIC_CLASS(wxListCtrl); wxDECLARE_DYNAMIC_CLASS(wxListCtrl);
wxDECLARE_EVENT_TABLE(); wxDECLARE_EVENT_TABLE();
wxDECLARE_NO_COPY_CLASS(wxListCtrl); wxDECLARE_NO_COPY_CLASS(wxListCtrl);

View File

@@ -0,0 +1,54 @@
///////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/private/customdraw.h
// Purpose: Helper for implementing custom drawing support in wxMSW
// Author: Vadim Zeitlin
// Created: 2016-04-16
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef _WX_MSW_CUSTOMDRAW_H_
#define _WX_MSW_CUSTOMDRAW_H_
#include "wx/itemattr.h"
#include "wx/msw/wrapcctl.h"
namespace wxMSWImpl
{
// ----------------------------------------------------------------------------
// CustomDraw: inherit from this class and forward NM_CUSTOMDRAW to it
// ----------------------------------------------------------------------------
class CustomDraw
{
public:
// Trivial default ctor needed for non-copyable class.
CustomDraw()
{
}
// Implementation of NM_CUSTOMDRAW handler, returns one of CDRF_XXX
// constants, possibly CDRF_DODEFAULT if custom drawing is not necessary.
LPARAM HandleCustomDraw(LPARAM lParam);
private:
// Return true if we need custom drawing at all.
virtual bool HasCustomDrawnItems() const = 0;
// Return the attribute to use for the given item, can return NULL if this
// item doesn't need to be custom-drawn.
virtual const wxItemAttr* GetItemAttr(DWORD_PTR dwItemSpec) const = 0;
// Set the colours and font for the specified HDC, return CDRF_NEWFONT if
// the font was changed.
LPARAM HandleItemPrepaint(const wxItemAttr& attr, HDC hdc);
wxDECLARE_NO_COPY_CLASS(CustomDraw);
};
} // namespace wxMSWImpl
#endif // _WX_MSW_CUSTOMDRAW_H_

View File

@@ -34,7 +34,8 @@ class WXDLLIMPEXP_FWD_CORE wxDragImage;
struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem;
// hash storing attributes for our items // hash storing attributes for our items
WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxTreeItemAttr *, wxMapTreeAttr); class wxItemAttr;
WX_DECLARE_EXPORTED_VOIDPTR_HASH_MAP(wxItemAttr *, wxMapTreeAttr);
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTreeCtrl // wxTreeCtrl

View File

@@ -279,7 +279,7 @@ public:
virtual int OnGetItemColumnImage(long item, long column) const; virtual int OnGetItemColumnImage(long item, long column) const;
// return the attribute for the given item and column (may return NULL if none) // return the attribute for the given item and column (may return NULL if none)
virtual wxListItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const virtual wxItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const
{ {
return OnGetItemAttr(item); return OnGetItemAttr(item);
} }

View File

@@ -180,40 +180,6 @@ static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON |
// tree ctrl default name // tree ctrl default name
extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[]; extern WXDLLIMPEXP_DATA_CORE(const char) wxTreeCtrlNameStr[];
// ----------------------------------------------------------------------------
// wxTreeItemAttr: a structure containing the visual attributes of an item
// ----------------------------------------------------------------------------
class WXDLLIMPEXP_CORE wxTreeItemAttr
{
public:
// ctors
wxTreeItemAttr() { }
wxTreeItemAttr(const wxColour& colText,
const wxColour& colBack,
const wxFont& font)
: m_colText(colText), m_colBack(colBack), m_font(font) { }
// setters
void SetTextColour(const wxColour& colText) { m_colText = colText; }
void SetBackgroundColour(const wxColour& colBack) { m_colBack = colBack; }
void SetFont(const wxFont& font) { m_font = font; }
// accessors
bool HasTextColour() const { return m_colText.IsOk(); }
bool HasBackgroundColour() const { return m_colBack.IsOk(); }
bool HasFont() const { return m_font.IsOk(); }
const wxColour& GetTextColour() const { return m_colText; }
const wxColour& GetBackgroundColour() const { return m_colBack; }
const wxFont& GetFont() const { return m_font; }
private:
wxColour m_colText,
m_colBack;
wxFont m_font;
};
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxTreeEvent is a special class for all events associated with tree controls // wxTreeEvent is a special class for all events associated with tree controls
// //

View File

@@ -1547,6 +1547,25 @@ public:
*/ */
void SetCurrentItem(const wxDataViewItem& item); void SetCurrentItem(const wxDataViewItem& item);
/**
Set custom colours and/or font to use for the header.
This method allows to customize the display of the control header (it
does nothing if @c wxDV_NO_HEADER style is used).
Currently it is only implemented in the generic version and just
returns @false without doing anything elsewhere.
@param attr The attribute defining the colour(s) and font to use. It
can be default, in which case the attributes are reset to their
default values.
@return @true if the attributes were updated, @false if the method is
not implemented or failed.
@since 3.1.1
*/
bool SetHeaderAttr(const wxItemAttr& attr);
/** /**
Sets the indentation. Sets the indentation.
*/ */

104
interface/wx/itemattr.h Normal file
View File

@@ -0,0 +1,104 @@
/////////////////////////////////////////////////////////////////////////////
// Name: wx/itemattr.h
// Purpose: wxItemAttr documentation
// Author: Vadim Zeitlin
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
/**
@class wxItemAttr
Represents the attributes (colour, font, ...) of an item of a control with
multiple items such as e.g. wxListCtrl.
@library{wxcore}
@category{data}
@see @ref overview_listctrl
@since 3.1.1 (previous versions had a similar wxListItemAttr class)
*/
class wxItemAttr
{
public:
/**
Default Constructor.
*/
wxItemAttr();
/**
Construct a wxItemAttr with the specified foreground and
background colours and font.
*/
wxItemAttr(const wxColour& colText,
const wxColour& colBack,
const wxFont& font);
/**
Compare two item attributes for equality.
*/
bool operator==(const wxItemAttr& other) const;
/**
Compare two item attributes for inequality.
*/
bool operator!=(const wxItemAttr& other) const;
/**
Returns the currently set background colour.
*/
const wxColour& GetBackgroundColour() const;
/**
Returns the currently set font.
*/
const wxFont& GetFont() const;
/**
Returns the currently set text colour.
*/
const wxColour& GetTextColour() const;
/**
Returns @true if the currently set background colour is valid.
*/
bool HasBackgroundColour() const;
/**
Returns @true if either text or background colour is set.
@see HasBackgroundColour(), HasTextColour()
*/
bool HasColours() const;
/**
Returns @true if the currently set font is valid.
*/
bool HasFont() const;
/**
Returns @true if the currently set text colour is valid.
*/
bool HasTextColour() const;
/**
Returns @true if this object has no custom attributes set.
*/
bool IsDefault() const;
/**
Sets a new background colour.
*/
void SetBackgroundColour(const wxColour& colour);
/**
Sets a new font.
*/
void SetFont(const wxFont& font);
/**
Sets a new text colour.
*/
void SetTextColour(const wxColour& colour);
};

View File

@@ -1052,6 +1052,25 @@ public:
*/ */
bool SetColumnsOrder(const wxArrayInt& orders); bool SetColumnsOrder(const wxArrayInt& orders);
/**
Change the font and the colours used for the list control header.
This method can be used to change the appearance of the header shown by
the control in report mode (unless @c wxLC_NO_HEADER style is used).
Currently it is implemented only for wxMSW and does nothing in the
other ports.
@param attr The object containing the font and text and background
colours to use. It may be default, i.e. not specify any custom font
nor colours, to reset any previously set custom attribute.
@return @true if the attributes have been updated or @false if this is
not supported by the current platform.
@since 3.1.1
*/
bool SetHeaderAttr(const wxItemAttr& attr);
/** /**
Sets the image list associated with the control. Sets the image list associated with the control.
@@ -1278,14 +1297,14 @@ protected:
@c item or @NULL to use the default appearance parameters. @c item or @NULL to use the default appearance parameters.
wxListCtrl will not delete the pointer or keep a reference of it. wxListCtrl will not delete the pointer or keep a reference of it.
You can return the same wxListItemAttr pointer for every OnGetItemAttr() call. You can return the same wxItemAttr pointer for every OnGetItemAttr() call.
The base class version always returns @NULL. The base class version always returns @NULL.
@see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(), @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(),
OnGetItemColumnAttr() OnGetItemColumnAttr()
*/ */
virtual wxListItemAttr* OnGetItemAttr(long item) const; virtual wxItemAttr* OnGetItemAttr(long item) const;
/** /**
This function may be overridden in the derived class for a control with This function may be overridden in the derived class for a control with
@@ -1302,7 +1321,7 @@ protected:
@see OnGetItemAttr(), OnGetItemText(), @see OnGetItemAttr(), OnGetItemText(),
OnGetItemImage(), OnGetItemColumnImage(), OnGetItemImage(), OnGetItemColumnImage(),
*/ */
virtual wxListItemAttr* OnGetItemColumnAttr(long item, long column) const; virtual wxItemAttr* OnGetItemColumnAttr(long item, long column) const;
/** /**
Override this function in the derived class for a control with Override this function in the derived class for a control with
@@ -1513,80 +1532,6 @@ wxEventType wxEVT_LIST_ITEM_CHECKED;
wxEventType wxEVT_LIST_ITEM_UNCHECKED; wxEventType wxEVT_LIST_ITEM_UNCHECKED;
/**
@class wxListItemAttr
Represents the attributes (color, font, ...) of a wxListCtrl's wxListItem.
@library{wxcore}
@category{data}
@see @ref overview_listctrl, wxListCtrl, wxListItem
*/
class wxListItemAttr
{
public:
/**
Default Constructor.
*/
wxListItemAttr();
/**
Construct a wxListItemAttr with the specified foreground and
background colors and font.
*/
wxListItemAttr(const wxColour& colText,
const wxColour& colBack,
const wxFont& font);
/**
Returns the currently set background color.
*/
const wxColour& GetBackgroundColour() const;
/**
Returns the currently set font.
*/
const wxFont& GetFont() const;
/**
Returns the currently set text color.
*/
const wxColour& GetTextColour() const;
/**
Returns @true if the currently set background color is valid.
*/
bool HasBackgroundColour() const;
/**
Returns @true if the currently set font is valid.
*/
bool HasFont() const;
/**
Returns @true if the currently set text color is valid.
*/
bool HasTextColour() const;
/**
Sets a new background color.
*/
void SetBackgroundColour(const wxColour& colour);
/**
Sets a new font.
*/
void SetFont(const wxFont& font);
/**
Sets a new text color.
*/
void SetTextColour(const wxColour& colour);
};
/** /**
@class wxListView @class wxListView

View File

@@ -32,8 +32,13 @@
#include "wx/numdlg.h" #include "wx/numdlg.h"
#include "wx/spinctrl.h" #include "wx/spinctrl.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/itemattr.h"
#include "wx/notebook.h" #include "wx/notebook.h"
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
#include "wx/headerctrl.h"
#endif // wxHAS_GENERIC_DATAVIEWCTRL
#include "mymodels.h" #include "mymodels.h"
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -74,6 +79,10 @@ private:
// event handlers // event handlers
void OnStyleChange(wxCommandEvent& event); void OnStyleChange(wxCommandEvent& event);
void OnSetBackgroundColour(wxCommandEvent& event); void OnSetBackgroundColour(wxCommandEvent& event);
void OnCustomHeaderAttr(wxCommandEvent& event);
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
void OnCustomHeaderHeight(wxCommandEvent& event);
#endif // wxHAS_GENERIC_DATAVIEWCTRL
void OnSetForegroundColour(wxCommandEvent& event); void OnSetForegroundColour(wxCommandEvent& event);
void OnIncIndent(wxCommandEvent& event); void OnIncIndent(wxCommandEvent& event);
void OnDecIndent(wxCommandEvent& event); void OnDecIndent(wxCommandEvent& event);
@@ -290,6 +299,10 @@ enum
ID_CLEARLOG = wxID_HIGHEST+1, ID_CLEARLOG = wxID_HIGHEST+1,
ID_BACKGROUND_COLOUR, ID_BACKGROUND_COLOUR,
ID_FOREGROUND_COLOUR, ID_FOREGROUND_COLOUR,
ID_CUSTOM_HEADER_ATTR,
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
ID_CUSTOM_HEADER_HEIGHT,
#endif // wxHAS_GENERIC_DATAVIEWCTRL
ID_STYLE_MENU, ID_STYLE_MENU,
ID_INC_INDENT, ID_INC_INDENT,
ID_DEC_INDENT, ID_DEC_INDENT,
@@ -344,6 +357,10 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU( ID_FOREGROUND_COLOUR, MyFrame::OnSetForegroundColour ) EVT_MENU( ID_FOREGROUND_COLOUR, MyFrame::OnSetForegroundColour )
EVT_MENU( ID_BACKGROUND_COLOUR, MyFrame::OnSetBackgroundColour ) EVT_MENU( ID_BACKGROUND_COLOUR, MyFrame::OnSetBackgroundColour )
EVT_MENU( ID_CUSTOM_HEADER_ATTR, MyFrame::OnCustomHeaderAttr )
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
EVT_MENU( ID_CUSTOM_HEADER_HEIGHT, MyFrame::OnCustomHeaderHeight )
#endif // wxHAS_GENERIC_DATAVIEWCTRL
EVT_MENU( ID_INC_INDENT, MyFrame::OnIncIndent ) EVT_MENU( ID_INC_INDENT, MyFrame::OnIncIndent )
EVT_MENU( ID_DEC_INDENT, MyFrame::OnDecIndent ) EVT_MENU( ID_DEC_INDENT, MyFrame::OnDecIndent )
@@ -431,6 +448,10 @@ MyFrame::MyFrame(wxFrame *frame, const wxString &title, int x, int y, int w, int
file_menu->Append(ID_CLEARLOG, "&Clear log\tCtrl-L"); file_menu->Append(ID_CLEARLOG, "&Clear log\tCtrl-L");
file_menu->Append(ID_FOREGROUND_COLOUR, "Set &foreground colour...\tCtrl-S"); file_menu->Append(ID_FOREGROUND_COLOUR, "Set &foreground colour...\tCtrl-S");
file_menu->Append(ID_BACKGROUND_COLOUR, "Set &background colour...\tCtrl-B"); file_menu->Append(ID_BACKGROUND_COLOUR, "Set &background colour...\tCtrl-B");
file_menu->AppendCheckItem(ID_CUSTOM_HEADER_ATTR, "C&ustom header attributes");
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
file_menu->AppendCheckItem(ID_CUSTOM_HEADER_HEIGHT, "Custom header &height");
#endif // wxHAS_GENERIC_DATAVIEWCTRL
file_menu->Append(ID_STYLE_MENU, "&Style", style_menu); file_menu->Append(ID_STYLE_MENU, "&Style", style_menu);
file_menu->Append(ID_INC_INDENT, "&Increase indent\tCtrl-I"); file_menu->Append(ID_INC_INDENT, "&Increase indent\tCtrl-I");
file_menu->Append(ID_DEC_INDENT, "&Decrease indent\tShift-Ctrl-I"); file_menu->Append(ID_DEC_INDENT, "&Decrease indent\tShift-Ctrl-I");
@@ -788,6 +809,41 @@ void MyFrame::OnSetBackgroundColour(wxCommandEvent& WXUNUSED(event))
} }
} }
void MyFrame::OnCustomHeaderAttr(wxCommandEvent& event)
{
wxItemAttr attr;
if ( event.IsChecked() )
{
attr.SetTextColour(*wxRED);
attr.SetFont(wxFontInfo(20).Bold());
}
//else: leave it as default to disable custom header attributes
wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()];
if ( !dvc->SetHeaderAttr(attr) )
wxLogMessage("Sorry, header attributes not supported on this platform");
}
#ifdef wxHAS_GENERIC_DATAVIEWCTRL
void MyFrame::OnCustomHeaderHeight(wxCommandEvent& event)
{
wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()];
wxHeaderCtrl* const header = dvc->GenericGetHeader();
if ( !header )
{
wxLogMessage("No header");
return;
}
// Use a big height to show that this works.
wxSize size = event.IsChecked() ? FromDIP(wxSize(0, 80)) : wxDefaultSize;
header->SetMinSize(size);
header->Refresh();
dvc->Layout();
}
#endif // wxHAS_GENERIC_DATAVIEWCTRL
void MyFrame::OnIncIndent(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnIncIndent(wxCommandEvent& WXUNUSED(event))
{ {
wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()]; wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()];

View File

@@ -137,6 +137,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour) EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour)
EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour) EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour)
EVT_MENU(LIST_ROW_LINES, MyFrame::OnSetRowLines) EVT_MENU(LIST_ROW_LINES, MyFrame::OnSetRowLines)
EVT_MENU(LIST_CUSTOM_HEADER_ATTR, MyFrame::OnCustomHeaderAttr)
EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel) EVT_MENU(LIST_TOGGLE_MULTI_SEL, MyFrame::OnToggleMultiSel)
EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo) EVT_MENU(LIST_SHOW_COL_INFO, MyFrame::OnShowColInfo)
EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo) EVT_MENU(LIST_SHOW_SEL_INFO, MyFrame::OnShowSelInfo)
@@ -160,6 +161,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame)
EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateUIEnableInReport) EVT_UPDATE_UI(LIST_SHOW_COL_INFO, MyFrame::OnUpdateUIEnableInReport)
EVT_UPDATE_UI(LIST_TOGGLE_HEADER, MyFrame::OnUpdateUIEnableInReport) EVT_UPDATE_UI(LIST_TOGGLE_HEADER, MyFrame::OnUpdateUIEnableInReport)
EVT_UPDATE_UI(LIST_CUSTOM_HEADER_ATTR, MyFrame::OnUpdateUIEnableInReport)
EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel) EVT_UPDATE_UI(LIST_TOGGLE_MULTI_SEL, MyFrame::OnUpdateToggleMultiSel)
EVT_UPDATE_UI(LIST_TOGGLE_CHECKBOXES, MyFrame::OnUpdateToggleCheckboxes) EVT_UPDATE_UI(LIST_TOGGLE_CHECKBOXES, MyFrame::OnUpdateToggleCheckboxes)
@@ -276,6 +278,7 @@ MyFrame::MyFrame(const wxChar *title)
menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour...")); menuCol->Append(LIST_SET_FG_COL, wxT("&Foreground colour..."));
menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour...")); menuCol->Append(LIST_SET_BG_COL, wxT("&Background colour..."));
menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours")); menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours"));
menuCol->AppendCheckItem(LIST_CUSTOM_HEADER_ATTR, "&Custom header attributes");
wxMenuBar *menubar = new wxMenuBar; wxMenuBar *menubar = new wxMenuBar;
menubar->Append(menuFile, wxT("&File")); menubar->Append(menuFile, wxT("&File"));
@@ -894,6 +897,20 @@ void MyFrame::OnSetRowLines(wxCommandEvent& event)
m_listCtrl->Refresh(); m_listCtrl->Refresh();
} }
void MyFrame::OnCustomHeaderAttr(wxCommandEvent& event)
{
wxItemAttr attr;
if ( event.IsChecked() )
{
attr.SetTextColour(*wxBLUE);
attr.SetFont(wxFontInfo(24).Italic());
}
//else: leave it as default to disable custom header attributes
if ( !m_listCtrl->SetHeaderAttr(attr) )
wxLogMessage("Sorry, header attributes not supported on this platform");
}
void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event)) void MyFrame::OnAdd(wxCommandEvent& WXUNUSED(event))
{ {
m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), wxT("Appended item")); m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), wxT("Appended item"));
@@ -1226,7 +1243,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event)
GetItem(info); GetItem(info);
wxListItemAttr *attr = info.GetAttributes(); wxItemAttr *attr = info.GetAttributes();
if ( !attr || !attr->HasTextColour() ) if ( !attr || !attr->HasTextColour() )
{ {
info.SetTextColour(*wxCYAN); info.SetTextColour(*wxCYAN);
@@ -1416,13 +1433,13 @@ int MyListCtrl::OnGetItemColumnImage(long item, long column) const
return -1; return -1;
} }
wxListItemAttr *MyListCtrl::OnGetItemAttr(long item) const wxItemAttr *MyListCtrl::OnGetItemAttr(long item) const
{ {
// test to check that RefreshItem() works correctly: when m_updated is // test to check that RefreshItem() works correctly: when m_updated is
// set to some item and it is refreshed, we highlight the item // set to some item and it is refreshed, we highlight the item
if ( item == m_updated ) if ( item == m_updated )
{ {
static wxListItemAttr s_attrHighlight(*wxRED, wxNullColour, wxNullFont); static wxItemAttr s_attrHighlight(*wxRED, wxNullColour, wxNullFont);
return &s_attrHighlight; return &s_attrHighlight;
} }

View File

@@ -84,7 +84,7 @@ private:
virtual wxString OnGetItemText(long item, long column) const wxOVERRIDE; virtual wxString OnGetItemText(long item, long column) const wxOVERRIDE;
virtual int OnGetItemColumnImage(long item, long column) const wxOVERRIDE; virtual int OnGetItemColumnImage(long item, long column) const wxOVERRIDE;
virtual wxListItemAttr *OnGetItemAttr(long item) const wxOVERRIDE; virtual wxItemAttr *OnGetItemAttr(long item) const wxOVERRIDE;
long m_updated; long m_updated;
@@ -132,6 +132,7 @@ protected:
void OnSetFgColour(wxCommandEvent& event); void OnSetFgColour(wxCommandEvent& event);
void OnSetBgColour(wxCommandEvent& event); void OnSetBgColour(wxCommandEvent& event);
void OnSetRowLines(wxCommandEvent& event); void OnSetRowLines(wxCommandEvent& event);
void OnCustomHeaderAttr(wxCommandEvent& event);
void OnToggleMultiSel(wxCommandEvent& event); void OnToggleMultiSel(wxCommandEvent& event);
void OnShowColInfo(wxCommandEvent& event); void OnShowColInfo(wxCommandEvent& event);
void OnShowSelInfo(wxCommandEvent& event); void OnShowSelInfo(wxCommandEvent& event);
@@ -221,6 +222,7 @@ enum
LIST_SET_FG_COL, LIST_SET_FG_COL,
LIST_SET_BG_COL, LIST_SET_BG_COL,
LIST_ROW_LINES, LIST_ROW_LINES,
LIST_CUSTOM_HEADER_ATTR,
LIST_TOGGLE_MULTI_SEL, LIST_TOGGLE_MULTI_SEL,
LIST_TOGGLE_HEADER, LIST_TOGGLE_HEADER,
LIST_TOGGLE_BELL, LIST_TOGGLE_BELL,

View File

@@ -70,6 +70,7 @@ WIDGETS_OBJECTS = \
widgets_filepicker.o \ widgets_filepicker.o \
widgets_fontpicker.o \ widgets_fontpicker.o \
widgets_gauge.o \ widgets_gauge.o \
widgets_headerctrl.o \
widgets_hyperlnk.o \ widgets_hyperlnk.o \
widgets_itemcontainer.o \ widgets_itemcontainer.o \
widgets_listbox.o \ widgets_listbox.o \
@@ -265,6 +266,9 @@ widgets_fontpicker.o: $(srcdir)/fontpicker.cpp
widgets_gauge.o: $(srcdir)/gauge.cpp widgets_gauge.o: $(srcdir)/gauge.cpp
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/gauge.cpp $(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/gauge.cpp
widgets_headerctrl.o: $(srcdir)/headerctrl.cpp
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/headerctrl.cpp
widgets_hyperlnk.o: $(srcdir)/hyperlnk.cpp widgets_hyperlnk.o: $(srcdir)/hyperlnk.cpp
$(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/hyperlnk.cpp $(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/hyperlnk.cpp

View File

@@ -0,0 +1,114 @@
/////////////////////////////////////////////////////////////////////////////
// Program: wxWidgets Widgets Sample
// Name: headerctrl.cpp
// Purpose: Part of the widgets sample showing wxHeaderCtrl
// Author: Vadim Zeitlin
// Created: 2016-04-17
// Copyright: (c) 2016 wxWindows team
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#if wxUSE_HEADERCTRL
// for all others, include the necessary headers
#ifndef WX_PRECOMP
#include "wx/button.h"
#include "wx/sizer.h"
#include "wx/stattext.h"
#endif
#include "wx/headerctrl.h"
#include "widgets.h"
#include "icons/header.xpm"
// ----------------------------------------------------------------------------
// HeaderCtrlWidgetsPage
// ----------------------------------------------------------------------------
class HeaderCtrlWidgetsPage : public WidgetsPage
{
public:
HeaderCtrlWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist)
: WidgetsPage(book, imaglist, header_xpm)
{
m_header = NULL;
m_sizerHeader = NULL;
}
virtual wxWindow *GetWidget() const wxOVERRIDE { return m_header; }
virtual void RecreateWidget() wxOVERRIDE;
// lazy creation of the content
virtual void CreateContent() wxOVERRIDE;
protected:
// the control itself and the sizer it is in
wxHeaderCtrlSimple *m_header;
wxSizer *m_sizerHeader;
private:
DECLARE_WIDGETS_PAGE(HeaderCtrlWidgetsPage)
};
// ============================================================================
// implementation
// ============================================================================
#if defined(__WXMSW__) && !defined(__WXUNIVERSAL__)
#define HEADER_CTRL_FAMILY NATIVE_CTRLS
#else
#define HEADER_CTRL_FAMILY GENERIC_CTRLS
#endif
IMPLEMENT_WIDGETS_PAGE(HeaderCtrlWidgetsPage,
wxT("Header"), HEADER_CTRL_FAMILY);
void HeaderCtrlWidgetsPage::CreateContent()
{
m_sizerHeader = new wxStaticBoxSizer(wxVERTICAL, this, "Header");
RecreateWidget();
wxSizer* const sizerTop = new wxBoxSizer(wxHORIZONTAL);
sizerTop->Add(m_sizerHeader, wxSizerFlags(1).Expand().DoubleBorder());
SetSizer(sizerTop);
}
void HeaderCtrlWidgetsPage::RecreateWidget()
{
m_sizerHeader->Clear(true /* delete windows */);
int flags = GetAttrs().m_defaultFlags;
flags |= wxHD_DEFAULT_STYLE;
m_header = new wxHeaderCtrlSimple(this, wxID_ANY,
wxDefaultPosition, wxDefaultSize,
flags);
m_header->AppendColumn(wxHeaderColumnSimple("First", 100));
m_header->AppendColumn(wxHeaderColumnSimple("Second", 200));
m_sizerHeader->AddStretchSpacer();
m_sizerHeader->Add(m_header, wxSizerFlags().Expand());
m_sizerHeader->AddStretchSpacer();
m_sizerHeader->Layout();
}
#endif // wxUSE_HEADERCTRL

View File

@@ -0,0 +1,54 @@
/* XPM */
static const char *const header_xpm[] = {
/* columns rows colors chars-per-pixel */
"32 32 16 1",
" c Gray0",
". c #808000",
"X c #000080",
"o c #808080",
"O c #000000",
"+ c #808000",
"@ c #000080",
"# c none",
"$ c #808080",
"% c Red",
"& c Green",
"* c Yellow",
"= c Blue",
"- c Magenta",
"; c Cyan",
": c Gray100",
/* pixels */
" ",
" ############################## ",
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ",
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ",
" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" ############################## ",
" "
};

View File

@@ -51,6 +51,7 @@ WIDGETS_OBJECTS = \
$(OBJS)\widgets_filepicker.obj \ $(OBJS)\widgets_filepicker.obj \
$(OBJS)\widgets_fontpicker.obj \ $(OBJS)\widgets_fontpicker.obj \
$(OBJS)\widgets_gauge.obj \ $(OBJS)\widgets_gauge.obj \
$(OBJS)\widgets_headerctrl.obj \
$(OBJS)\widgets_hyperlnk.obj \ $(OBJS)\widgets_hyperlnk.obj \
$(OBJS)\widgets_itemcontainer.obj \ $(OBJS)\widgets_itemcontainer.obj \
$(OBJS)\widgets_listbox.obj \ $(OBJS)\widgets_listbox.obj \
@@ -310,6 +311,9 @@ $(OBJS)\widgets_fontpicker.obj: .\fontpicker.cpp
$(OBJS)\widgets_gauge.obj: .\gauge.cpp $(OBJS)\widgets_gauge.obj: .\gauge.cpp
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\gauge.cpp $(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\gauge.cpp
$(OBJS)\widgets_headerctrl.obj: .\headerctrl.cpp
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\headerctrl.cpp
$(OBJS)\widgets_hyperlnk.obj: .\hyperlnk.cpp $(OBJS)\widgets_hyperlnk.obj: .\hyperlnk.cpp
$(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp $(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp

View File

@@ -44,6 +44,7 @@ WIDGETS_OBJECTS = \
$(OBJS)\widgets_filepicker.o \ $(OBJS)\widgets_filepicker.o \
$(OBJS)\widgets_fontpicker.o \ $(OBJS)\widgets_fontpicker.o \
$(OBJS)\widgets_gauge.o \ $(OBJS)\widgets_gauge.o \
$(OBJS)\widgets_headerctrl.o \
$(OBJS)\widgets_hyperlnk.o \ $(OBJS)\widgets_hyperlnk.o \
$(OBJS)\widgets_itemcontainer.o \ $(OBJS)\widgets_itemcontainer.o \
$(OBJS)\widgets_listbox.o \ $(OBJS)\widgets_listbox.o \
@@ -299,6 +300,9 @@ $(OBJS)\widgets_fontpicker.o: ./fontpicker.cpp
$(OBJS)\widgets_gauge.o: ./gauge.cpp $(OBJS)\widgets_gauge.o: ./gauge.cpp
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\widgets_headerctrl.o: ./headerctrl.cpp
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\widgets_hyperlnk.o: ./hyperlnk.cpp $(OBJS)\widgets_hyperlnk.o: ./hyperlnk.cpp
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -68,6 +68,7 @@ WIDGETS_OBJECTS = \
widgets_filepicker.o \ widgets_filepicker.o \
widgets_fontpicker.o \ widgets_fontpicker.o \
widgets_gauge.o \ widgets_gauge.o \
widgets_headerctrl.o \
widgets_hyperlnk.o \ widgets_hyperlnk.o \
widgets_itemcontainer.o \ widgets_itemcontainer.o \
widgets_listbox.o \ widgets_listbox.o \
@@ -165,6 +166,9 @@ widgets_fontpicker.o: ./fontpicker.cpp
widgets_gauge.o: ./gauge.cpp widgets_gauge.o: ./gauge.cpp
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
widgets_headerctrl.o: ./headerctrl.cpp
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<
widgets_hyperlnk.o: ./hyperlnk.cpp widgets_hyperlnk.o: ./hyperlnk.cpp
$(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -46,6 +46,7 @@ WIDGETS_OBJECTS = \
$(OBJS)\widgets_filepicker.obj \ $(OBJS)\widgets_filepicker.obj \
$(OBJS)\widgets_fontpicker.obj \ $(OBJS)\widgets_fontpicker.obj \
$(OBJS)\widgets_gauge.obj \ $(OBJS)\widgets_gauge.obj \
$(OBJS)\widgets_headerctrl.obj \
$(OBJS)\widgets_hyperlnk.obj \ $(OBJS)\widgets_hyperlnk.obj \
$(OBJS)\widgets_itemcontainer.obj \ $(OBJS)\widgets_itemcontainer.obj \
$(OBJS)\widgets_listbox.obj \ $(OBJS)\widgets_listbox.obj \
@@ -433,6 +434,9 @@ $(OBJS)\widgets_fontpicker.obj: .\fontpicker.cpp
$(OBJS)\widgets_gauge.obj: .\gauge.cpp $(OBJS)\widgets_gauge.obj: .\gauge.cpp
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\gauge.cpp $(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\gauge.cpp
$(OBJS)\widgets_headerctrl.obj: .\headerctrl.cpp
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\headerctrl.cpp
$(OBJS)\widgets_hyperlnk.obj: .\hyperlnk.cpp $(OBJS)\widgets_hyperlnk.obj: .\hyperlnk.cpp
$(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp $(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp

View File

@@ -37,6 +37,7 @@
filepicker.cpp filepicker.cpp
fontpicker.cpp fontpicker.cpp
gauge.cpp gauge.cpp
headerctrl.cpp
hyperlnk.cpp hyperlnk.cpp
itemcontainer.cpp itemcontainer.cpp
listbox.cpp listbox.cpp

View File

@@ -328,6 +328,9 @@
<File <File
RelativePath=".\gauge.cpp"> RelativePath=".\gauge.cpp">
</File> </File>
<File
RelativePath=".\headerctrl.cpp">
</File>
<File <File
RelativePath=".\hyperlnk.cpp"> RelativePath=".\hyperlnk.cpp">
</File> </File>

View File

@@ -866,6 +866,10 @@
RelativePath=".\gauge.cpp" RelativePath=".\gauge.cpp"
> >
</File> </File>
<File
RelativePath=".\headerctrl.cpp"
>
</File>
<File <File
RelativePath=".\hyperlnk.cpp" RelativePath=".\hyperlnk.cpp"
> >

View File

@@ -838,6 +838,10 @@
RelativePath=".\gauge.cpp" RelativePath=".\gauge.cpp"
> >
</File> </File>
<File
RelativePath=".\headerctrl.cpp"
>
</File>
<File <File
RelativePath=".\hyperlnk.cpp" RelativePath=".\hyperlnk.cpp"
> >

View File

@@ -244,10 +244,10 @@ void wxListCtrlBase::EnableAlternateRowColours(bool enable)
} }
} }
wxListItemAttr *wxListCtrlBase::OnGetItemAttr(long item) const wxItemAttr *wxListCtrlBase::OnGetItemAttr(long item) const
{ {
return (m_alternateRowColour.GetBackgroundColour().IsOk() && (item % 2)) return (m_alternateRowColour.GetBackgroundColour().IsOk() && (item % 2))
? wxConstCast(&m_alternateRowColour, wxListItemAttr) ? wxConstCast(&m_alternateRowColour, wxItemAttr)
: NULL; // no attributes by default : NULL; // no attributes by default
} }

View File

@@ -41,6 +41,7 @@
#include "wx/renderer.h" #include "wx/renderer.h"
#include "wx/dcbuffer.h" #include "wx/dcbuffer.h"
#include "wx/icon.h" #include "wx/icon.h"
#include "wx/itemattr.h"
#include "wx/list.h" #include "wx/list.h"
#include "wx/listimpl.cpp" #include "wx/listimpl.cpp"
#include "wx/imaglist.h" #include "wx/imaglist.h"
@@ -4624,6 +4625,11 @@ wxBorder wxDataViewCtrl::GetDefaultBorder() const
return wxBORDER_THEME; return wxBORDER_THEME;
} }
wxHeaderCtrl* wxDataViewCtrl::GenericGetHeader() const
{
return m_headerArea;
}
#ifdef __WXMSW__ #ifdef __WXMSW__
WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg, WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg,
WXWPARAM wParam, WXWPARAM wParam,
@@ -5202,6 +5208,24 @@ bool wxDataViewCtrl::IsSelected( const wxDataViewItem & item ) const
return false; return false;
} }
bool wxDataViewCtrl::SetHeaderAttr(const wxItemAttr& attr)
{
if ( !m_headerArea )
return false;
// Call all functions unconditionally to reset the previously set
// attributes, if any.
m_headerArea->SetForegroundColour(attr.GetTextColour());
m_headerArea->SetBackgroundColour(attr.GetBackgroundColour());
m_headerArea->SetFont(attr.GetFont());
// If the font has changed, the size of the header might need to be
// updated.
Layout();
return true;
}
void wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour) void wxDataViewCtrl::SetAlternateRowColour(const wxColour& colour)
{ {
m_alternateRowColour = colour; m_alternateRowColour = colour;

View File

@@ -168,7 +168,7 @@ void wxListItemData::SetItem( const wxListItem &info )
if ( m_attr ) if ( m_attr )
m_attr->AssignFrom(*info.GetAttributes()); m_attr->AssignFrom(*info.GetAttributes());
else else
m_attr = new wxListItemAttr(*info.GetAttributes()); m_attr = new wxItemAttr(*info.GetAttributes());
} }
if ( m_rect ) if ( m_rect )
@@ -654,7 +654,7 @@ int wxListLineData::GetImage( int index ) const
return item->GetImage(); return item->GetImage();
} }
wxListItemAttr *wxListLineData::GetAttr() const wxItemAttr *wxListLineData::GetAttr() const
{ {
wxListItemDataList::compatibility_iterator node = m_items.GetFirst(); wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_MSG( node, NULL, wxT("invalid column index in GetAttr()") ); wxCHECK_MSG( node, NULL, wxT("invalid column index in GetAttr()") );
@@ -663,7 +663,7 @@ wxListItemAttr *wxListLineData::GetAttr() const
return item->GetAttr(); return item->GetAttr();
} }
void wxListLineData::SetAttr(wxListItemAttr *attr) void wxListLineData::SetAttr(wxItemAttr *attr)
{ {
wxListItemDataList::compatibility_iterator node = m_items.GetFirst(); wxListItemDataList::compatibility_iterator node = m_items.GetFirst();
wxCHECK_RET( node, wxT("invalid column index in SetAttr()") ); wxCHECK_RET( node, wxT("invalid column index in SetAttr()") );
@@ -677,7 +677,7 @@ void wxListLineData::ApplyAttributes(wxDC *dc,
bool highlighted, bool highlighted,
bool current) bool current)
{ {
const wxListItemAttr * const attr = GetAttr(); const wxItemAttr * const attr = GetAttr();
wxWindow * const listctrl = m_owner->GetParent(); wxWindow * const listctrl = m_owner->GetParent();

View File

@@ -37,6 +37,7 @@
#include "wx/generic/treectlg.h" #include "wx/generic/treectlg.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/itemattr.h"
#include "wx/renderer.h" #include "wx/renderer.h"
@@ -223,7 +224,7 @@ public:
{ {
wxFont font; wxFont font;
wxTreeItemAttr * const attr = GetAttributes(); wxItemAttr * const attr = GetAttributes();
if ( attr && attr->HasFont() ) if ( attr && attr->HasFont() )
font = attr->GetFont(); font = attr->GetFont();
else if ( IsBold() ) else if ( IsBold() )
@@ -282,19 +283,19 @@ public:
// attributes // attributes
// get them - may be NULL // get them - may be NULL
wxTreeItemAttr *GetAttributes() const { return m_attr; } wxItemAttr *GetAttributes() const { return m_attr; }
// get them ensuring that the pointer is not NULL // get them ensuring that the pointer is not NULL
wxTreeItemAttr& Attr() wxItemAttr& Attr()
{ {
if ( !m_attr ) if ( !m_attr )
{ {
m_attr = new wxTreeItemAttr; m_attr = new wxItemAttr;
m_ownsAttr = true; m_ownsAttr = true;
} }
return *m_attr; return *m_attr;
} }
// set them // set them
void SetAttributes(wxTreeItemAttr *attr) void SetAttributes(wxItemAttr *attr)
{ {
if ( m_ownsAttr ) delete m_attr; if ( m_ownsAttr ) delete m_attr;
m_attr = attr; m_attr = attr;
@@ -303,7 +304,7 @@ public:
m_widthText = -1; m_widthText = -1;
} }
// set them and delete when done // set them and delete when done
void AssignAttributes(wxTreeItemAttr *attr) void AssignAttributes(wxItemAttr *attr)
{ {
SetAttributes(attr); SetAttributes(attr);
m_ownsAttr = true; m_ownsAttr = true;
@@ -335,7 +336,7 @@ private:
wxArrayGenericTreeItems m_children; // list of children wxArrayGenericTreeItems m_children; // list of children
wxGenericTreeItem *m_parent; // parent of this item wxGenericTreeItem *m_parent; // parent of this item
wxTreeItemAttr *m_attr; // attributes??? wxItemAttr *m_attr; // attributes???
// tree ctrl images for the normal, selected, expanded and // tree ctrl images for the normal, selected, expanded and
// expanded+selected states // expanded+selected states
@@ -2554,7 +2555,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc)
else else
{ {
wxColour colBg; wxColour colBg;
wxTreeItemAttr * const attr = item->GetAttributes(); wxItemAttr * const attr = item->GetAttributes();
if ( attr && attr->HasBackgroundColour() ) if ( attr && attr->HasBackgroundColour() )
{ {
drawItemBackground = drawItemBackground =
@@ -2789,7 +2790,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item,
} }
else else
{ {
wxTreeItemAttr *attr = item->GetAttributes(); wxItemAttr *attr = item->GetAttributes();
if (attr && attr->HasTextColour()) if (attr && attr->HasTextColour())
colText = attr->GetTextColour(); colText = attr->GetTextColour();
else else

66
src/msw/customdraw.cpp Normal file
View File

@@ -0,0 +1,66 @@
///////////////////////////////////////////////////////////////////////////////
// Name: src/msw/customdraw.cpp
// Purpose: wxMSWCustomDraw implementation
// Author: Vadim Zeitlin
// Created: 2016-04-16
// Copyright: (c) 2016 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// ============================================================================
// declarations
// ============================================================================
// ----------------------------------------------------------------------------
// headers
// ----------------------------------------------------------------------------
// for compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/msw/private/customdraw.h"
// ============================================================================
// implementation
// ============================================================================
LPARAM wxMSWImpl::CustomDraw::HandleItemPrepaint(const wxItemAttr& attr, HDC hdc)
{
if ( attr.HasTextColour() )
::SetTextColor(hdc, wxColourToRGB(attr.GetTextColour()));
if ( attr.HasBackgroundColour() )
::SetBkColor(hdc, wxColourToRGB(attr.GetBackgroundColour()));
if ( attr.HasFont() )
{
::SelectObject(hdc, GetHfontOf(attr.GetFont()));
return CDRF_NEWFONT;
}
return CDRF_DODEFAULT;
}
LPARAM wxMSWImpl::CustomDraw::HandleCustomDraw(LPARAM lParam)
{
NMCUSTOMDRAW* nmcd = reinterpret_cast<NMCUSTOMDRAW*>(lParam);
switch ( nmcd->dwDrawStage )
{
case CDDS_PREPAINT:
if ( HasCustomDrawnItems() )
return CDRF_NOTIFYITEMDRAW;
break;
case CDDS_ITEMPREPAINT:
const wxItemAttr* const attr = GetItemAttr(nmcd->dwItemSpec);
if ( attr )
return HandleItemPrepaint(*attr, nmcd->hdc);
}
return CDRF_DODEFAULT;
}

View File

@@ -37,6 +37,7 @@
#include "wx/msw/wrapcctl.h" #include "wx/msw/wrapcctl.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/msw/private/customdraw.h"
#ifndef HDM_SETBITMAPMARGIN #ifndef HDM_SETBITMAPMARGIN
#define HDM_SETBITMAPMARGIN 0x1234 #define HDM_SETBITMAPMARGIN 0x1234
@@ -50,6 +51,36 @@
// from src/msw/listctrl.cpp // from src/msw/listctrl.cpp
extern int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick); extern int WXDLLIMPEXP_CORE wxMSWGetColumnClicked(NMHDR *nmhdr, POINT *ptClick);
// ----------------------------------------------------------------------------
// wxMSWHeaderCtrlCustomDraw: our custom draw helper
// ----------------------------------------------------------------------------
class wxMSWHeaderCtrlCustomDraw : public wxMSWImpl::CustomDraw
{
public:
wxMSWHeaderCtrlCustomDraw()
{
}
// Make this field public to let wxHeaderCtrl update it directly when its
// attributes change.
wxItemAttr m_attr;
private:
virtual bool HasCustomDrawnItems() const wxOVERRIDE
{
// We only exist if the header does need to be custom drawn.
return true;
}
virtual const wxItemAttr*
GetItemAttr(DWORD_PTR WXUNUSED(dwItemSpec)) const wxOVERRIDE
{
// We use the same attribute for all items for now.
return &m_attr;
}
};
// ============================================================================ // ============================================================================
// wxHeaderCtrl implementation // wxHeaderCtrl implementation
// ============================================================================ // ============================================================================
@@ -64,6 +95,7 @@ void wxHeaderCtrl::Init()
m_imageList = NULL; m_imageList = NULL;
m_scrollOffset = 0; m_scrollOffset = 0;
m_colBeingDragged = -1; m_colBeingDragged = -1;
m_customDraw = NULL;
} }
bool wxHeaderCtrl::Create(wxWindow *parent, bool wxHeaderCtrl::Create(wxWindow *parent,
@@ -116,6 +148,7 @@ WXDWORD wxHeaderCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const
wxHeaderCtrl::~wxHeaderCtrl() wxHeaderCtrl::~wxHeaderCtrl()
{ {
delete m_imageList; delete m_imageList;
delete m_customDraw;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -466,6 +499,73 @@ int wxHeaderCtrl::MSWFromNativeOrder(int order)
return pos; return pos;
} }
// ----------------------------------------------------------------------------
// wxHeaderCtrl appearance
// ----------------------------------------------------------------------------
wxMSWHeaderCtrlCustomDraw* wxHeaderCtrl::GetCustomDraw()
{
// There is no need to make the control custom drawn just because it has a
// custom font, the native control handles the font just fine on its own,
// so if our custom colours were reset, don't bother with custom drawing
// any longer.
if ( !m_hasBgCol && !m_hasFgCol )
{
if ( m_customDraw )
{
delete m_customDraw;
m_customDraw = NULL;
}
return NULL;
}
// We do have at least one custom colour, so enable custom drawing.
if ( !m_customDraw )
m_customDraw = new wxMSWHeaderCtrlCustomDraw();
return m_customDraw;
}
bool wxHeaderCtrl::SetBackgroundColour(const wxColour& colour)
{
if ( !wxHeaderCtrlBase::SetBackgroundColour(colour) )
return false;
if ( wxMSWHeaderCtrlCustomDraw* customDraw = GetCustomDraw() )
{
customDraw->m_attr.SetBackgroundColour(colour);
}
return true;
}
bool wxHeaderCtrl::SetForegroundColour(const wxColour& colour)
{
if ( !wxHeaderCtrlBase::SetForegroundColour(colour) )
return false;
if ( wxMSWHeaderCtrlCustomDraw* customDraw = GetCustomDraw() )
{
customDraw->m_attr.SetTextColour(colour);
}
return true;
}
bool wxHeaderCtrl::SetFont(const wxFont& font)
{
if ( !wxHeaderCtrlBase::SetFont(font) )
return false;
if ( wxMSWHeaderCtrlCustomDraw* customDraw = GetCustomDraw() )
{
customDraw->m_attr.SetFont(font);
}
return true;
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// wxHeaderCtrl events // wxHeaderCtrl events
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -670,6 +770,18 @@ bool wxHeaderCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// Dragging the column was cancelled. // Dragging the column was cancelled.
m_colBeingDragged = -1; m_colBeingDragged = -1;
break; break;
// other events
// ------------
case NM_CUSTOMDRAW:
if ( m_customDraw )
{
*result = m_customDraw->HandleCustomDraw(lParam);
if ( *result != CDRF_DODEFAULT )
return true;
}
break;
} }

View File

@@ -42,6 +42,7 @@
#include "wx/vector.h" #include "wx/vector.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/msw/private/customdraw.h"
#include "wx/msw/private/keyboard.h" #include "wx/msw/private/keyboard.h"
// Currently gcc doesn't define NMLVFINDITEM, and DMC only defines // Currently gcc doesn't define NMLVFINDITEM, and DMC only defines
@@ -198,7 +199,7 @@ private:
/////////////////////////////////////////////////////// ///////////////////////////////////////////////////////
// Problem: // Problem:
// The MSW version had problems with SetTextColour() et // The MSW version had problems with SetTextColour() et
// al as the wxListItemAttr's were stored keyed on the // al as the wxItemAttr's were stored keyed on the
// item index. If a item was inserted anywhere but the end // item index. If a item was inserted anywhere but the end
// of the list the text attributes (colour etc) for // of the list the text attributes (colour etc) for
// the following items were out of sync. // the following items were out of sync.
@@ -223,12 +224,40 @@ public:
wxMSWListItemData() : attr(NULL), lParam(0) {} wxMSWListItemData() : attr(NULL), lParam(0) {}
~wxMSWListItemData() { delete attr; } ~wxMSWListItemData() { delete attr; }
wxListItemAttr *attr; wxItemAttr *attr;
LPARAM lParam; // real user data LPARAM lParam; // real user data
wxDECLARE_NO_COPY_CLASS(wxMSWListItemData); wxDECLARE_NO_COPY_CLASS(wxMSWListItemData);
}; };
// wxMSWListHeaderCustomDraw: custom draw helper for the header
class wxMSWListHeaderCustomDraw : public wxMSWImpl::CustomDraw
{
public:
wxMSWListHeaderCustomDraw()
{
}
// Make this field public to let wxListCtrl update it directly when its
// header attributes change.
wxItemAttr m_attr;
private:
virtual bool HasCustomDrawnItems() const wxOVERRIDE
{
// We only exist if the header does need to be custom drawn.
return true;
}
virtual const wxItemAttr*
GetItemAttr(DWORD_PTR WXUNUSED(dwItemSpec)) const wxOVERRIDE
{
// We use the same attribute for all items for now.
return &m_attr;
}
};
wxBEGIN_EVENT_TABLE(wxListCtrl, wxListCtrlBase) wxBEGIN_EVENT_TABLE(wxListCtrl, wxListCtrlBase)
EVT_PAINT(wxListCtrl::OnPaint) EVT_PAINT(wxListCtrl::OnPaint)
EVT_CHAR_HOOK(wxListCtrl::OnCharHook) EVT_CHAR_HOOK(wxListCtrl::OnCharHook)
@@ -255,6 +284,8 @@ void wxListCtrl::Init()
m_textCtrl = NULL; m_textCtrl = NULL;
m_hasAnyAttr = false; m_hasAnyAttr = false;
m_headerCustomDraw = NULL;
} }
bool wxListCtrl::Create(wxWindow *parent, bool wxListCtrl::Create(wxWindow *parent,
@@ -434,6 +465,8 @@ wxListCtrl::~wxListCtrl()
delete m_imageListSmall; delete m_imageListSmall;
if (m_ownsImageListState) if (m_ownsImageListState)
delete m_imageListState; delete m_imageListState;
delete m_headerCustomDraw;
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -520,6 +553,68 @@ bool wxListCtrl::SetBackgroundColour(const wxColour& col)
return true; return true;
} }
bool wxListCtrl::SetHeaderAttr(const wxItemAttr& attr)
{
// We need to propagate the change of the font to the native header window
// as it also affects its layout.
bool fontChanged;
// Start or stop custom drawing the header.
if ( attr.IsDefault() )
{
if ( !m_headerCustomDraw )
{
// Nothing changed, skip refreshing the control below.
return true;
}
fontChanged = m_headerCustomDraw->m_attr.HasFont();
delete m_headerCustomDraw;
m_headerCustomDraw = NULL;
}
else // We do have custom attributes.
{
if ( !m_headerCustomDraw )
m_headerCustomDraw = new wxMSWListHeaderCustomDraw();
if ( m_headerCustomDraw->m_attr == attr )
{
// As above, skip refresh.
return true;
}
fontChanged = attr.GetFont() != m_headerCustomDraw->m_attr.GetFont();
m_headerCustomDraw->m_attr = attr;
}
if ( HWND hwndHdr = ListView_GetHeader(GetHwnd()) )
{
if ( fontChanged )
{
// Don't just reset the font if no font is specified, as the header
// uses the same font as the listview control and not the ugly
// default GUI font by default.
const wxFont& font = attr.HasFont() ? attr.GetFont() : GetFont();
// We need to tell the header about its new font to let it compute
// its new height.
::SendMessage(hwndHdr, WM_SETFONT,
(WPARAM)GetHfontOf(font), MAKELPARAM(TRUE, 0));
}
// Refreshing the listview makes it notice the change in height of its
// header and redraws it too. We probably could do something less than
// a full refresh, but it doesn't seem to be worth it, the header
// attributes won't be changed that often, so keep it simple for now.
Refresh();
}
//else: header not shown or not in report view?
return true;
}
// Gets information about this column // Gets information about this column
bool wxListCtrl::GetColumn(int col, wxListItem& item) const bool wxListCtrl::GetColumn(int col, wxListItem& item) const
{ {
@@ -811,13 +906,13 @@ bool wxListCtrl::SetItem(wxListItem& info)
// attributes // attributes
if ( info.HasAttributes() ) if ( info.HasAttributes() )
{ {
const wxListItemAttr& attrNew = *info.GetAttributes(); const wxItemAttr& attrNew = *info.GetAttributes();
// don't overwrite the already set attributes if we have them // don't overwrite the already set attributes if we have them
if ( data->attr ) if ( data->attr )
data->attr->AssignFrom(attrNew); data->attr->AssignFrom(attrNew);
else else
data->attr = new wxListItemAttr(attrNew); data->attr = new wxItemAttr(attrNew);
} }
} }
@@ -1754,7 +1849,7 @@ long wxListCtrl::InsertItem(const wxListItem& info)
if ( info.HasAttributes() ) if ( info.HasAttributes() )
{ {
// take copy of attributes // take copy of attributes
data->attr = new wxListItemAttr(*info.GetAttributes()); data->attr = new wxItemAttr(*info.GetAttributes());
// and remember that we have some now... // and remember that we have some now...
m_hasAnyAttr = true; m_hasAnyAttr = true;
@@ -1998,11 +2093,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
NMHDR *nmhdr = (NMHDR *)lParam; NMHDR *nmhdr = (NMHDR *)lParam;
// if your compiler is as broken as this, you should really change it: this
// code is needed for normal operation! #ifdef below is only useful for
// automatic rebuilds which are done with a very old compiler version
#ifdef HDN_BEGINTRACKA
// check for messages from the header (in report view) // check for messages from the header (in report view)
HWND hwndHdr = ListView_GetHeader(GetHwnd()); HWND hwndHdr = ListView_GetHeader(GetHwnd());
@@ -2090,6 +2180,15 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
// doesn't seem to have any negative consequences // doesn't seem to have any negative consequences
return true; return true;
case NM_CUSTOMDRAW:
if ( m_headerCustomDraw )
{
*result = m_headerCustomDraw->HandleCustomDraw(lParam);
if ( *result != CDRF_DODEFAULT )
return true;
}
wxFALLTHROUGH;
default: default:
ignore = true; ignore = true;
} }
@@ -2097,9 +2196,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
if ( ignore ) if ( ignore )
return wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result); return wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result);
} }
else else if ( nmhdr->hwndFrom == GetHwnd() )
#endif // defined(HDN_BEGINTRACKA)
if ( nmhdr->hwndFrom == GetHwnd() )
{ {
// almost all messages use NM_LISTVIEW // almost all messages use NM_LISTVIEW
NM_LISTVIEW *nmLV = (NM_LISTVIEW *)nmhdr; NM_LISTVIEW *nmLV = (NM_LISTVIEW *)nmhdr;
@@ -2865,7 +2962,7 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont)
static WXLPARAM HandleItemPrepaint(wxListCtrl *listctrl, static WXLPARAM HandleItemPrepaint(wxListCtrl *listctrl,
LPNMLVCUSTOMDRAW pLVCD, LPNMLVCUSTOMDRAW pLVCD,
wxListItemAttr *attr) wxItemAttr *attr)
{ {
if ( !attr ) if ( !attr )
{ {
@@ -3110,7 +3207,7 @@ int wxListCtrl::OnGetItemColumnImage(long item, long column) const
return -1; return -1;
} }
wxListItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const wxItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const
{ {
if ( IsVirtual() ) if ( IsVirtual() )
return OnGetItemColumnAttr(item, column); return OnGetItemColumnAttr(item, column);

View File

@@ -39,6 +39,7 @@
#include "wx/msw/private.h" #include "wx/msw/private.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/itemattr.h"
#include "wx/msw/dragimag.h" #include "wx/msw/dragimag.h"
#include "wx/msw/uxtheme.h" #include "wx/msw/uxtheme.h"
@@ -1146,14 +1147,14 @@ void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item,
{ {
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxTreeItemAttr *attr; wxItemAttr *attr;
wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem); wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem);
if ( it == m_attrs.end() ) if ( it == m_attrs.end() )
{ {
m_hasAnyAttr = true; m_hasAnyAttr = true;
m_attrs[item.m_pItem] = m_attrs[item.m_pItem] =
attr = new wxTreeItemAttr; attr = new wxItemAttr;
} }
else else
{ {
@@ -1170,14 +1171,14 @@ void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item,
{ {
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxTreeItemAttr *attr; wxItemAttr *attr;
wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem); wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem);
if ( it == m_attrs.end() ) if ( it == m_attrs.end() )
{ {
m_hasAnyAttr = true; m_hasAnyAttr = true;
m_attrs[item.m_pItem] = m_attrs[item.m_pItem] =
attr = new wxTreeItemAttr; attr = new wxItemAttr;
} }
else // already in the hash else // already in the hash
{ {
@@ -1193,14 +1194,14 @@ void wxTreeCtrl::SetItemFont(const wxTreeItemId& item, const wxFont& font)
{ {
wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); wxCHECK_RET( item.IsOk(), wxT("invalid tree item") );
wxTreeItemAttr *attr; wxItemAttr *attr;
wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem); wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem);
if ( it == m_attrs.end() ) if ( it == m_attrs.end() )
{ {
m_hasAnyAttr = true; m_hasAnyAttr = true;
m_attrs[item.m_pItem] = m_attrs[item.m_pItem] =
attr = new wxTreeItemAttr; attr = new wxItemAttr;
} }
else // already in the hash else // already in the hash
{ {
@@ -3550,7 +3551,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result)
break; break;
} }
wxTreeItemAttr * const attr = it->second; wxItemAttr * const attr = it->second;
wxTreeViewItem tvItem((void *)nmcd.dwItemSpec, wxTreeViewItem tvItem((void *)nmcd.dwItemSpec,
TVIF_STATE, TVIS_DROPHILITED); TVIF_STATE, TVIS_DROPHILITED);