Home | History | Annotate | Download | only in toolbar
      1 // Copyright (c) 2011 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.
      4 
      5 #ifndef CHROME_BROWSER_UI_COCOA_TOOLBAR_RELOAD_BUTTON_H_
      6 #define CHROME_BROWSER_UI_COCOA_TOOLBAR_RELOAD_BUTTON_H_
      7 
      8 #import <Cocoa/Cocoa.h>
      9 
     10 #import "chrome/browser/ui/cocoa/image_button_cell.h"
     11 #import "chrome/browser/ui/cocoa/toolbar/toolbar_button.h"
     12 
     13 // ToolbarButton subclass which defers certain state changes when the mouse
     14 // is hovering over it.
     15 
     16 @interface ReloadButton : ToolbarButton<ImageButton> {
     17  @private
     18   // Timer used when setting reload mode while the mouse is hovered.
     19   NSTimer* pendingReloadTimer_;
     20 }
     21 
     22 // Update the tag, and the image and tooltip to match.  If |anInt|
     23 // matches the current tag, no action is taken.  |anInt| must be
     24 // either |IDC_STOP| or |IDC_RELOAD|.
     25 - (void)updateTag:(NSInteger)anInt;
     26 
     27 // Update the button to be a reload button or stop button depending on
     28 // |isLoading|.  If |force|, always sets the indicated mode.  If
     29 // |!force|, and the mouse is over the button, defer the transition
     30 // from stop button to reload button until the mouse has left the
     31 // button, or until |pendingReloadTimer_| fires.  This prevents an
     32 // inadvertent click _just_ as the state changes.
     33 - (void)setIsLoading:(BOOL)isLoading force:(BOOL)force;
     34 
     35 @end
     36 
     37 #endif  // CHROME_BROWSER_UI_COCOA_TOOLBAR_RELOAD_BUTTON_H_
     38