Ticket #7991: DriveSetup-SizeTextControl-20110916.diff
File DriveSetup-SizeTextControl-20110916.diff, 2.1 KB (added by , 13 years ago) |
---|
-
CreateParamsPanel.cpp
77 77 enum { 78 78 MSG_OK = 'okok', 79 79 MSG_CANCEL = 'cncl', 80 MSG_PARTITION_TYPE = 'type' 80 MSG_PARTITION_TYPE = 'type', 81 MSG_SIZE_SLIDER = 'ssld', 82 MSG_SIZE_TEXTCONTROL = 'stct' 81 83 }; 82 84 83 85 … … 121 123 void 122 124 CreateParamsPanel::MessageReceived(BMessage* message) 123 125 { 126 BString sSizeString; 124 127 switch (message->what) { 125 128 case MSG_CANCEL: 126 129 Cancel(); … … 138 141 fEditor->PartitionTypeChanged(type); 139 142 } 140 143 break; 144 145 case MSG_SIZE_SLIDER: 146 sSizeString << fSizeSlider->Value(); 147 fSizeTextControl->SetText(sSizeString.String()); 148 break; 149 150 case MSG_SIZE_TEXTCONTROL: 151 sSizeString = fSizeTextControl->Text(); 152 fSizeSlider->SetValue(atoi(sSizeString.String())); 153 break; 141 154 142 155 default: 143 156 BWindow::MessageReceived(message); … … 225 238 fSizeSlider = new SizeSlider("Slider", B_TRANSLATE("Partition size"), NULL, 226 239 offset, offset + size); 227 240 fSizeSlider->SetPosition(1.0); 241 fSizeSlider->SetModificationMessage(new BMessage(MSG_SIZE_SLIDER)); 242 243 BString sSizeText; 244 sSizeText << fSizeSlider->Value(); 245 fSizeTextControl = new BTextControl("Size Control", 246 "", sSizeText.String(), NULL); 247 fSizeTextControl->SetModificationMessage(new BMessage(MSG_SIZE_TEXTCONTROL)); 228 248 229 249 fNameTextControl = new BTextControl("Name Control", 230 250 B_TRANSLATE("Partition name:"), "", NULL); … … 257 277 258 278 AddChild(BGroupLayoutBuilder(B_VERTICAL, spacing) 259 279 .Add(fSizeSlider) 280 .Add(fSizeTextControl) 260 281 .Add(BGridLayoutBuilder(0.0, 5.0) 261 282 .Add(fNameTextControl->CreateLabelLayoutItem(), 0, 0) 262 283 .Add(fNameTextControl->CreateTextViewLayoutItem(), 1, 0) -
CreateParamsPanel.h
50 50 BMenuField* fTypeMenuField; 51 51 BTextControl* fNameTextControl; 52 52 SizeSlider* fSizeSlider; 53 BTextControl* fSizeTextControl; 53 54 }; 54 55 55 56 #endif // CREATE_PARAMS_PANEL_H