BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lvgl
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
lvgl
Commits
398d5e32
Commit
398d5e32
authored
Jan 16, 2017
by
Gabor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lv_mbox: minor updates
parent
df47565b
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
51 additions
and
53 deletions
+51
-53
lv_app_notice.c
lv_app/lv_app_util/lv_app_notice.c
+1
-1
lv_mbox.c
lv_objx/lv_mbox.c
+34
-36
lv_mbox.h
lv_objx/lv_mbox.h
+16
-16
No files found.
lv_app/lv_app_util/lv_app_notice.c
View file @
398d5e32
...
...
@@ -74,7 +74,7 @@ lv_obj_t * lv_app_notice_add(const char * format, ...)
mbox
=
lv_mbox_create
(
notice_h
,
NULL
);
lv_obj_set_style
(
mbox
,
lv_mboxs_get
(
LV_MBOXS_INFO
,
NULL
));
lv_mbox_set_title
(
mbox
,
""
);
lv_mbox_set_txt
(
mbox
,
txt
);
lv_mbox_set_t
e
xt
(
mbox
,
txt
);
lv_obj_set_opa
(
mbox
,
app_style
->
menu_opa
);
#if LV_APP_NOTICE_SHOW_TIME != 0
...
...
lv_objx/lv_mbox.c
View file @
398d5e32
...
...
@@ -202,6 +202,37 @@ bool lv_mbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
*====================*/
/**
* Set the title of the message box
* @param mbox pointer to a message box
* @param title a '\0' terminated character string which will be the message box title
*/
void
lv_mbox_set_title
(
lv_obj_t
*
mbox
,
const
char
*
title
)
{
lv_mbox_ext_t
*
ext
=
lv_obj_get_ext
(
mbox
);
lv_label_set_text
(
ext
->
title
,
title
);
/*Hide the title if it is an empty text*/
if
(
title
[
0
]
==
'\0'
)
lv_obj_set_hidden
(
ext
->
title
,
true
);
else
if
(
lv_obj_get_hidden
(
ext
->
title
)
!=
false
)
lv_obj_set_hidden
(
ext
->
title
,
false
);
lv_mbox_realign
(
mbox
);
}
/**
* Set the text of the message box
* @param mbox pointer to a message box
* @param txt a '\0' terminated character string which will be the message box text
*/
void
lv_mbox_set_text
(
lv_obj_t
*
mbox
,
const
char
*
txt
)
{
lv_mbox_ext_t
*
ext
=
lv_obj_get_ext
(
mbox
);
lv_label_set_text
(
ext
->
txt
,
txt
);
lv_mbox_realign
(
mbox
);
}
/**
* Add a button to the message box
* @param mbox pointer to message box object
* @param btn_txt the text of the button
...
...
@@ -242,15 +273,15 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
* A release action which can be assigned to a message box button to close it
* @param btn pointer to the released button
* @param dispi pointer to the caller display input
* @return always
false
because the button is deleted with the mesage box
* @return always
lv_action_res_t
because the button is deleted with the mesage box
*/
bool
lv_mbox_close_action
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
lv_action_res_t
lv_mbox_close_action
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
)
{
lv_obj_t
*
mbox
=
lv_mbox_get_from_btn
(
btn
);
lv_obj_del
(
mbox
);
return
false
;
return
LV_ACTION_RES_INV
;
}
/**
...
...
@@ -273,39 +304,6 @@ void lv_mbox_auto_close(lv_obj_t * mbox, uint16_t tout)
#endif
}
/**
* Set the title of the message box
* @param mbox pointer to a message box
* @param title a '\0' terminated character string which will be the message box title
*/
void
lv_mbox_set_title
(
lv_obj_t
*
mbox
,
const
char
*
title
)
{
lv_mbox_ext_t
*
ext
=
lv_obj_get_ext
(
mbox
);
lv_label_set_text
(
ext
->
title
,
title
);
/*Hide the title if it is an empty text*/
if
(
title
[
0
]
==
'\0'
)
lv_obj_set_hidden
(
ext
->
title
,
true
);
else
if
(
lv_obj_get_hidden
(
ext
->
title
)
!=
false
)
lv_obj_set_hidden
(
ext
->
title
,
false
);
lv_mbox_realign
(
mbox
);
}
/**
* Set the text of the message box
* @param mbox pointer to a message box
* @param txt a '\0' terminated character string which will be the message box text
*/
void
lv_mbox_set_txt
(
lv_obj_t
*
mbox
,
const
char
*
txt
)
{
lv_mbox_ext_t
*
ext
=
lv_obj_get_ext
(
mbox
);
lv_label_set_text
(
ext
->
txt
,
txt
);
lv_mbox_realign
(
mbox
);
}
/*=====================
* Getter functions
*====================*/
...
...
lv_objx/lv_mbox.h
View file @
398d5e32
...
...
@@ -93,6 +93,20 @@ lv_obj_t * lv_mbox_create(lv_obj_t * par, lv_obj_t * copy);
bool
lv_mbox_signal
(
lv_obj_t
*
mbox
,
lv_signal_t
sign
,
void
*
param
);
/**
* Set the title of the message box
* @param mbox pointer to a message box
* @param title a '\0' terminated character string which will be the message box title
*/
void
lv_mbox_set_title
(
lv_obj_t
*
mbox
,
const
char
*
title
);
/**
* Set the text of the message box
* @param mbox pointer to a message box
* @param txt a '\0' terminated character string which will be the message box text
*/
void
lv_mbox_set_text
(
lv_obj_t
*
mbox
,
const
char
*
txt
);
/**
* Add a button to the message box
* @param mbox pointer to message box object
* @param btn_txt the text of the button
...
...
@@ -105,9 +119,9 @@ lv_obj_t * lv_mbox_add_btn(lv_obj_t * mbox, const char * btn_txt, lv_action_t re
* A release action which can be assigned to a message box button to close it
* @param btn pointer to the released button
* @param dispi pointer to the caller display input
* @return always
false because the button is deleted with the me
sage box
* @return always
LV_ACTION_RES_INV because the button is deleted with the mes
sage box
*/
bool
lv_mbox_close_action
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
);
lv_action_res_t
lv_mbox_close_action
(
lv_obj_t
*
btn
,
lv_dispi_t
*
dispi
);
/**
* Automatically delete the message box after a given time
...
...
@@ -117,20 +131,6 @@ bool lv_mbox_close_action(lv_obj_t * btn, lv_dispi_t * dispi);
void
lv_mbox_auto_close
(
lv_obj_t
*
mbox
,
uint16_t
tout
);
/**
* Set the title of the message box
* @param mbox pointer to a message box
* @param title a '\0' terminated character string which will be the message box title
*/
void
lv_mbox_set_title
(
lv_obj_t
*
mbox
,
const
char
*
title
);
/**
* Set the text of the message box
* @param mbox pointer to a message box
* @param txt a '\0' terminated character string which will be the message box text
*/
void
lv_mbox_set_txt
(
lv_obj_t
*
mbox
,
const
char
*
txt
);
/**
* get the title of the message box
* @param mbox pointer to a message box object
* @return pointer to the title of the message box
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment