diff options
author | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-09 19:40:53 +0000 |
---|---|---|
committer | finnur@google.com <finnur@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-09 19:40:53 +0000 |
commit | 40f9788b1c12179b49260aee91fcfe04e219feb4 (patch) | |
tree | 9b9afdc32a1718123d96f931e2db04b2d60b1aeb /chrome/browser/views/about_chrome_view.h | |
parent | e34d9fb94efa09fed30d1179e5f3ec989b23db9e (diff) | |
download | chromium_src-40f9788b1c12179b49260aee91fcfe04e219feb4.zip chromium_src-40f9788b1c12179b49260aee91fcfe04e219feb4.tar.gz chromium_src-40f9788b1c12179b49260aee91fcfe04e219feb4.tar.bz2 |
Changing the About box according to mockups. Basically, we now want to have a paragraph of text with embedded links (to the Chromium project, credits and terms of service).
Review URL: http://codereview.chromium.org/6563
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@3117 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/about_chrome_view.h')
-rw-r--r-- | chrome/browser/views/about_chrome_view.h | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/chrome/browser/views/about_chrome_view.h b/chrome/browser/views/about_chrome_view.h index 1cfd949..e74823e 100644 --- a/chrome/browser/views/about_chrome_view.h +++ b/chrome/browser/views/about_chrome_view.h @@ -41,6 +41,7 @@ class AboutChromeView : public ChromeViews::View, // Overridden from ChromeViews::View: virtual void GetPreferredSize(CSize *out); virtual void Layout(); + virtual void Paint(ChromeCanvas* canvas); virtual void ViewHierarchyChanged(bool is_add, ChromeViews::View* parent, ChromeViews::View* child); @@ -79,14 +80,57 @@ class AboutChromeView : public ChromeViews::View, void UpdateStatus(GoogleUpdateUpgradeResult result, GoogleUpdateErrorCode error_code); + // Draws a string onto the canvas (wrapping if needed) while also keeping + // track of where it ends so we can position a URL after the text. The + // parameter |bounds| represents the boundary we have to work with, |position| + // specifies where to draw the string (relative to the top left corner of the + // |bounds| rectangle and |font| specifies the font to use when drawing. When + // the function returns, the parameter |rect| contains where to draw the URL + // (to the right of where we just drew the text) and |position| is updated to + // reflect where to draw the next string after the URL. + // NOTE: The reason why we need this function is because while Skia knows how + // to wrap text appropriately, it doesn't tell us where it drew the last + // character, which we need to position the URLs within the text. + void DrawTextAndPositionUrl(ChromeCanvas* canvas, + const std::wstring& text, + ChromeViews::Link* link, + gfx::Rect* rect, + CSize* position, + const CRect& bounds, + const ChromeFont& font); + + // A helper function for DrawTextAndPositionUrl, which simply draws the text + // from a certain starting point |position| and wraps within bounds. For + // details on the parameters, see DrawTextAndPositionUrl. + void DrawTextStartingFrom(ChromeCanvas* canvas, + const std::wstring& text, + CSize* position, + const CRect& bounds, + const ChromeFont& font); + + // A simply utility function that calculates whether a word of width + // |word_width| fits at position |position| within the |bounds| rectangle. If + // not, |position| is updated to wrap to the beginning of the next line. + void WrapIfWordDoesntFit(int word_width, + int font_height, + CSize* position, + const CRect& bounds); + Profile* profile_; // UI elements on the dialog. ChromeViews::ImageView* about_dlg_background_; ChromeViews::Label* about_title_label_; ChromeViews::TextField* version_label_; + ChromeViews::Label* copyright_label_; ChromeViews::Label* main_text_label_; - ChromeViews::Link* copyright_url_; + int main_text_label_height_; + ChromeViews::Link* chromium_url_; + gfx::Rect chromium_url_rect_; + ChromeViews::Link* open_source_url_; + gfx::Rect open_source_url_rect_; + ChromeViews::Link* terms_of_service_url_; + gfx::Rect terms_of_service_url_rect_; // UI elements we add to the parent view. scoped_ptr<ChromeViews::Throbber> throbber_; ChromeViews::ImageView success_indicator_; @@ -97,6 +141,15 @@ class AboutChromeView : public ChromeViews::View, // Keeps track of the visible state of the Check For Updates button. CheckButtonStatus check_button_status_; + // The text to display as the main label of the About box. We draw this text + // word for word with the help of the WordIterator, and make room for URLs + // which are drawn using ChromeViews::Link. See also |url_offsets_|. + std::wstring main_label_chunk1_; + std::wstring main_label_chunk2_; + std::wstring main_label_chunk3_; + std::wstring main_label_chunk4_; + std::wstring main_label_chunk5_; + // The class that communicates with Google Update to find out if an update is // available and asks it to start an upgrade. scoped_refptr<GoogleUpdate> google_updater_; @@ -107,7 +160,7 @@ class AboutChromeView : public ChromeViews::View, // The version Google Update reports is available to us. std::wstring new_version_available_; - DISALLOW_EVIL_CONSTRUCTORS(AboutChromeView); + DISALLOW_COPY_AND_ASSIGN(AboutChromeView); }; #endif // CHROME_BROWSER_VIEWS_ABOUT_CHROME_VIEW_H_ |