CComponentsFooter: expand button label structs

Allows assigning of result, msg and alias values with label struct.

NOTE: Old button label struct are compatible but limited only and
not recommended for usage!
Old parameters 'struct button_label' doesn't provide newer parameters.
Missing parameters are filled with default values and must be assigned
afterward, if required.


Origin commit data
------------------
Branch: ni/coolstream
Commit: 5ae495716e
Author: Thilo Graf <dbt@novatux.de>
Date: 2014-08-26 (Tue, 26 Aug 2014)



------------------
This commit was generated by Migit
This commit is contained in:
2014-08-26 23:05:49 +02:00
committed by [CST] Focus
parent e957c94172
commit 7ee49b7798
2 changed files with 55 additions and 11 deletions

View File

@@ -24,7 +24,6 @@
#ifndef __CC_FORM_FOOTER_H__
#define __CC_FORM_FOOTER_H__
#include "cc_frm_header.h"
#include "cc_frm_button.h"
#include <gui/widget/buttons.h> //for compatibility with 'button_label' type
@@ -34,17 +33,28 @@ typedef struct button_label_s
{
const char * button;
std::string text;
neutrino_msg_t btn_msg;
int btn_result;
int btn_alias;
} button_label_s_struct;
typedef struct button_label_l
{
const char * button;
neutrino_locale_t locale;
const char * button;
neutrino_locale_t locale;
neutrino_msg_t btn_msg;
int btn_result;
int btn_alias;
} button_label_l_struct;
/*!
CComponentsFooter, sub class of CComponentsHeader provides prepared container for footer
Is mostly usable like a header but without caption, and context button icons.
It's usable like a header but without caption, and context button icons as default.
Additional implemented is a button container (chain) and some methods which can add
buttons via struct, vector or text and icon parameters. Also a compatible but limited methode
to add button labels known by older button handler, to find in gui/widget/buttons.h/cpp.
functionality. Why limited ?: old parameter 'struct button_label' doesn't provide newer parameters.
Missing parameters are filled with default values and must be assigned afterward, if required.
*/
class CComponentsFooter : public CComponentsHeader
{
@@ -86,13 +96,13 @@ class CComponentsFooter : public CComponentsHeader
void setButtonLabels(const std::vector<button_label_s>v_content, const int& chain_width, const int& label_width);
///add button labels with old label type, count as size_t, chain_width as int, label width as int
///NOTE: for compatibility with older button handler find in gui/widget/buttons.h
///NOTE: for compatibility with older button handler find in gui/widget/buttons.h, if possible, don't use this
void setButtonLabels(const struct button_label * const content, const size_t& label_count, const int& chain_width = 0, const int& label_width = 0);
///add single button label with string label type as content, chain_width as int, label width as int
void setButtonLabel(const char *button_icon, const std::string& text, const int& chain_width = 0, const int& label_width = 0);
void setButtonLabel(const char *button_icon, const std::string& text, const int& chain_width = 0, const int& label_width = 0, const neutrino_msg_t& msg = CRCInput::RC_nokey, const int& result_value = -1, const int& alias_value = -1);
///add single button label with locale label type as content, chain_width as int, label width as int
void setButtonLabel(const char *button_icon, const neutrino_locale_t& locale, const int& chain_width = 0, const int& label_width = 0);
void setButtonLabel(const char *button_icon, const neutrino_locale_t& locale, const int& chain_width = 0, const int& label_width = 0, const neutrino_msg_t& msg = CRCInput::RC_nokey, const int& result_value = -1, const int& alias_value = -1);
///causes show/hide countour of button frame and background, parameter bool show, default= true
void showButtonContour(bool show = true);
@@ -101,6 +111,8 @@ class CComponentsFooter : public CComponentsHeader
void setSelectedButton(size_t item_id);
///returns id of select button, return value as int, -1 = nothing is selected
int getSelectedButton();
///returns selected button object, return value as pointer to object, NULL means nothing is selected
CComponentsButton* getSelectedButtonObject();
///property: set font for label caption, parameter as font object, value NULL causes usage of dynamic font
void setButtonFont(Font* font){ccf_btn_font = font;};