diff --git a/Makefile.in b/Makefile.in index 782aa59413..94aa146edb 100644 --- a/Makefile.in +++ b/Makefile.in @@ -3872,6 +3872,7 @@ COND_USE_GUI_1_ALL_GUI_HEADERS = \ wx/systhemectrl.h \ wx/collheaderctrl.h \ wx/generic/collheaderctrl.h \ + wx/itemattr.h \ $(LOWLEVEL_HDR) \ $(GUI_CORE_HEADERS) \ $(ADVANCED_HDR) \ @@ -5351,6 +5352,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS = \ monodll_msw_tglbtn.o \ monodll_treectrl.o \ monodll_systhemectrl.o \ + monodll_customdraw.o \ monodll_msw_checklst.o \ monodll_msw_fdrepdlg.o \ monodll_msw_fontdlg.o @@ -7365,6 +7367,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_1 = \ monolib_msw_tglbtn.o \ monolib_treectrl.o \ monolib_systhemectrl.o \ + monolib_customdraw.o \ monolib_msw_checklst.o \ monolib_msw_fdrepdlg.o \ monolib_msw_fontdlg.o @@ -9520,6 +9523,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_2 = \ coredll_msw_tglbtn.o \ coredll_treectrl.o \ coredll_systhemectrl.o \ + coredll_customdraw.o \ coredll_msw_checklst.o \ coredll_msw_fdrepdlg.o \ coredll_msw_fontdlg.o @@ -10989,6 +10993,7 @@ COND_TOOLKIT_MSW___GUI_SRC_OBJECTS_3 = \ corelib_msw_tglbtn.o \ corelib_treectrl.o \ corelib_systhemectrl.o \ + corelib_customdraw.o \ corelib_msw_checklst.o \ corelib_msw_fdrepdlg.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) $(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) $(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) $(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) $(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) $(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) $(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) $(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) $(CXXC) -c -o $@ $(CORELIB_CXXFLAGS) $(srcdir)/src/msw/checklst.cpp diff --git a/build/bakefiles/files.bkl b/build/bakefiles/files.bkl index e8a3dc4630..64b427a190 100644 --- a/build/bakefiles/files.bkl +++ b/build/bakefiles/files.bkl @@ -1181,6 +1181,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! wx/systhemectrl.h wx/collheaderctrl.h wx/generic/collheaderctrl.h + wx/itemattr.h @@ -1982,6 +1983,7 @@ IMPORTANT: please read docs/tech/tn0016.txt before modifying this file! src/msw/tglbtn.cpp src/msw/treectrl.cpp src/msw/systhemectrl.cpp + src/msw/customdraw.cpp wx/generic/clrpickerg.h diff --git a/build/files b/build/files index c75433c695..8d10fa53f1 100644 --- a/build/files +++ b/build/files @@ -1039,6 +1039,7 @@ GUI_CMN_HDR = wx/imagtga.h wx/imagtiff.h wx/imagxpm.h + wx/itemattr.h wx/listbase.h wx/listbook.h wx/listctrl.h @@ -1797,6 +1798,7 @@ MSW_SRC = src/msw/combo.cpp src/msw/combobox.cpp src/msw/control.cpp + src/msw/customdraw.cpp src/msw/dialog.cpp src/msw/dirdlg.cpp src/msw/dragimag.cpp diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index ab07b27785..d32214c760 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -1897,6 +1897,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_msw_tglbtn.obj \ $(OBJS)\monodll_treectrl.obj \ $(OBJS)\monodll_systhemectrl.obj \ + $(OBJS)\monodll_customdraw.obj \ $(OBJS)\monodll_msw_checklst.obj \ $(OBJS)\monodll_msw_fdrepdlg.obj \ $(OBJS)\monodll_fontdlg.obj \ @@ -2728,6 +2729,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_msw_tglbtn.obj \ $(OBJS)\monolib_treectrl.obj \ $(OBJS)\monolib_systhemectrl.obj \ + $(OBJS)\monolib_customdraw.obj \ $(OBJS)\monolib_msw_checklst.obj \ $(OBJS)\monolib_msw_fdrepdlg.obj \ $(OBJS)\monolib_fontdlg.obj \ @@ -3431,6 +3433,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_msw_tglbtn.obj \ $(OBJS)\coredll_treectrl.obj \ $(OBJS)\coredll_systhemectrl.obj \ + $(OBJS)\coredll_customdraw.obj \ $(OBJS)\coredll_msw_checklst.obj \ $(OBJS)\coredll_msw_fdrepdlg.obj \ $(OBJS)\coredll_fontdlg.obj \ @@ -4002,6 +4005,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_msw_tglbtn.obj \ $(OBJS)\corelib_treectrl.obj \ $(OBJS)\corelib_systhemectrl.obj \ + $(OBJS)\corelib_customdraw.obj \ $(OBJS)\corelib_msw_checklst.obj \ $(OBJS)\corelib_msw_fdrepdlg.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 $(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 $(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 $(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 $(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 $(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 $(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 $(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 $(CXX) -q -c -P -o$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\checklst.cpp diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index 492fe10dad..ed7ec53ffc 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -1916,6 +1916,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_msw_tglbtn.o \ $(OBJS)\monodll_treectrl.o \ $(OBJS)\monodll_systhemectrl.o \ + $(OBJS)\monodll_customdraw.o \ $(OBJS)\monodll_msw_checklst.o \ $(OBJS)\monodll_msw_fdrepdlg.o \ $(OBJS)\monodll_fontdlg.o \ @@ -2753,6 +2754,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_msw_tglbtn.o \ $(OBJS)\monolib_treectrl.o \ $(OBJS)\monolib_systhemectrl.o \ + $(OBJS)\monolib_customdraw.o \ $(OBJS)\monolib_msw_checklst.o \ $(OBJS)\monolib_msw_fdrepdlg.o \ $(OBJS)\monolib_fontdlg.o \ @@ -3472,6 +3474,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_msw_tglbtn.o \ $(OBJS)\coredll_treectrl.o \ $(OBJS)\coredll_systhemectrl.o \ + $(OBJS)\coredll_customdraw.o \ $(OBJS)\coredll_msw_checklst.o \ $(OBJS)\coredll_msw_fdrepdlg.o \ $(OBJS)\coredll_fontdlg.o \ @@ -4051,6 +4054,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_msw_tglbtn.o \ $(OBJS)\corelib_treectrl.o \ $(OBJS)\corelib_systhemectrl.o \ + $(OBJS)\corelib_customdraw.o \ $(OBJS)\corelib_msw_checklst.o \ $(OBJS)\corelib_msw_fdrepdlg.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 $(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 $(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 $(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 $(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 $(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 $(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 $(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 $(CXX) -c -o $@ $(CORELIB_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 5f3afb2537..1ec0c63716 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -2197,6 +2197,7 @@ ____CORE_SRC_FILENAMES_OBJECTS = \ $(OBJS)\monodll_msw_tglbtn.obj \ $(OBJS)\monodll_treectrl.obj \ $(OBJS)\monodll_systhemectrl.obj \ + $(OBJS)\monodll_customdraw.obj \ $(OBJS)\monodll_msw_checklst.obj \ $(OBJS)\monodll_msw_fdrepdlg.obj \ $(OBJS)\monodll_fontdlg.obj \ @@ -3034,6 +3035,7 @@ ____CORE_SRC_FILENAMES_1_OBJECTS = \ $(OBJS)\monolib_msw_tglbtn.obj \ $(OBJS)\monolib_treectrl.obj \ $(OBJS)\monolib_systhemectrl.obj \ + $(OBJS)\monolib_customdraw.obj \ $(OBJS)\monolib_msw_checklst.obj \ $(OBJS)\monolib_msw_fdrepdlg.obj \ $(OBJS)\monolib_fontdlg.obj \ @@ -3803,6 +3805,7 @@ ____CORE_SRC_FILENAMES_2_OBJECTS = \ $(OBJS)\coredll_msw_tglbtn.obj \ $(OBJS)\coredll_treectrl.obj \ $(OBJS)\coredll_systhemectrl.obj \ + $(OBJS)\coredll_customdraw.obj \ $(OBJS)\coredll_msw_checklst.obj \ $(OBJS)\coredll_msw_fdrepdlg.obj \ $(OBJS)\coredll_fontdlg.obj \ @@ -4380,6 +4383,7 @@ ____CORE_SRC_FILENAMES_3_OBJECTS = \ $(OBJS)\corelib_msw_tglbtn.obj \ $(OBJS)\corelib_treectrl.obj \ $(OBJS)\corelib_systhemectrl.obj \ + $(OBJS)\corelib_customdraw.obj \ $(OBJS)\corelib_msw_checklst.obj \ $(OBJS)\corelib_msw_fdrepdlg.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 $(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 $(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 $(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 $(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 $(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 $(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 $(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 $(CXX) /c /nologo /TP /Fo$@ $(CORELIB_CXXFLAGS) ..\..\src\msw\checklst.cpp diff --git a/build/msw/wx_core.vcxproj b/build/msw/wx_core.vcxproj index 425d1e1845..291c6f866d 100644 --- a/build/msw/wx_core.vcxproj +++ b/build/msw/wx_core.vcxproj @@ -1007,6 +1007,7 @@ + @@ -1379,6 +1380,7 @@ + diff --git a/build/msw/wx_core.vcxproj.filters b/build/msw/wx_core.vcxproj.filters index 39e16aeb8f..4295676e97 100644 --- a/build/msw/wx_core.vcxproj.filters +++ b/build/msw/wx_core.vcxproj.filters @@ -612,6 +612,9 @@ MSW Sources + + MSW Sources + MSW Sources @@ -690,6 +693,9 @@ MSW Sources + + MSW Sources + MSW Sources @@ -897,9 +903,6 @@ Common Sources - - MSW Sources - @@ -928,6 +931,9 @@ Common Headers + + Common Headers + Common Headers @@ -1312,6 +1318,9 @@ Common Headers + + Common Headers + Common Headers @@ -1672,9 +1681,6 @@ MSW Headers - - Common Headers - Common Headers diff --git a/build/msw/wx_vc7_core.vcproj b/build/msw/wx_vc7_core.vcproj index 1a69b3b619..583cc7eeee 100644 --- a/build/msw/wx_vc7_core.vcproj +++ b/build/msw/wx_vc7_core.vcproj @@ -769,6 +769,9 @@ + + @@ -2285,6 +2288,9 @@ + + diff --git a/build/msw/wx_vc8_core.vcproj b/build/msw/wx_vc8_core.vcproj index c87b463021..91212e072e 100644 --- a/build/msw/wx_vc8_core.vcproj +++ b/build/msw/wx_vc8_core.vcproj @@ -1430,6 +1430,10 @@ RelativePath="..\..\src\msw\cursor.cpp" > + + @@ -3548,6 +3552,10 @@ RelativePath="..\..\include\wx\infobar.h" > + + diff --git a/build/msw/wx_vc9_core.vcproj b/build/msw/wx_vc9_core.vcproj index 24d92eb874..91d8b8dbd3 100644 --- a/build/msw/wx_vc9_core.vcproj +++ b/build/msw/wx_vc9_core.vcproj @@ -1426,6 +1426,10 @@ RelativePath="..\..\src\msw\cursor.cpp" > + + @@ -3544,6 +3548,10 @@ RelativePath="..\..\include\wx\infobar.h" > + + diff --git a/docs/changes.txt b/docs/changes.txt index 8bf63bcef4..674d97d92e 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -71,6 +71,8 @@ All (GUI): - Add support for wxSL_MIN_MAX_LABELS and wxSL_VALUE_LABEL to XRC (ousnius). - Update Scintilla to v3.6.3 (Paul Kulchenko). - Make wxDataViewCtrl::Expand() expand ancestors in native ports too. +- Add wxDataViewCtrl::SetHeaderAttr(). +- Add wxListCtrl::SetHeaderAttr(). wxGTK: diff --git a/include/wx/dataview.h b/include/wx/dataview.h index 3b8bc71e25..e9c35940f7 100644 --- a/include/wx/dataview.h +++ b/include/wx/dataview.h @@ -29,6 +29,8 @@ #include "wx/systhemectrl.h" class WXDLLIMPEXP_FWD_CORE wxImageList; +class WXDLLIMPEXP_FWD_CORE wxItemAttr; +class WXDLLIMPEXP_FWD_CORE wxHeaderCtrl; #if !(defined(__WXGTK20__) || defined(__WXOSX__) ) || defined(__WXUNIVERSAL__) // #if !(defined(__WXOSX__)) || defined(__WXUNIVERSAL__) @@ -128,7 +130,7 @@ private: // 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 { @@ -732,6 +734,10 @@ public: // 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 { return GetClassDefaultAttributes(GetWindowVariant()); diff --git a/include/wx/generic/dataview.h b/include/wx/generic/dataview.h index 224f90f166..694ee8ffe6 100644 --- a/include/wx/generic/dataview.h +++ b/include/wx/generic/dataview.h @@ -256,11 +256,18 @@ public: 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 // should not be used in portable code. wxColour GetAlternateRowColour() const { return m_alternateRowColour; } 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: void EnsureVisibleRowCol( int row, int column ); diff --git a/include/wx/generic/private/listctrl.h b/include/wx/generic/private/listctrl.h index 9cd50707a8..0f5c002632 100644 --- a/include/wx/generic/private/listctrl.h +++ b/include/wx/generic/private/listctrl.h @@ -85,8 +85,8 @@ public: void GetItem( wxListItem &info ) const; - void SetAttr(wxListItemAttr *attr) { m_attr = attr; } - wxListItemAttr *GetAttr() const { return m_attr; } + void SetAttr(wxItemAttr *attr) { m_attr = attr; } + wxItemAttr *GetAttr() const { return m_attr; } public: // the item image or -1 @@ -103,7 +103,7 @@ public: wxListMainWindow *m_owner; // custom attributes or NULL - wxListItemAttr *m_attr; + wxItemAttr *m_attr; protected: // common part of all ctors @@ -263,8 +263,8 @@ public: wxString GetText(int index) const; void SetText( int index, const wxString& s ); - wxListItemAttr *GetAttr() const; - void SetAttr(wxListItemAttr *attr); + wxItemAttr *GetAttr() const; + void SetAttr(wxItemAttr *attr); // return true if the highlighting really changed bool Highlight( bool on ); diff --git a/include/wx/itemattr.h b/include/wx/itemattr.h new file mode 100644 index 0000000000..596cb2bab8 --- /dev/null +++ b/include/wx/itemattr.h @@ -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 +// 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_ diff --git a/include/wx/listbase.h b/include/wx/listbase.h index 1c79de0084..221052ac8b 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -16,6 +16,7 @@ #include "wx/gdicmn.h" #include "wx/event.h" #include "wx/control.h" +#include "wx/itemattr.h" #include "wx/systhemectrl.h" class WXDLLIMPEXP_FWD_CORE wxImageList; @@ -158,60 +159,10 @@ enum wxLIST_FIND_RIGHT }; -// ---------------------------------------------------------------------------- -// wxListItemAttr: a structure containing the visual attributes of an item -// ---------------------------------------------------------------------------- - -// 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; -}; +// For compatibility, define the old name for this class. There is no need to +// 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; // ---------------------------------------------------------------------------- // wxListItem: the item or column info, used to exchange data with wxListCtrl @@ -237,7 +188,7 @@ public: { // copy list item attributes if ( item.HasAttributes() ) - m_attr = new wxListItemAttr(*item.GetAttributes()); + m_attr = new wxItemAttr(*item.GetAttributes()); } wxListItem& operator=(const wxListItem& item) @@ -254,7 +205,7 @@ public: m_data = item.m_data; m_format = item.m_format; 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; @@ -310,7 +261,7 @@ public: int GetWidth() const { return m_width; } 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; } wxColour GetTextColour() const @@ -342,10 +293,10 @@ public: protected: // creates m_attr if we don't have it yet - wxListItemAttr& Attributes() + wxItemAttr& Attributes() { if ( !m_attr ) - m_attr = new wxListItemAttr; + m_attr = new wxItemAttr; return *m_attr; } @@ -364,7 +315,7 @@ protected: m_width = 0; } - wxListItemAttr *m_attr; // optional pointer to the items style + wxItemAttr *m_attr; // optional pointer to the items style private: wxDECLARE_DYNAMIC_CLASS(wxListItem); @@ -443,7 +394,7 @@ public: virtual bool SetColumnWidth(int col, int width) = 0; // 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. // ------------------------------ @@ -460,6 +411,9 @@ public: void SetAlternateRowColour(const wxColour& colour); 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. virtual bool HasCheckboxes() const { return false; } virtual bool EnableCheckboxes(bool WXUNUSED(enable) = true) { return false; } @@ -475,7 +429,7 @@ protected: private: // user defined color to draw row lines, may be invalid - wxListItemAttr m_alternateRowColour; + wxItemAttr m_alternateRowColour; }; // ---------------------------------------------------------------------------- diff --git a/include/wx/msw/headerctrl.h b/include/wx/msw/headerctrl.h index db702c5a19..af2125bfb5 100644 --- a/include/wx/msw/headerctrl.h +++ b/include/wx/msw/headerctrl.h @@ -12,6 +12,8 @@ class WXDLLIMPEXP_FWD_CORE wxImageList; +class wxMSWHeaderCtrlCustomDraw; + // ---------------------------------------------------------------------------- // wxHeaderCtrl // ---------------------------------------------------------------------------- @@ -45,7 +47,11 @@ public: 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: // override wxWindow methods which must be implemented by a new control virtual wxSize DoGetBestSize() const; @@ -98,6 +104,10 @@ private: // mouse 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 // 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 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); }; diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 1b8beaed63..95e2e883b2 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -16,6 +16,7 @@ #include "wx/vector.h" class wxMSWListItemData; +class wxMSWListHeaderCustomDraw; // define this symbol to indicate the availability of SetColumnsOrder() and // related functions @@ -115,6 +116,9 @@ public: bool SetForegroundColour(const wxColour& col); bool SetBackgroundColour(const wxColour& col); + // Header attributes + virtual bool SetHeaderAttr(const wxItemAttr& attr) wxOVERRIDE; + // Gets information about this column 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 // 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 @@ -437,7 +441,7 @@ protected: virtual int OnGetItemColumnImage(long item, long column) const; // 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); } @@ -461,6 +465,10 @@ private: void OnCharHook(wxKeyEvent& event); + // Object using for header custom drawing if necessary, may be NULL. + wxMSWListHeaderCustomDraw* m_headerCustomDraw; + + wxDECLARE_DYNAMIC_CLASS(wxListCtrl); wxDECLARE_EVENT_TABLE(); wxDECLARE_NO_COPY_CLASS(wxListCtrl); diff --git a/include/wx/msw/private/customdraw.h b/include/wx/msw/private/customdraw.h new file mode 100644 index 0000000000..36bd009659 --- /dev/null +++ b/include/wx/msw/private/customdraw.h @@ -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 +// 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_ diff --git a/include/wx/msw/treectrl.h b/include/wx/msw/treectrl.h index 914cddc395..b9206acfb9 100644 --- a/include/wx/msw/treectrl.h +++ b/include/wx/msw/treectrl.h @@ -34,7 +34,8 @@ class WXDLLIMPEXP_FWD_CORE wxDragImage; struct WXDLLIMPEXP_FWD_CORE wxTreeViewItem; // 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 diff --git a/include/wx/qt/listctrl.h b/include/wx/qt/listctrl.h index b534a0128e..3b08104dcc 100644 --- a/include/wx/qt/listctrl.h +++ b/include/wx/qt/listctrl.h @@ -279,7 +279,7 @@ public: virtual int OnGetItemColumnImage(long item, long column) const; // 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); } diff --git a/include/wx/treebase.h b/include/wx/treebase.h index 6ce145f603..f7513bb2ab 100644 --- a/include/wx/treebase.h +++ b/include/wx/treebase.h @@ -180,40 +180,6 @@ static const int wxTREE_HITTEST_ONITEM = wxTREE_HITTEST_ONITEMICON | // tree ctrl default name 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 // diff --git a/interface/wx/dataview.h b/interface/wx/dataview.h index a4a9362fbe..2c29c76049 100644 --- a/interface/wx/dataview.h +++ b/interface/wx/dataview.h @@ -1547,6 +1547,25 @@ public: */ 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. */ diff --git a/interface/wx/itemattr.h b/interface/wx/itemattr.h new file mode 100644 index 0000000000..041bb2c37e --- /dev/null +++ b/interface/wx/itemattr.h @@ -0,0 +1,104 @@ +///////////////////////////////////////////////////////////////////////////// +// Name: wx/itemattr.h +// Purpose: wxItemAttr documentation +// Author: Vadim Zeitlin +// Copyright: (c) 2016 Vadim Zeitlin +// 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); +}; diff --git a/interface/wx/listctrl.h b/interface/wx/listctrl.h index cfe47e97df..022743c8a6 100644 --- a/interface/wx/listctrl.h +++ b/interface/wx/listctrl.h @@ -1052,6 +1052,25 @@ public: */ 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. @@ -1278,14 +1297,14 @@ protected: @c item or @NULL to use the default appearance parameters. 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. @see OnGetItemImage(), OnGetItemColumnImage(), OnGetItemText(), 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 @@ -1302,7 +1321,7 @@ protected: @see OnGetItemAttr(), OnGetItemText(), 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 @@ -1513,80 +1532,6 @@ wxEventType wxEVT_LIST_ITEM_CHECKED; 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 diff --git a/samples/dataview/dataview.cpp b/samples/dataview/dataview.cpp index a51a3146e6..fca7630647 100644 --- a/samples/dataview/dataview.cpp +++ b/samples/dataview/dataview.cpp @@ -32,8 +32,13 @@ #include "wx/numdlg.h" #include "wx/spinctrl.h" #include "wx/imaglist.h" +#include "wx/itemattr.h" #include "wx/notebook.h" +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + #include "wx/headerctrl.h" +#endif // wxHAS_GENERIC_DATAVIEWCTRL + #include "mymodels.h" // ---------------------------------------------------------------------------- @@ -74,6 +79,10 @@ private: // event handlers void OnStyleChange(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 OnIncIndent(wxCommandEvent& event); void OnDecIndent(wxCommandEvent& event); @@ -290,6 +299,10 @@ enum ID_CLEARLOG = wxID_HIGHEST+1, ID_BACKGROUND_COLOUR, ID_FOREGROUND_COLOUR, + ID_CUSTOM_HEADER_ATTR, +#ifdef wxHAS_GENERIC_DATAVIEWCTRL + ID_CUSTOM_HEADER_HEIGHT, +#endif // wxHAS_GENERIC_DATAVIEWCTRL ID_STYLE_MENU, ID_INC_INDENT, ID_DEC_INDENT, @@ -344,6 +357,10 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU( ID_FOREGROUND_COLOUR, MyFrame::OnSetForegroundColour ) 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_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_FOREGROUND_COLOUR, "Set &foreground colour...\tCtrl-S"); 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_INC_INDENT, "&Increase indent\tCtrl-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)) { wxDataViewCtrl * const dvc = m_ctrl[m_notebook->GetSelection()]; diff --git a/samples/listctrl/listtest.cpp b/samples/listctrl/listtest.cpp index c96eab1366..abb07423c0 100644 --- a/samples/listctrl/listtest.cpp +++ b/samples/listctrl/listtest.cpp @@ -137,6 +137,7 @@ wxBEGIN_EVENT_TABLE(MyFrame, wxFrame) EVT_MENU(LIST_SET_FG_COL, MyFrame::OnSetFgColour) EVT_MENU(LIST_SET_BG_COL, MyFrame::OnSetBgColour) 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_SHOW_COL_INFO, MyFrame::OnShowColInfo) 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_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_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_BG_COL, wxT("&Background colour...")); menuCol->AppendCheckItem(LIST_ROW_LINES, wxT("Alternating colours")); + menuCol->AppendCheckItem(LIST_CUSTOM_HEADER_ATTR, "&Custom header attributes"); wxMenuBar *menubar = new wxMenuBar; menubar->Append(menuFile, wxT("&File")); @@ -894,6 +897,20 @@ void MyFrame::OnSetRowLines(wxCommandEvent& event) 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)) { m_listCtrl->InsertItem(m_listCtrl->GetItemCount(), wxT("Appended item")); @@ -1226,7 +1243,7 @@ void MyListCtrl::OnListKeyDown(wxListEvent& event) GetItem(info); - wxListItemAttr *attr = info.GetAttributes(); + wxItemAttr *attr = info.GetAttributes(); if ( !attr || !attr->HasTextColour() ) { info.SetTextColour(*wxCYAN); @@ -1416,13 +1433,13 @@ int MyListCtrl::OnGetItemColumnImage(long item, long column) const 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 // set to some item and it is refreshed, we highlight the item if ( item == m_updated ) { - static wxListItemAttr s_attrHighlight(*wxRED, wxNullColour, wxNullFont); + static wxItemAttr s_attrHighlight(*wxRED, wxNullColour, wxNullFont); return &s_attrHighlight; } diff --git a/samples/listctrl/listtest.h b/samples/listctrl/listtest.h index f1f21b5b9a..be4e8adc3f 100644 --- a/samples/listctrl/listtest.h +++ b/samples/listctrl/listtest.h @@ -84,7 +84,7 @@ private: virtual wxString OnGetItemText(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; @@ -132,6 +132,7 @@ protected: void OnSetFgColour(wxCommandEvent& event); void OnSetBgColour(wxCommandEvent& event); void OnSetRowLines(wxCommandEvent& event); + void OnCustomHeaderAttr(wxCommandEvent& event); void OnToggleMultiSel(wxCommandEvent& event); void OnShowColInfo(wxCommandEvent& event); void OnShowSelInfo(wxCommandEvent& event); @@ -221,6 +222,7 @@ enum LIST_SET_FG_COL, LIST_SET_BG_COL, LIST_ROW_LINES, + LIST_CUSTOM_HEADER_ATTR, LIST_TOGGLE_MULTI_SEL, LIST_TOGGLE_HEADER, LIST_TOGGLE_BELL, diff --git a/samples/widgets/Makefile.in b/samples/widgets/Makefile.in index d4d7647218..e51b00adce 100644 --- a/samples/widgets/Makefile.in +++ b/samples/widgets/Makefile.in @@ -70,6 +70,7 @@ WIDGETS_OBJECTS = \ widgets_filepicker.o \ widgets_fontpicker.o \ widgets_gauge.o \ + widgets_headerctrl.o \ widgets_hyperlnk.o \ widgets_itemcontainer.o \ widgets_listbox.o \ @@ -265,6 +266,9 @@ widgets_fontpicker.o: $(srcdir)/fontpicker.cpp widgets_gauge.o: $(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 $(CXXC) -c -o $@ $(WIDGETS_CXXFLAGS) $(srcdir)/hyperlnk.cpp diff --git a/samples/widgets/headerctrl.cpp b/samples/widgets/headerctrl.cpp new file mode 100644 index 0000000000..92979e49a0 --- /dev/null +++ b/samples/widgets/headerctrl.cpp @@ -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 diff --git a/samples/widgets/icons/header.xpm b/samples/widgets/icons/header.xpm new file mode 100644 index 0000000000..ce95e30dff --- /dev/null +++ b/samples/widgets/icons/header.xpm @@ -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 */ +" ", +" ############################## ", +" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ", +" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ", +" #&&&&&&&&&&&&&&&&&&&&&&&&&&&&# ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" ############################## ", +" " +}; diff --git a/samples/widgets/makefile.bcc b/samples/widgets/makefile.bcc index 991ea88449..03fdfd2a7e 100644 --- a/samples/widgets/makefile.bcc +++ b/samples/widgets/makefile.bcc @@ -51,6 +51,7 @@ WIDGETS_OBJECTS = \ $(OBJS)\widgets_filepicker.obj \ $(OBJS)\widgets_fontpicker.obj \ $(OBJS)\widgets_gauge.obj \ + $(OBJS)\widgets_headerctrl.obj \ $(OBJS)\widgets_hyperlnk.obj \ $(OBJS)\widgets_itemcontainer.obj \ $(OBJS)\widgets_listbox.obj \ @@ -310,6 +311,9 @@ $(OBJS)\widgets_fontpicker.obj: .\fontpicker.cpp $(OBJS)\widgets_gauge.obj: .\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 $(CXX) -q -c -P -o$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp diff --git a/samples/widgets/makefile.gcc b/samples/widgets/makefile.gcc index 3a0009ae8e..8f4c99d4ea 100644 --- a/samples/widgets/makefile.gcc +++ b/samples/widgets/makefile.gcc @@ -44,6 +44,7 @@ WIDGETS_OBJECTS = \ $(OBJS)\widgets_filepicker.o \ $(OBJS)\widgets_fontpicker.o \ $(OBJS)\widgets_gauge.o \ + $(OBJS)\widgets_headerctrl.o \ $(OBJS)\widgets_hyperlnk.o \ $(OBJS)\widgets_itemcontainer.o \ $(OBJS)\widgets_listbox.o \ @@ -299,6 +300,9 @@ $(OBJS)\widgets_fontpicker.o: ./fontpicker.cpp $(OBJS)\widgets_gauge.o: ./gauge.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\widgets_headerctrl.o: ./headerctrl.cpp + $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\widgets_hyperlnk.o: ./hyperlnk.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< diff --git a/samples/widgets/makefile.unx b/samples/widgets/makefile.unx index 6ec2d07a6e..08b3bfe112 100644 --- a/samples/widgets/makefile.unx +++ b/samples/widgets/makefile.unx @@ -68,6 +68,7 @@ WIDGETS_OBJECTS = \ widgets_filepicker.o \ widgets_fontpicker.o \ widgets_gauge.o \ + widgets_headerctrl.o \ widgets_hyperlnk.o \ widgets_itemcontainer.o \ widgets_listbox.o \ @@ -165,6 +166,9 @@ widgets_fontpicker.o: ./fontpicker.cpp widgets_gauge.o: ./gauge.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< +widgets_headerctrl.o: ./headerctrl.cpp + $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< + widgets_hyperlnk.o: ./hyperlnk.cpp $(CXX) -c -o $@ $(WIDGETS_CXXFLAGS) $(CPPDEPS) $< diff --git a/samples/widgets/makefile.vc b/samples/widgets/makefile.vc index aaa243fbae..7670f32252 100644 --- a/samples/widgets/makefile.vc +++ b/samples/widgets/makefile.vc @@ -46,6 +46,7 @@ WIDGETS_OBJECTS = \ $(OBJS)\widgets_filepicker.obj \ $(OBJS)\widgets_fontpicker.obj \ $(OBJS)\widgets_gauge.obj \ + $(OBJS)\widgets_headerctrl.obj \ $(OBJS)\widgets_hyperlnk.obj \ $(OBJS)\widgets_itemcontainer.obj \ $(OBJS)\widgets_listbox.obj \ @@ -433,6 +434,9 @@ $(OBJS)\widgets_fontpicker.obj: .\fontpicker.cpp $(OBJS)\widgets_gauge.obj: .\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 $(CXX) /c /nologo /TP /Fo$@ $(WIDGETS_CXXFLAGS) .\hyperlnk.cpp diff --git a/samples/widgets/widgets.bkl b/samples/widgets/widgets.bkl index 41dc5907e2..74536f79d7 100644 --- a/samples/widgets/widgets.bkl +++ b/samples/widgets/widgets.bkl @@ -37,6 +37,7 @@ filepicker.cpp fontpicker.cpp gauge.cpp + headerctrl.cpp hyperlnk.cpp itemcontainer.cpp listbox.cpp diff --git a/samples/widgets/widgets_vc7.vcproj b/samples/widgets/widgets_vc7.vcproj index 92eb7877da..f721fb2ba1 100644 --- a/samples/widgets/widgets_vc7.vcproj +++ b/samples/widgets/widgets_vc7.vcproj @@ -328,6 +328,9 @@ + + diff --git a/samples/widgets/widgets_vc8.vcproj b/samples/widgets/widgets_vc8.vcproj index 93c0a27227..0eaddea77e 100644 --- a/samples/widgets/widgets_vc8.vcproj +++ b/samples/widgets/widgets_vc8.vcproj @@ -866,6 +866,10 @@ RelativePath=".\gauge.cpp" > + + diff --git a/samples/widgets/widgets_vc9.vcproj b/samples/widgets/widgets_vc9.vcproj index dac1d5654c..d3743d808e 100644 --- a/samples/widgets/widgets_vc9.vcproj +++ b/samples/widgets/widgets_vc9.vcproj @@ -838,6 +838,10 @@ RelativePath=".\gauge.cpp" > + + diff --git a/src/common/listctrlcmn.cpp b/src/common/listctrlcmn.cpp index 25f29b8042..518718e94f 100644 --- a/src/common/listctrlcmn.cpp +++ b/src/common/listctrlcmn.cpp @@ -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)) - ? wxConstCast(&m_alternateRowColour, wxListItemAttr) + ? wxConstCast(&m_alternateRowColour, wxItemAttr) : NULL; // no attributes by default } diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index 41f4403240..95d235e91d 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -41,6 +41,7 @@ #include "wx/renderer.h" #include "wx/dcbuffer.h" #include "wx/icon.h" +#include "wx/itemattr.h" #include "wx/list.h" #include "wx/listimpl.cpp" #include "wx/imaglist.h" @@ -4624,6 +4625,11 @@ wxBorder wxDataViewCtrl::GetDefaultBorder() const return wxBORDER_THEME; } +wxHeaderCtrl* wxDataViewCtrl::GenericGetHeader() const +{ + return m_headerArea; +} + #ifdef __WXMSW__ WXLRESULT wxDataViewCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, @@ -5202,6 +5208,24 @@ bool wxDataViewCtrl::IsSelected( const wxDataViewItem & item ) const 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) { m_alternateRowColour = colour; diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index ef7aa27c6c..a3813d0323 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -168,7 +168,7 @@ void wxListItemData::SetItem( const wxListItem &info ) if ( m_attr ) m_attr->AssignFrom(*info.GetAttributes()); else - m_attr = new wxListItemAttr(*info.GetAttributes()); + m_attr = new wxItemAttr(*info.GetAttributes()); } if ( m_rect ) @@ -654,7 +654,7 @@ int wxListLineData::GetImage( int index ) const return item->GetImage(); } -wxListItemAttr *wxListLineData::GetAttr() const +wxItemAttr *wxListLineData::GetAttr() const { wxListItemDataList::compatibility_iterator node = m_items.GetFirst(); wxCHECK_MSG( node, NULL, wxT("invalid column index in GetAttr()") ); @@ -663,7 +663,7 @@ wxListItemAttr *wxListLineData::GetAttr() const return item->GetAttr(); } -void wxListLineData::SetAttr(wxListItemAttr *attr) +void wxListLineData::SetAttr(wxItemAttr *attr) { wxListItemDataList::compatibility_iterator node = m_items.GetFirst(); wxCHECK_RET( node, wxT("invalid column index in SetAttr()") ); @@ -677,7 +677,7 @@ void wxListLineData::ApplyAttributes(wxDC *dc, bool highlighted, bool current) { - const wxListItemAttr * const attr = GetAttr(); + const wxItemAttr * const attr = GetAttr(); wxWindow * const listctrl = m_owner->GetParent(); diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 1aeac569fd..f45fca5e24 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -37,6 +37,7 @@ #include "wx/generic/treectlg.h" #include "wx/imaglist.h" +#include "wx/itemattr.h" #include "wx/renderer.h" @@ -223,7 +224,7 @@ public: { wxFont font; - wxTreeItemAttr * const attr = GetAttributes(); + wxItemAttr * const attr = GetAttributes(); if ( attr && attr->HasFont() ) font = attr->GetFont(); else if ( IsBold() ) @@ -282,19 +283,19 @@ public: // attributes // 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 - wxTreeItemAttr& Attr() + wxItemAttr& Attr() { if ( !m_attr ) { - m_attr = new wxTreeItemAttr; + m_attr = new wxItemAttr; m_ownsAttr = true; } return *m_attr; } // set them - void SetAttributes(wxTreeItemAttr *attr) + void SetAttributes(wxItemAttr *attr) { if ( m_ownsAttr ) delete m_attr; m_attr = attr; @@ -303,7 +304,7 @@ public: m_widthText = -1; } // set them and delete when done - void AssignAttributes(wxTreeItemAttr *attr) + void AssignAttributes(wxItemAttr *attr) { SetAttributes(attr); m_ownsAttr = true; @@ -335,7 +336,7 @@ private: wxArrayGenericTreeItems m_children; // list of children wxGenericTreeItem *m_parent; // parent of this item - wxTreeItemAttr *m_attr; // attributes??? + wxItemAttr *m_attr; // attributes??? // tree ctrl images for the normal, selected, expanded and // expanded+selected states @@ -2554,7 +2555,7 @@ void wxGenericTreeCtrl::PaintItem(wxGenericTreeItem *item, wxDC& dc) else { wxColour colBg; - wxTreeItemAttr * const attr = item->GetAttributes(); + wxItemAttr * const attr = item->GetAttributes(); if ( attr && attr->HasBackgroundColour() ) { drawItemBackground = @@ -2789,7 +2790,7 @@ wxGenericTreeCtrl::PaintLevel(wxGenericTreeItem *item, } else { - wxTreeItemAttr *attr = item->GetAttributes(); + wxItemAttr *attr = item->GetAttributes(); if (attr && attr->HasTextColour()) colText = attr->GetTextColour(); else diff --git a/src/msw/customdraw.cpp b/src/msw/customdraw.cpp new file mode 100644 index 0000000000..aae74669b8 --- /dev/null +++ b/src/msw/customdraw.cpp @@ -0,0 +1,66 @@ +/////////////////////////////////////////////////////////////////////////////// +// Name: src/msw/customdraw.cpp +// Purpose: wxMSWCustomDraw implementation +// Author: Vadim Zeitlin +// Created: 2016-04-16 +// Copyright: (c) 2016 Vadim Zeitlin +// 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(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; +} diff --git a/src/msw/headerctrl.cpp b/src/msw/headerctrl.cpp index 359324b439..befc28c119 100644 --- a/src/msw/headerctrl.cpp +++ b/src/msw/headerctrl.cpp @@ -37,6 +37,7 @@ #include "wx/msw/wrapcctl.h" #include "wx/msw/private.h" +#include "wx/msw/private/customdraw.h" #ifndef HDM_SETBITMAPMARGIN #define HDM_SETBITMAPMARGIN 0x1234 @@ -50,6 +51,36 @@ // from src/msw/listctrl.cpp 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 // ============================================================================ @@ -64,6 +95,7 @@ void wxHeaderCtrl::Init() m_imageList = NULL; m_scrollOffset = 0; m_colBeingDragged = -1; + m_customDraw = NULL; } bool wxHeaderCtrl::Create(wxWindow *parent, @@ -116,6 +148,7 @@ WXDWORD wxHeaderCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const wxHeaderCtrl::~wxHeaderCtrl() { delete m_imageList; + delete m_customDraw; } // ---------------------------------------------------------------------------- @@ -466,6 +499,73 @@ int wxHeaderCtrl::MSWFromNativeOrder(int order) 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 // ---------------------------------------------------------------------------- @@ -670,6 +770,18 @@ bool wxHeaderCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) // Dragging the column was cancelled. m_colBeingDragged = -1; break; + + // other events + // ------------ + + case NM_CUSTOMDRAW: + if ( m_customDraw ) + { + *result = m_customDraw->HandleCustomDraw(lParam); + if ( *result != CDRF_DODEFAULT ) + return true; + } + break; } diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index e37f779da2..6a04fe2da3 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -42,6 +42,7 @@ #include "wx/vector.h" #include "wx/msw/private.h" +#include "wx/msw/private/customdraw.h" #include "wx/msw/private/keyboard.h" // Currently gcc doesn't define NMLVFINDITEM, and DMC only defines @@ -198,7 +199,7 @@ private: /////////////////////////////////////////////////////// // Problem: // 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 // of the list the text attributes (colour etc) for // the following items were out of sync. @@ -223,12 +224,40 @@ public: wxMSWListItemData() : attr(NULL), lParam(0) {} ~wxMSWListItemData() { delete attr; } - wxListItemAttr *attr; + wxItemAttr *attr; LPARAM lParam; // real user data 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) EVT_PAINT(wxListCtrl::OnPaint) EVT_CHAR_HOOK(wxListCtrl::OnCharHook) @@ -255,6 +284,8 @@ void wxListCtrl::Init() m_textCtrl = NULL; m_hasAnyAttr = false; + + m_headerCustomDraw = NULL; } bool wxListCtrl::Create(wxWindow *parent, @@ -434,6 +465,8 @@ wxListCtrl::~wxListCtrl() delete m_imageListSmall; if (m_ownsImageListState) delete m_imageListState; + + delete m_headerCustomDraw; } // ---------------------------------------------------------------------------- @@ -520,6 +553,68 @@ bool wxListCtrl::SetBackgroundColour(const wxColour& col) 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 bool wxListCtrl::GetColumn(int col, wxListItem& item) const { @@ -811,13 +906,13 @@ bool wxListCtrl::SetItem(wxListItem& info) // attributes if ( info.HasAttributes() ) { - const wxListItemAttr& attrNew = *info.GetAttributes(); + const wxItemAttr& attrNew = *info.GetAttributes(); // don't overwrite the already set attributes if we have them if ( data->attr ) data->attr->AssignFrom(attrNew); else - data->attr = new wxListItemAttr(attrNew); + data->attr = new wxItemAttr(attrNew); } } @@ -1754,7 +1849,7 @@ long wxListCtrl::InsertItem(const wxListItem& info) if ( info.HasAttributes() ) { // take copy of attributes - data->attr = new wxListItemAttr(*info.GetAttributes()); + data->attr = new wxItemAttr(*info.GetAttributes()); // and remember that we have some now... m_hasAnyAttr = true; @@ -1998,11 +2093,6 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) 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) 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 return true; + case NM_CUSTOMDRAW: + if ( m_headerCustomDraw ) + { + *result = m_headerCustomDraw->HandleCustomDraw(lParam); + if ( *result != CDRF_DODEFAULT ) + return true; + } + wxFALLTHROUGH; + default: ignore = true; } @@ -2097,9 +2196,7 @@ bool wxListCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) if ( ignore ) return wxListCtrlBase::MSWOnNotify(idCtrl, lParam, result); } - else -#endif // defined(HDN_BEGINTRACKA) - if ( nmhdr->hwndFrom == GetHwnd() ) + else if ( nmhdr->hwndFrom == GetHwnd() ) { // almost all messages use NM_LISTVIEW NM_LISTVIEW *nmLV = (NM_LISTVIEW *)nmhdr; @@ -2865,7 +2962,7 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) static WXLPARAM HandleItemPrepaint(wxListCtrl *listctrl, LPNMLVCUSTOMDRAW pLVCD, - wxListItemAttr *attr) + wxItemAttr *attr) { if ( !attr ) { @@ -3110,7 +3207,7 @@ int wxListCtrl::OnGetItemColumnImage(long item, long column) const return -1; } -wxListItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const +wxItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const { if ( IsVirtual() ) return OnGetItemColumnAttr(item, column); diff --git a/src/msw/treectrl.cpp b/src/msw/treectrl.cpp index a2dc9138b4..25ca687277 100644 --- a/src/msw/treectrl.cpp +++ b/src/msw/treectrl.cpp @@ -39,6 +39,7 @@ #include "wx/msw/private.h" #include "wx/imaglist.h" +#include "wx/itemattr.h" #include "wx/msw/dragimag.h" #include "wx/msw/uxtheme.h" @@ -1146,14 +1147,14 @@ void wxTreeCtrl::SetItemTextColour(const wxTreeItemId& item, { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - wxTreeItemAttr *attr; + wxItemAttr *attr; wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem); if ( it == m_attrs.end() ) { m_hasAnyAttr = true; m_attrs[item.m_pItem] = - attr = new wxTreeItemAttr; + attr = new wxItemAttr; } else { @@ -1170,14 +1171,14 @@ void wxTreeCtrl::SetItemBackgroundColour(const wxTreeItemId& item, { wxCHECK_RET( item.IsOk(), wxT("invalid tree item") ); - wxTreeItemAttr *attr; + wxItemAttr *attr; wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem); if ( it == m_attrs.end() ) { m_hasAnyAttr = true; m_attrs[item.m_pItem] = - attr = new wxTreeItemAttr; + attr = new wxItemAttr; } 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") ); - wxTreeItemAttr *attr; + wxItemAttr *attr; wxMapTreeAttr::iterator it = m_attrs.find(item.m_pItem); if ( it == m_attrs.end() ) { m_hasAnyAttr = true; m_attrs[item.m_pItem] = - attr = new wxTreeItemAttr; + attr = new wxItemAttr; } else // already in the hash { @@ -3550,7 +3551,7 @@ bool wxTreeCtrl::MSWOnNotify(int idCtrl, WXLPARAM lParam, WXLPARAM *result) break; } - wxTreeItemAttr * const attr = it->second; + wxItemAttr * const attr = it->second; wxTreeViewItem tvItem((void *)nmcd.dwItemSpec, TVIF_STATE, TVIS_DROPHILITED);