void reveal_t::place(const place_data_t& place_data) { using adobe::place; assert(control_m); if (!using_label_m) { implementation::set_control_bounds(control_m, place_data); } else { place_data_t tmp(place_data); // REVISIT (fbrereto) : hardwired defaults width(tmp) = 16; height(tmp) = 17; implementation::set_control_bounds(control_m, tmp); width(tmp) = width(place_data) - 16 - 4 /* gap */; left(tmp) = left(place_data) + 16 + 4 /* gap */; place(name_m, tmp); } }
void edit_number_t::place(const place_data_t& place_data) { using adobe::place; place_data_t edit_place(place_data); place_data_t popup_place(place_data); if (using_popup()) width(edit_place) = static_cast<long>(edit_text_width_m); place(edit_text_m, edit_place); if (!using_popup()) return; // REVISIT (fbrereto) : constant value long offset(static_cast<long>(edit_text_width_m + 4 /*gap*/)); popup_place.horizontal().guide_set_m.clear(); width(popup_place) -= offset; left(popup_place) += offset; place(popup_m, popup_place); }
void edit_text_t::place(const place_data_t& place_data) { using adobe::place; assert(control_m); place_data_t local_place_data(place_data); long baseline = local_place_data.vertical().guide_set_m[0]; if (using_label_m) { // // We're using a label. We need to extract the label width from the // points of interest in the given geometry, and make sure that we // correctly translate the label for baseline alignment. // place_data_t label_place_data; label_place_data.horizontal().position_m = left(local_place_data); label_place_data.vertical().position_m = top(local_place_data); // // We stored the height of the label in best_bounds. The width of // the label can be discovered via the first horizontal point of // interest. // height(label_place_data) = static_height_m; width(label_place_data) = local_place_data.horizontal().guide_set_m[0]; // // Translate the label vertically for baseline alignment with the // edit widget. We stored the label's baseline in best_bounds. // label_place_data.vertical().position_m += baseline - static_baseline_m; place(get_label(), label_place_data); local_place_data.horizontal().position_m += width(label_place_data) + gap; width(local_place_data) -= width(label_place_data) + gap; } // // We might need to translate the edit widget vertically, for baseline // alignment. // local_place_data.vertical().position_m += baseline - edit_baseline_m; // REVISIT (thw) : Do we need to adapt the height for baseline alignment? implementation::set_control_bounds(control_m, local_place_data); }
void edit_text_t::place(const place_data_t& place_data) { using adobe::place; assert(control_m); place_data_t placement(place_data); long baseline(place_data.vertical().guide_set_m.empty() ? 0 : place_data.vertical().guide_set_m[0]); if (using_label_m) { place_data_t label_placement; top(label_placement) = top(place_data); left(label_placement) = left(place_data); height(label_placement) = static_height_m; width(label_placement) = place_data.horizontal().guide_set_m[0]; top(label_placement) += baseline - static_baseline_m; place(get_label(), label_placement); left(placement) += width(label_placement) + implementation::global_metrics()(implementation::k_metric_gap); width(placement) -= width(label_placement) + implementation::global_metrics()(implementation::k_metric_gap); } top(placement) += baseline - edit_baseline_m; if (scrollable_m) { implementation::shed_fudges(*this, placement); implementation::set_bounds(scroll_control_m, to_Rect(placement)); } else { implementation::set_bounds(*this, placement); } }
void popup_t::place(const place_data_t& place_data) { using adobe::place; assert(control_m); place_data_t local_place_data(place_data); // // If we have a label then we need to allocate space for it // out of the space we have been given. // if (using_label_m) { // // The vertical offset of the label is the geometry's // baseline - the label's baseline. // assert(place_data.vertical().guide_set_m.empty() == false); long baseline = place_data.vertical().guide_set_m[0]; // // Apply the vertical offset. // place_data_t label_place_data; label_place_data.horizontal().position_m = left(place_data); label_place_data.vertical().position_m = top(place_data) + (baseline - static_baseline_m); // // The width of the label is the first horizontal // point of interest. // assert(place_data.horizontal().guide_set_m.empty() == false); width(label_place_data) = place_data.horizontal().guide_set_m[0]; height(label_place_data) = static_height_m; // // Set the label dimensions. // place(name_m, label_place_data); // // Now we need to adjust the position of the popup // widget. // long width = gap + adobe::width(label_place_data); local_place_data.horizontal().position_m += width; adobe::width(local_place_data) -= width; } // // On Win32, you give a combo box the height it should have // when it's fully extended (which seems a bit like a hackish // implementation detail poking through). Here we ensure that // the combo box is maximally the size of 10 elements (so that // we don't go over the edges of the screen if we have a huge // number of elements). // // REVISIT (ralpht) : fixed value. // height(local_place_data) = height(place_data) + std::min<long>(static_cast<long>((menu_items_m.size() + 1)), 10) * height(place_data); implementation::set_control_bounds(control_m, local_place_data); }