1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_UTILITIES_H_
6 #define CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_UTILITIES_H_
8 #import <Cocoa/Cocoa.h>
10 // InfoBarUtilities provide helper functions to construct infobars with
11 // similar appearance.
12 namespace InfoBarUtilities
{
14 // Move the |toMove| view |spacing| pixels before/after the |anchor| view.
15 // |after| signifies the side of |anchor| on which to place |toMove|.
16 void MoveControl(NSView
* anchor
, NSView
* toMove
, int spacing
, bool after
);
18 // Vertically center |toMove| in its container.
19 void VerticallyCenterView(NSView
*toMove
);
21 // Check that the control |before| is ordered visually before the |after|
22 // control. Also, check that there is space between them.
23 bool VerifyControlOrderAndSpacing(id before
, id after
);
25 // Creates a label control in the style we need for the infobar's labels
27 NSTextField
* CreateLabel(NSRect bounds
);
29 // Adds an item with the specified properties to |menu|.
30 void AddMenuItem(NSMenu
*menu
, id target
, SEL selector
, NSString
* title
,
31 int tag
, bool enabled
, bool checked
);
33 } // namespace InfoBarUtilities
35 #endif // CHROME_BROWSER_UI_COCOA_INFOBARS_INFOBAR_UTILITIES_H_