OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_VIEWS_TABLE_VIEW_H_ | 5 #ifndef CHROME_VIEWS_TABLE_VIEW_H_ |
6 #define CHROME_VIEWS_TABLE_VIEW_H_ | 6 #define CHROME_VIEWS_TABLE_VIEW_H_ |
7 | 7 |
8 #include <windows.h> | 8 #include <windows.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 void SetColumnVisibility(int id, bool is_visible); | 398 void SetColumnVisibility(int id, bool is_visible); |
399 bool IsColumnVisible(int id) const; | 399 bool IsColumnVisible(int id) const; |
400 | 400 |
401 // Resets the size of the columns based on the sizes passed to the | 401 // Resets the size of the columns based on the sizes passed to the |
402 // constructor. Your normally needn't invoked this, it's done for you the | 402 // constructor. Your normally needn't invoked this, it's done for you the |
403 // first time the TableView is given a valid size. | 403 // first time the TableView is given a valid size. |
404 void ResetColumnSizes(); | 404 void ResetColumnSizes(); |
405 | 405 |
406 // Sometimes we may want to size the TableView to a specific width and | 406 // Sometimes we may want to size the TableView to a specific width and |
407 // height. | 407 // height. |
408 void SetPreferredSize(const CSize& preferred_size); | 408 virtual gfx::Size GetPreferredSize(); |
409 virtual void GetPreferredSize(CSize* out); | 409 void set_preferred_size(const gfx::Size& size) { preferred_size_ = size; } |
410 | 410 |
411 // Is the table sorted? | 411 // Is the table sorted? |
412 bool is_sorted() const { return !sort_descriptors_.empty(); } | 412 bool is_sorted() const { return !sort_descriptors_.empty(); } |
413 | 413 |
414 // Maps from the index in terms of the model to that of the view. | 414 // Maps from the index in terms of the model to that of the view. |
415 int model_to_view(int model_index) const { | 415 int model_to_view(int model_index) const { |
416 return model_to_view_.get() ? model_to_view_[model_index] : model_index; | 416 return model_to_view_.get() ? model_to_view_[model_index] : model_index; |
417 } | 417 } |
418 | 418 |
419 // Maps from the index in terms of the view to that of the model. | 419 // Maps from the index in terms of the view to that of the model. |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 // Window procedure of the listview before we subclassed it. | 620 // Window procedure of the listview before we subclassed it. |
621 WNDPROC original_handler_; | 621 WNDPROC original_handler_; |
622 | 622 |
623 // A wrapper around 'this' used when "subclassing" the list view and header. | 623 // A wrapper around 'this' used when "subclassing" the list view and header. |
624 TableViewWrapper table_view_wrapper_; | 624 TableViewWrapper table_view_wrapper_; |
625 | 625 |
626 // A custom font we use when overriding the font type for a specific cell. | 626 // A custom font we use when overriding the font type for a specific cell. |
627 HFONT custom_cell_font_; | 627 HFONT custom_cell_font_; |
628 | 628 |
629 // The preferred size of the table view. | 629 // The preferred size of the table view. |
630 CSize preferred_size_; | 630 gfx::Size preferred_size_; |
631 | 631 |
632 // The offset from the top of the client area to the start of the content. | 632 // The offset from the top of the client area to the start of the content. |
633 int content_offset_; | 633 int content_offset_; |
634 | 634 |
635 // Current sort. | 635 // Current sort. |
636 SortDescriptors sort_descriptors_; | 636 SortDescriptors sort_descriptors_; |
637 | 637 |
638 // Mappings used when sorted. | 638 // Mappings used when sorted. |
639 scoped_array<int> view_to_model_; | 639 scoped_array<int> view_to_model_; |
640 scoped_array<int> model_to_view_; | 640 scoped_array<int> model_to_view_; |
641 | 641 |
642 DISALLOW_COPY_AND_ASSIGN(TableView); | 642 DISALLOW_COPY_AND_ASSIGN(TableView); |
643 }; | 643 }; |
644 | 644 |
645 } // namespace | 645 } // namespace |
646 | 646 |
647 #endif // CHROME_VIEWS_TABLE_VIEW_H_ | 647 #endif // CHROME_VIEWS_TABLE_VIEW_H_ |
OLD | NEW |