CComponentsButton: add localized button

So it's possible to use locales for button caption.


Origin commit data
------------------
Commit: be8e47fe3f
Author: Thilo Graf <dbt@novatux.de>
Date: 2013-09-09 (Mon, 09 Sep 2013)
This commit is contained in:
2013-09-09 21:04:13 +02:00
parent 4c88081c87
commit b637a1bb79
2 changed files with 40 additions and 2 deletions

View File

@@ -26,7 +26,8 @@
#ifndef __CC_BUTTONS_H__
#define __CC_BUTTONS_H__
#include "config.h"
#include <config.h>
#include <global.h>
#include "cc.h"
#include "cc_frm.h"
#include <string>
@@ -75,9 +76,21 @@ class CComponentsButton : public CComponentsForm
const std::string& caption, const std::string& icon_name,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
CComponentsButton( const int x_pos, const int y_pos, const int w, const int h,
const neutrino_locale_t& caption_locale, const std::string& icon_name,
bool selected = false, bool enabled = true, bool has_shadow = CC_SHADOW_OFF,
fb_pixel_t color_frame = COL_LIGHT_GRAY, fb_pixel_t color_body = COL_MENUCONTENT_PLUS_0, fb_pixel_t color_shadow = COL_MENUCONTENTDARK_PLUS_0);
///set text color
virtual void setButtonTextColor(fb_pixel_t caption_color){cc_btn_capt_col = caption_color;};
///set caption: parameter as string
virtual void setCaption(const std::string& text){cc_btn_capt = text;};
///set caption: parameter as locale
virtual void setCaption(const neutrino_locale_t locale_text){cc_btn_capt = g_Locale->getText(locale_text);};
///reinitialize items
virtual void Refresh(){initCCBtnItems();};
///paint button object
void paint(bool do_save_bg = CC_SAVE_SCREEN_YES);
@@ -151,5 +164,4 @@ class CComponentsButtonBlue : public CComponentsButton
};
};
#endif /*__CC_BUTTONS_H__*/