Changeset 15 in flair-src for trunk/lib/FlairCore/src/Label.cpp
- Timestamp:
- 04/08/16 15:40:57 (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/lib/FlairCore/src/Label.cpp
r2 r15 22 22 using std::string; 23 23 24 namespace flair 25 { 26 namespace gui 27 { 24 namespace flair { 25 namespace gui { 28 26 29 Label::Label(const LayoutPosition * position,string name,size_t buf_size): Widget(position->getLayout(),name,"Label")30 {31 SetVolatileXmlProp("row",position->Row());32 SetVolatileXmlProp("col",position->Col());27 Label::Label(const LayoutPosition *position, string name, size_t buf_size) 28 : Widget(position->getLayout(), name, "Label") { 29 SetVolatileXmlProp("row", position->Row()); 30 SetVolatileXmlProp("col", position->Col()); 33 31 34 32 SendXml(); 35 33 36 printf_buffer=(char*)malloc(buf_size); 37 if(printf_buffer==NULL) Err("erreur malloc\n"); 34 printf_buffer = (char *)malloc(buf_size); 35 if (printf_buffer == NULL) 36 Err("erreur malloc\n"); 38 37 39 38 delete position; 40 39 } 41 40 42 Label::~Label() 43 { 44 if(printf_buffer!=NULL)free(printf_buffer);45 printf_buffer=NULL;41 Label::~Label() { 42 if (printf_buffer != NULL) 43 free(printf_buffer); 44 printf_buffer = NULL; 46 45 } 47 46 47 void Label::SetText(const char *format, ...) { 48 int n; 48 49 49 void Label::SetText(const char * format, ...) 50 { 51 int n; 50 va_list args; 51 va_start(args, format); 52 n = vsprintf(printf_buffer, format, args); 53 va_end(args); 54 if (n <= 0) 55 return; 52 56 53 va_list args; 54 va_start (args, format); 55 n = vsprintf(printf_buffer,format, args); 56 va_end (args); 57 if (n<=0) return; 58 59 SetVolatileXmlProp("value",printf_buffer); 60 SendXml(); 61 57 SetVolatileXmlProp("value", printf_buffer); 58 SendXml(); 62 59 } 63 60
Note:
See TracChangeset
for help on using the changeset viewer.