Ticket #3161: tabview.diff
File tabview.diff, 2.7 KB (added by , 16 years ago) |
---|
-
src/kits/interface/TabView.cpp
10 10 11 11 #include <string.h> 12 12 13 #include <LayoutUtils.h> 13 14 #include <List.h> 14 15 #include <Message.h> 15 16 #include <PropertyInfo.h> … … 131 132 if (!owner || !View() || !owner->Window()) 132 133 return; 133 134 135 BRect viewBounds(fView->Bounds()); 136 BRect ownerBounds(owner->Bounds()); 134 137 owner->AddChild(fView); 138 if (viewBounds.Width() == 0 && viewBounds.Height() == 0 139 && ownerBounds.Width() > 0 && ownerBounds.Height() > 0) { 140 fView->ResizeTo(ownerBounds.Width(), ownerBounds.Height()); 141 } 135 142 //fView->Show(); 136 143 137 144 fSelected = true; … … 913 920 void 914 921 BTabView::GetPreferredSize(float *width, float *height) 915 922 { 916 BView::GetPreferredSize(width, height); 923 BSize size = PreferredSize(); 924 if (width) { 925 *width = size.width; 926 } 927 928 if (height) { 929 *height = size.height; 930 } 917 931 } 918 932 919 933 920 934 void 921 935 BTabView::ResizeToPreferred() 922 936 { 923 BView::ResizeToPreferred(); 937 BSize size = PreferredSize(); 938 ResizeTo(size.width, size.height); 924 939 } 925 940 926 941 942 BSize 943 BTabView::MinSize() 944 { 945 BSize size; 946 947 if (CountTabs()) 948 size = TabAt(0)->View()->MinSize(); 949 950 size.height += TabHeight() + 6.0f; 951 size.width += 6.0f; 952 953 return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); 954 } 955 956 957 BSize 958 BTabView::MaxSize() 959 { 960 return BLayoutUtils::ComposeSize(ExplicitMaxSize(), 961 BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); 962 } 963 964 965 BSize 966 BTabView::PreferredSize() 967 { 968 BSize size; 969 970 if (CountTabs()) 971 size = TabAt(0)->View()->PreferredSize(); 972 973 size.height += TabHeight() + 6.0f; 974 size.width += 6.0f; 975 976 return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size); 977 } 978 979 927 980 BHandler * 928 981 BTabView::ResolveSpecifier(BMessage *message, int32 index, 929 982 BMessage *specifier, int32 what, const char *property) -
headers/os/interface/TabView.h
150 150 virtual void SetFlags(uint32 flags); 151 151 virtual void SetResizingMode(uint32 mode); 152 152 153 virtual void GetPreferredSize(float *width, float *height); 154 virtual void ResizeToPreferred(); 155 153 virtual void ResizeToPreferred(); 154 virtual void GetPreferredSize(float* width, float* height); 155 156 virtual BSize MinSize(); 157 virtual BSize MaxSize(); 158 virtual BSize PreferredSize(); 159 156 160 virtual BHandler *ResolveSpecifier(BMessage *message, int32 index, 157 161 BMessage *specifier, int32 what, const char *property); 158 162 virtual status_t GetSupportedSuites(BMessage *message);