1 /* 2 This file is part of Telegram Desktop, 3 the official desktop application for the Telegram messaging service. 4 5 For license and copyright information please follow this link: 6 https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL 7 */ 8 #pragma once 9 10 #include "ui/rp_widget.h" 11 #include "payments/ui/payments_panel_data.h" 12 #include "base/object_ptr.h" 13 14 namespace Ui { 15 class ScrollArea; 16 class FadeShadow; 17 class RoundButton; 18 class InputField; 19 class MaskedInputField; 20 class Checkbox; 21 } // namespace Ui 22 23 namespace Payments::Ui { 24 25 using namespace ::Ui; 26 27 class PanelDelegate; 28 class Field; 29 30 class EditInformation final : public RpWidget { 31 public: 32 EditInformation( 33 QWidget *parent, 34 const Invoice &invoice, 35 const RequestedInformation ¤t, 36 InformationField field, 37 not_null<PanelDelegate*> delegate); 38 ~EditInformation(); 39 40 void setFocus(InformationField field); 41 void setFocusFast(InformationField field); 42 void showError(InformationField field); 43 44 private: 45 void resizeEvent(QResizeEvent *e) override; 46 void focusInEvent(QFocusEvent *e) override; 47 48 void setupControls(); 49 [[nodiscard]] not_null<Ui::RpWidget*> setupContent(); 50 void updateControlsGeometry(); 51 [[nodiscard]] Field *lookupField(InformationField field) const; 52 53 [[nodiscard]] RequestedInformation collect() const; 54 55 const not_null<PanelDelegate*> _delegate; 56 Invoice _invoice; 57 RequestedInformation _information; 58 59 object_ptr<ScrollArea> _scroll; 60 object_ptr<FadeShadow> _topShadow; 61 object_ptr<FadeShadow> _bottomShadow; 62 object_ptr<RoundButton> _submit; 63 object_ptr<RoundButton> _cancel; 64 65 std::unique_ptr<Field> _street1; 66 std::unique_ptr<Field> _street2; 67 std::unique_ptr<Field> _city; 68 std::unique_ptr<Field> _state; 69 std::unique_ptr<Field> _country; 70 std::unique_ptr<Field> _postcode; 71 std::unique_ptr<Field> _name; 72 std::unique_ptr<Field> _email; 73 std::unique_ptr<Field> _phone; 74 Checkbox *_save = nullptr; 75 76 InformationField _focusField = InformationField::ShippingStreet; 77 78 }; 79 80 } // namespace Payments::Ui 81