Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(290)

Unified Diff: ui/views/views_delegate.h

Issue 2696263002: Refactor ViewsDelegate and MD-ify the icon-to-text spacing for checkbox and radiobutton (Closed)
Patch Set: Used ifdef instead of duplicated code for delegate initialization Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/layout/layout_constants.h ('k') | ui/views/views_delegate.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/views_delegate.h
diff --git a/ui/views/views_delegate.h b/ui/views/views_delegate.h
index 7b3960f5c7c0a5be23772d6cc4b7d72f7064d5c2..6a784af5fabab6edee098c241b1e1f4e09ff8352 100644
--- a/ui/views/views_delegate.h
+++ b/ui/views/views_delegate.h
@@ -58,6 +58,35 @@ namespace internal {
class NativeWidgetDelegate;
}
+enum class InsetsMetric {
+ // The margins that should be applied around a bubble dialog.
+ BUBBLE_DIALOG,
+ // The insets that should be applied around a DialogClientView. Note that
+ // the top inset is used for the distance between the buttons and the
+ // DialogClientView's content view.
+ DIALOG_BUTTON,
+ // The insets that should be applied around a dialog's frame view.
+ DIALOG_FRAME_VIEW,
+};
+
+enum class DistanceMetric {
+ // The default padding to add on each side of a button's label.
+ BUTTON_HORIZONTAL_PADDING,
+ // The distance between a dialog's edge and the close button in the upper
+ // trailing corner.
+ CLOSE_BUTTON_MARGIN,
+ // The default minimum width of a dialog button.
+ DIALOG_BUTTON_MINIMUM_WIDTH,
+ // The spacing between a pair of related horizontal buttons, used for
+ // dialog layout.
+ RELATED_BUTTON_HORIZONTAL,
+ // Horizontal spacing between controls that are logically related.
+ RELATED_CONTROL_HORIZONTAL,
+ // The spacing between a pair of related vertical controls, used for
+ // dialog layout.
+ RELATED_CONTROL_VERTICAL,
+};
+
// ViewsDelegate is an interface implemented by an object using the views
// framework. It is used to obtain various high level application utilities
// and perform some actions such as window placement saving.
@@ -196,37 +225,12 @@ class VIEWS_EXPORT ViewsDelegate {
// Returns a blocking pool task runner given a TaskRunnerType.
virtual scoped_refptr<base::TaskRunner> GetBlockingPoolTaskRunner();
- // Returns the insets that should be applied around a DialogClientView. Note
- // that the top inset is used for the distance between the buttons and the
- // DialogClientView's content view.
- virtual gfx::Insets GetDialogButtonInsets() const;
-
- // Returns the distance between a dialog's edge and the close button in the
- // upper trailing corner.
- virtual int GetDialogCloseButtonMargin() const;
-
- // Returns the spacing between a pair of related horizontal buttons, used for
- // dialog layout.
- virtual int GetDialogRelatedButtonHorizontalSpacing() const;
-
- // Returns the spacing between a pair of related vertical controls, used for
- // dialog layout.
- virtual int GetDialogRelatedControlVerticalSpacing() const;
-
- // Returns the insets that should be applied around a dialog's frame view.
- virtual gfx::Insets GetDialogFrameViewInsets() const;
-
- // Returns the margins that should be applied around a bubble dialog.
- virtual gfx::Insets GetBubbleDialogMargins() const;
-
- // Returns the default minimum width of a button.
- virtual int GetButtonMinimumWidth() const;
-
- // Returns the minimum width of a dialog button.
- virtual int GetDialogButtonMinimumWidth() const;
+ // Returns the insets metric according to the given enumeration element.
+ virtual gfx::Insets GetInsetsMetric(InsetsMetric metric) const;
- // Returns the default padding to add on each side of a button's label.
- virtual int GetButtonHorizontalPadding() const;
+ // Returns the distance metric between elements according to the given
+ // enumeration element.
+ virtual int GetDistanceMetric(DistanceMetric metric) const;
protected:
ViewsDelegate();
« no previous file with comments | « ui/views/layout/layout_constants.h ('k') | ui/views/views_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698