1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef LISTVIEWBUILDER_HXX_INCLUDED 25 #define LISTVIEWBUILDER_HXX_INCLUDED 26 27 //------------------------------------ 28 // include 29 //------------------------------------ 30 31 #if defined _MSC_VER 32 #pragma warning(push, 1) 33 #endif 34 #include <windows.h> 35 #if defined _MSC_VER 36 #pragma warning(pop) 37 #endif 38 39 #include <string> 40 #include <memory> 41 #include "document_statistic.hxx" 42 43 //------------------------------------ 44 // 45 //------------------------------------ 46 47 class list_view_builder; 48 typedef std::auto_ptr<list_view_builder> list_view_builder_ptr; 49 50 // factory method for list_view_builder 51 list_view_builder_ptr create_list_view_builder( 52 HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2); 53 54 //------------------------------------ 55 // 56 //------------------------------------ 57 58 class list_view_builder 59 { 60 public: 61 virtual ~list_view_builder(); 62 63 void build(statistic_group_list_t& gl); 64 65 protected: 66 list_view_builder( 67 HWND hwnd_list_view, 68 const std::wstring& column1_title, 69 const std::wstring& column2_title); 70 71 virtual void setup_list_view(); 72 virtual void insert_group(const std::wstring& title); 73 virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable); 74 75 HWND get_list_view() const; 76 int get_current_row() const; 77 78 int row_index_; 79 80 private: 81 HWND hwnd_list_view_; 82 std::wstring column1_title_; 83 std::wstring column2_title_; 84 85 friend list_view_builder_ptr create_list_view_builder(HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2); 86 }; 87 88 //------------------------------------ 89 // 90 //------------------------------------ 91 92 class winxp_list_view_builder : public list_view_builder 93 { 94 protected: 95 winxp_list_view_builder( 96 HWND hwnd_list_view, 97 const std::wstring& column1_title, 98 const std::wstring& column2_title); 99 100 virtual void setup_list_view(); 101 virtual void insert_group(const std::wstring& name); 102 virtual void insert_item(const std::wstring& title, const std::wstring& value, bool is_editable); 103 104 private: 105 int group_count_; 106 int row_count_; 107 108 friend list_view_builder_ptr create_list_view_builder(HWND hwnd_lv, const std::wstring& col1, const std::wstring& col2); 109 }; 110 111 #endif 112