gui.h File Reference

#include <windows.h>

Go to the source code of this file.

Data Structures

struct  s_gui_tab_layout
struct  s_gui_tab_layout_item

Defines

#define GUI_BACKGROUND_COLOR_COMBOBOX   BACKGROUND_COLOR
#define GUI_BACKGROUND_COLOR_EDIT   RGB(255, 255, 255)
#define GUI_BACKGROUND_COLOR_SCROLLBAR   BACKGROUND_COLOR
#define GUI_BACKGROUND_COLOR_STATIC   BACKGROUND_COLOR
#define GUI_FOREGROUND_COLOR_COMBOBOX   RGB(255, 255, 255)
#define GUI_FOREGROUND_COLOR_EDIT   RGB(0, 0, 0)
#define GUI_FOREGROUND_COLOR_SCROLLBAR   RGB(255, 255, 255)
#define GUI_FOREGROUND_COLOR_STATIC   RGB(255, 255, 255)
#define GUI_TAB_ADD_ENTRY(gui_layout, new_x, new_y, new_width, new_height, new_value, new_type, _new_str, new_style, _function_proc)
#define GUI_TYPE_BUTTON   2
#define GUI_TYPE_COMBOBOX   5
#define GUI_TYPE_EDIT   4
#define GUI_TYPE_IMAGE   1
#define GUI_TYPE_PAINT   7
#define GUI_TYPE_RICHEDIT   6
#define GUI_TYPE_STATIC   3

Typedefs

typedef LRESULT CALLBACK(* obj_proc )(HWND, UINT, WPARAM, LPARAM)

Functions

void gui_create (s_gui_tab_layout *_gui_layout, HWND hwnd)
void gui_delete_tab_layout (s_gui_tab_layout *_gui_layout)
void gui_move (s_gui_tab_layout *_gui_layout, int x, int y)
void gui_new_tab_layout (s_gui_tab_layout *_gui_layout, int max_elements)
LRESULT CALLBACK gui_proc (s_gui_tab_layout *_gui_layout, HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
void gui_rescale (s_gui_tab_layout *_gui_layout, float scale_x, float scale_y, BOOL repaint)
void gui_set_font (s_gui_tab_layout_item *_gui_item, char *_name, int height, BOOL bolt, BOOL italic, BOOL underlined)
void gui_visibility (s_gui_tab_layout *_gui_layout, BOOL visible)
void gui_visibility_item (s_gui_tab_layout_item *_gui_item, BOOL visible)


Define Documentation

#define GUI_BACKGROUND_COLOR_COMBOBOX   BACKGROUND_COLOR

Definition at line 62 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_proc().

#define GUI_BACKGROUND_COLOR_EDIT   RGB(255, 255, 255)

Definition at line 60 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_proc().

#define GUI_BACKGROUND_COLOR_SCROLLBAR   BACKGROUND_COLOR

#define GUI_BACKGROUND_COLOR_STATIC   BACKGROUND_COLOR

Definition at line 58 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_proc().

#define GUI_FOREGROUND_COLOR_COMBOBOX   RGB(255, 255, 255)

Definition at line 61 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_proc().

#define GUI_FOREGROUND_COLOR_EDIT   RGB(0, 0, 0)

Definition at line 59 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_proc().

#define GUI_FOREGROUND_COLOR_SCROLLBAR   RGB(255, 255, 255)

#define GUI_FOREGROUND_COLOR_STATIC   RGB(255, 255, 255)

Definition at line 57 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_proc().

#define GUI_TAB_ADD_ENTRY ( gui_layout,
new_x,
new_y,
new_width,
new_height,
new_value,
new_type,
_new_str,
new_style,
_function_proc   ) 

Value:

{  gui_layout._gui_item[gui_layout.nb_elements].type = new_type; \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements].x = new_x; \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements].y = new_y; \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements].width = new_width; \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements].height = new_height; \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements].value = new_value; \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements].style = new_style; \
                                                                                                                           strncpy(gui_layout._gui_item[gui_layout.nb_elements]._str, _new_str, 20); \
                                                                                                                           gui_layout._gui_item[gui_layout.nb_elements]._f_proc = (obj_proc) _function_proc; \
                                                                                                                           gui_layout.nb_elements++; \
                                                                                                                           }

Definition at line 46 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by WindowProcedure().

#define GUI_TYPE_BUTTON   2

Definition at line 38 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_create().

#define GUI_TYPE_COMBOBOX   5

#define GUI_TYPE_EDIT   4

Definition at line 40 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_create(), and gui_proc().

#define GUI_TYPE_IMAGE   1

Definition at line 37 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_create().

#define GUI_TYPE_PAINT   7

#define GUI_TYPE_RICHEDIT   6

Definition at line 42 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_create(), and gui_proc().

#define GUI_TYPE_STATIC   3

Definition at line 39 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.h.

Referenced by gui_create(), and gui_proc().


Typedef Documentation

typedef LRESULT CALLBACK(* obj_proc)(HWND, UINT, WPARAM, LPARAM)


Function Documentation

void gui_create ( s_gui_tab_layout _gui_layout,
HWND  hwnd 
)

Definition at line 164 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout::_gui_item, s_gui_tab_layout_item::_str, s_gui_tab_layout_item::actif, ASSERT, get_path(), GUI_TYPE_BUTTON, GUI_TYPE_COMBOBOX, GUI_TYPE_EDIT, GUI_TYPE_IMAGE, GUI_TYPE_PAINT, GUI_TYPE_RICHEDIT, GUI_TYPE_STATIC, s_gui_tab_layout_item::height, s_gui_tab_layout_item::hwnd, s_gui_tab_layout::hwnd, s_gui_tab_layout_item::id, s_gui_tab_layout::nb_elements, s_gui_tab_layout::scale_x, s_gui_tab_layout::scale_y, s_gui_tab_layout_item::style, TRUE, s_gui_tab_layout_item::type, s_gui_tab_layout_item::width, s_gui_tab_layout_item::x, and s_gui_tab_layout_item::y.

Referenced by WindowProcedure().

00165 {
00166      int i;
00167      static int id = 1;
00168      s_gui_tab_layout_item *_gui_item;
00169      HANDLE handle;
00170      char _path[MAX_PATH];
00171 
00172      ASSERT(_gui_layout);
00173 
00174      _gui_layout->hwnd = hwnd;
00175      _gui_layout->scale_x = 1.0;
00176      _gui_layout->scale_y = 1.0;
00177      for(i=0; i<_gui_layout->nb_elements; i++)
00178      {
00179                  _gui_item = &_gui_layout->_gui_item[i];
00180                  switch(_gui_item->type)
00181                  {
00182                  case GUI_TYPE_IMAGE:
00183                       _gui_item->style |= WS_CHILD | WS_VISIBLE | SS_BITMAP;
00184                       _gui_item->hwnd = CreateWindowEx(
00185                               SS_BITMAP,
00186                               "STATIC",
00187                               _gui_item->_str,
00188                               _gui_item->style,
00189                               _gui_item->x,
00190                               _gui_item->y,
00191                               _gui_item->width,
00192                               _gui_item->height,
00193                               hwnd,
00194                               (HMENU) id++,
00195                               (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
00196                               NULL);
00197                       ASSERT(_gui_item->hwnd);
00198                       _gui_item->id = GetDlgCtrlID(_gui_item->hwnd);
00199                       get_path(_path, MAX_PATH);
00200                       strcat(_path, "images\\");
00201                       strcat(_path, _gui_item->_str);
00202                       handle = (HANDLE) LoadImage(NULL,
00203                              _path,
00204                              IMAGE_BITMAP,
00205                              0,
00206                              0,
00207                              LR_LOADFROMFILE | LR_DEFAULTSIZE);
00208                       ASSERT(handle);
00209                       SendMessage(_gui_item->hwnd, STM_SETIMAGE, (WPARAM) IMAGE_BITMAP, (LPARAM) handle);
00210                       break;
00211                  case GUI_TYPE_BUTTON:
00212                       _gui_item->style |= WS_BORDER | WS_CHILD | WS_VISIBLE | WS_TABSTOP;
00213                       _gui_item->hwnd = CreateWindowEx(
00214                               0,
00215                               "BUTTON",
00216                               _gui_item->_str,
00217                               _gui_item->style,
00218                               _gui_item->x,
00219                               _gui_item->y,
00220                               _gui_item->width,
00221                               _gui_item->height,
00222                               hwnd,
00223                               (HMENU) id++,
00224                               (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
00225                               NULL);
00226                       ASSERT(_gui_item->hwnd);
00227                       _gui_item->id = GetDlgCtrlID(_gui_item->hwnd);
00228                       break;
00229                  case GUI_TYPE_PAINT:
00230                       break;
00231                  case GUI_TYPE_STATIC:
00232                       _gui_item->style |= WS_CHILD | WS_VISIBLE;
00233                       _gui_item->hwnd = CreateWindowEx(
00234                               0,
00235                               "STATIC",
00236                               _gui_item->_str,
00237                               _gui_item->style,
00238                               _gui_item->x,
00239                               _gui_item->y,
00240                               _gui_item->width,
00241                               _gui_item->height,
00242                               hwnd,
00243                               (HMENU) id++,
00244                               (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
00245                               NULL);
00246                       ASSERT(_gui_item->hwnd);
00247                       _gui_item->id = GetDlgCtrlID(_gui_item->hwnd);
00248                       break;
00249                  case GUI_TYPE_EDIT:
00250                      _gui_item->style |= WS_CHILD | WS_VISIBLE | WS_TABSTOP;
00251                      _gui_item->hwnd = CreateWindowEx(
00252                               0,
00253                               "EDIT",
00254                               _gui_item->_str,
00255                               _gui_item->style | ES_MULTILINE,
00256                               _gui_item->x,
00257                               _gui_item->y,
00258                               _gui_item->width,
00259                               _gui_item->height,
00260                               hwnd,
00261                               (HMENU) id++,
00262                               (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
00263                               NULL);
00264                      ASSERT(_gui_item->hwnd);
00265                      _gui_item->id = GetDlgCtrlID(_gui_item->hwnd);
00266                      break;
00267                  case GUI_TYPE_COMBOBOX:
00268                      _gui_item->style |= WS_VSCROLL | WS_CHILD | WS_TABSTOP | WS_VISIBLE | CBS_SORT | CBS_DROPDOWN;
00269                      _gui_item->hwnd = CreateWindowEx(
00270                               0,
00271                               "COMBOBOX",
00272                               _gui_item->_str,
00273                               _gui_item->style,
00274                               _gui_item->x,
00275                               _gui_item->y,
00276                               _gui_item->width,
00277                               _gui_item->height,
00278                               hwnd,
00279                               (HMENU) id++,
00280                               (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
00281                               NULL);
00282                      ASSERT(_gui_item->hwnd);
00283                      _gui_item->id = GetDlgCtrlID(_gui_item->hwnd);
00284                      break;
00285                  case GUI_TYPE_RICHEDIT:
00286                      _gui_item->style |= WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_BORDER | ES_MULTILINE | WS_HSCROLL | ES_AUTOVSCROLL | ES_NOHIDESEL;
00287                      ASSERT(LoadLibrary("RICHED32.DLL"));
00288                      _gui_item->hwnd = CreateWindowEx(
00289                               WS_EX_CLIENTEDGE,
00290                               RICHEDIT_CLASS,
00291                               _gui_item->_str,
00292                               _gui_item->style,
00293                               _gui_item->x,
00294                               _gui_item->y,
00295                               _gui_item->width,
00296                               _gui_item->height,
00297                               hwnd,
00298                               (HMENU) id++,
00299                               (HINSTANCE) GetWindowLong(hwnd, GWL_HINSTANCE),
00300                               NULL);
00301                      ASSERT(_gui_item->hwnd);
00302                      _gui_item->id = GetDlgCtrlID(_gui_item->hwnd);
00303                      break;                
00304                  }
00305                  _gui_item->actif = TRUE;
00306      }
00307 }

void gui_delete_tab_layout ( s_gui_tab_layout _gui_layout  ) 

Definition at line 153 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout::_gui_item, ASSERT, s_gui_tab_layout_item::hwnd, and s_gui_tab_layout::nb_elements.

Referenced by gui_proc().

00154 {
00155      int i;
00156 
00157      ASSERT(_gui_layout);
00158 
00159      for(i=0; i<_gui_layout->nb_elements; i++)
00160          DestroyWindow(_gui_layout->_gui_item[i].hwnd);
00161      free(_gui_layout->_gui_item);
00162 }

void gui_move ( s_gui_tab_layout _gui_layout,
int  x,
int  y 
)

Definition at line 309 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout::_gui_item, ASSERT, s_gui_tab_layout_item::hwnd, s_gui_tab_layout::nb_elements, s_gui_tab_layout_item::x, and s_gui_tab_layout_item::y.

00310 {
00311      int i, inf_x, inf_y;
00312      int dx, dy;
00313      s_gui_tab_layout_item *_gui_item;
00314 
00315      ASSERT(_gui_layout);
00316 
00317      inf_x = 0xFFFFFF;
00318      inf_y = 0xFFFFFF;
00319      for(i=0; i<_gui_layout->nb_elements; i++)
00320      {
00321          _gui_item = &_gui_layout->_gui_item[i];
00322          inf_x = (inf_x < _gui_item->x)?inf_x:_gui_item->x;
00323          inf_y = (inf_y < _gui_item->y)?inf_y:_gui_item->y;
00324      }
00325 
00326      for(i=0; i<_gui_layout->nb_elements; i++)
00327      {
00328           _gui_item = &_gui_layout->_gui_item[i];
00329           _gui_item->x = _gui_item->x-inf_x + x;
00330           _gui_item->y = _gui_item->y-inf_y + y;
00331           SetWindowPos(
00332                 _gui_item->hwnd,
00333                 NULL,
00334                 _gui_item->x,
00335                 _gui_item->y,
00336                 0,
00337                 0,
00338                 SWP_NOZORDER | SWP_NOSIZE);
00339      }
00340 }

void gui_new_tab_layout ( s_gui_tab_layout _gui_layout,
int  max_elements 
)

Definition at line 138 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout::_gui_item, s_gui_tab_layout_item::actif, ASSERT, FALSE, s_gui_tab_layout::hwnd, and s_gui_tab_layout::nb_elements.

Referenced by WindowProcedure().

00139 {
00140      int i;
00141 
00142      ASSERT(_gui_layout);
00143 
00144      _gui_layout->_gui_item = (s_gui_tab_layout_item *) malloc(sizeof(s_gui_tab_layout_item)*max_elements);
00145      assert(_gui_layout->_gui_item);
00146      memset(_gui_layout->_gui_item, 0, sizeof(s_gui_tab_layout_item)*max_elements);
00147      _gui_layout->hwnd = NULL;
00148      _gui_layout->nb_elements = 0;
00149      for(i=0; i<max_elements; i++)
00150          _gui_layout->_gui_item[i].actif = FALSE;
00151 }

LRESULT CALLBACK gui_proc ( s_gui_tab_layout _gui_layout,
HWND  hwnd,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 424 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout_item::_f_proc, s_gui_tab_layout::_gui_item, ASSERT, s_gui_tab_layout_item::background_color, gui_box::bg_color, gui_box::fg_color, s_gui_tab_layout_item::foreground_color, GUI_BACKGROUND_COLOR_COMBOBOX, GUI_BACKGROUND_COLOR_EDIT, GUI_BACKGROUND_COLOR_STATIC, gui_delete_tab_layout(), GUI_FOREGROUND_COLOR_COMBOBOX, GUI_FOREGROUND_COLOR_EDIT, GUI_FOREGROUND_COLOR_STATIC, gui_get_item_w_coord(), gui_is_hwnd(), gui_paint(), GUI_TYPE_COMBOBOX, GUI_TYPE_EDIT, GUI_TYPE_RICHEDIT, GUI_TYPE_STATIC, s_gui_tab_layout_item::hwnd, s_gui_tab_layout_item::id, s_gui_tab_layout::nb_elements, s_gui_tab_layout_item::type, gui_box::x, and gui_box::y.

Referenced by WindowProcedure().

00425 {
00426     static HBRUSH hbrush = NULL;
00427     LRESULT result;
00428     HDC hdc;
00429     PAINTSTRUCT ps;
00430   int item_id, msg_code;
00431     int i, x, y;
00432     s_gui_tab_layout_item *_gui_item;
00433     COLORREF bg_color, fg_color;
00434     char _temp[256];
00435 
00436     result = 0;
00437     switch(message)
00438     {
00439     case WM_DESTROY:
00440         ASSERT(_gui_layout);
00441         gui_delete_tab_layout(_gui_layout);
00442         result = 1;
00443         break;
00444   case WM_PAINT:
00445         ASSERT(_gui_layout);
00446         hdc = BeginPaint(hwnd, &ps);
00447         result = gui_paint(_gui_layout, hdc);
00448         EndPaint(hwnd, &ps);
00449       break;
00450   case WM_MOUSEMOVE:
00451     case WM_LBUTTONDOWN:
00452     case WM_LBUTTONUP:
00453     case WM_LBUTTONDBLCLK:
00454     case WM_RBUTTONDOWN:
00455     case WM_RBUTTONUP:
00456     case WM_RBUTTONDBLCLK:
00457         ASSERT(_gui_layout);
00458         x = LOWORD(lParam); 
00459         y = HIWORD(lParam);
00460         i = gui_get_item_w_coord(_gui_layout, &x, &y);
00461         if (i == -1)
00462            return 0;
00463         ASSERT(i >= 0 && i < _gui_layout->nb_elements);
00464         _gui_item = &_gui_layout->_gui_item[i];
00465         ASSERT(_gui_item);
00466         lParam = x + (y << 16);
00467         if (_gui_item->_f_proc)
00468             result = _gui_item->_f_proc(_gui_item->hwnd, message, wParam, lParam);
00469         break;
00470     case WM_CTLCOLORSTATIC:
00471     case WM_CTLCOLOREDIT:
00472     case WM_CTLCOLORSCROLLBAR:
00473     case WM_CTLCOLORLISTBOX:
00474     case WM_CTLCOLORBTN:
00475         ASSERT(_gui_layout);
00476         if (!(_gui_item = gui_is_hwnd(_gui_layout, (HWND) lParam)))
00477            break;
00478         hdc = (HDC) wParam;
00479         ASSERT(hdc);
00480         switch(_gui_item->type)
00481         {
00482         case GUI_TYPE_STATIC:
00483              bg_color = (_gui_item->background_color)?_gui_item->background_color:GUI_BACKGROUND_COLOR_STATIC;
00484              fg_color = (_gui_item->foreground_color)?_gui_item->foreground_color:GUI_FOREGROUND_COLOR_STATIC;
00485              break;
00486         case GUI_TYPE_RICHEDIT:
00487         case GUI_TYPE_EDIT:
00488              bg_color = (_gui_item->background_color)?_gui_item->background_color:GUI_BACKGROUND_COLOR_EDIT;
00489              fg_color = (_gui_item->foreground_color)?_gui_item->foreground_color:GUI_FOREGROUND_COLOR_EDIT;
00490              break;
00491         case GUI_TYPE_COMBOBOX:
00492              bg_color = (_gui_item->background_color)?_gui_item->background_color:GUI_BACKGROUND_COLOR_COMBOBOX;
00493              fg_color = (_gui_item->foreground_color)?_gui_item->foreground_color:GUI_FOREGROUND_COLOR_COMBOBOX;
00494              break;        
00495         }
00496 
00497         SetBkColor(hdc, bg_color);                                
00498         SetTextColor(hdc, fg_color);
00499         if (hbrush)
00500            DeleteObject(hbrush);
00501         hbrush = CreateSolidBrush(bg_color);
00502         ASSERT(hbrush);
00503         SelectObject(hdc, hbrush);
00504         result = (LRESULT) hbrush;
00505         break;
00506   case WM_COMMAND:
00507         ASSERT(_gui_layout);
00508         msg_code = (wParam >> 16) & 0xFFFF;
00509         item_id = wParam & 0xFFFF;
00510 
00511         i = _gui_layout->nb_elements;
00512         _gui_item = NULL;
00513         while(i--)
00514         {
00515             _gui_item = &_gui_layout->_gui_item[i];
00516             ASSERT(_gui_item);
00517             if (_gui_item->id == item_id)
00518                 break;
00519         }
00520         if (!_gui_item)
00521         {
00522             result = (LRESULT) 0;
00523             break;
00524         }
00525 
00526         if (_gui_item->id == item_id)
00527         {
00528               if (_gui_item->_f_proc)
00529                   result = _gui_item->_f_proc(_gui_item->hwnd, msg_code, wParam, lParam);
00530               else
00531                   result = (LRESULT) 0;
00532         }
00533         else
00534             result = (LRESULT) 0;
00535         break;
00536   default:
00537       result = (LRESULT) 0;
00538     }
00539 
00540   return result;
00541 }

void gui_rescale ( s_gui_tab_layout _gui_layout,
float  scale_x,
float  scale_y,
BOOL  repaint 
)

Definition at line 82 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout::_gui_item, ASSERT, GUI_TYPE_COMBOBOX, s_gui_tab_layout_item::height, s_gui_tab_layout::hwnd, s_gui_tab_layout_item::hwnd, s_gui_tab_layout_item::id, s_gui_tab_layout::nb_elements, s_gui_tab_layout::scale_x, s_gui_tab_layout::scale_y, s_gui_tab_layout_item::style, TRUE, s_gui_tab_layout_item::type, s_gui_tab_layout_item::width, s_gui_tab_layout_item::x, and s_gui_tab_layout_item::y.

Referenced by WindowProcedure().

00083 {
00084      int i, offset_x, offset_y;
00085      s_gui_tab_layout_item *_gui_item;
00086      HFONT hfont, hfont_old;
00087      LOGFONT lf;
00088      int flags;
00089 
00090      ASSERT(_gui_layout);
00091 
00092      memset(&lf, 0, sizeof(LOGFONT));
00093      strcpy(lf.lfFaceName, "Arial");
00094 
00095      if (repaint)
00096          flags = 0;
00097      else
00098          flags = SWP_NOREDRAW;
00099 
00100      if (scale_x < 0 || scale_y < 0)
00101         flags |= SWP_NOMOVE | SWP_NOSIZE;
00102         
00103      _gui_layout->scale_x = scale_x;
00104      _gui_layout->scale_y = scale_y;
00105      
00106      for(i=0; i<_gui_layout->nb_elements; i++)
00107      {
00108            _gui_item = &_gui_layout->_gui_item[i];
00109            ASSERT(_gui_item);
00110            offset_x = 0;
00111            offset_y = 0;
00112 
00113            if (_gui_item->type == GUI_TYPE_COMBOBOX)
00114                offset_y = (20*(scale_y-1))/2;
00115 
00116            SetWindowPos(
00117                 _gui_item->hwnd,
00118                 NULL,
00119                 _gui_item->x*scale_x+offset_x,
00120                 _gui_item->y*scale_y+offset_y,
00121                 _gui_item->width*scale_x,
00122                 _gui_item->height*scale_y,
00123                 flags | SWP_NOZORDER);
00124 
00125            if (_gui_item->type != GUI_TYPE_COMBOBOX && !(_gui_item->style & ES_MULTILINE))
00126            {
00127               lf.lfHeight = _gui_item->height*scale_y-2;
00128               lf.lfWeight = 800;
00129               hfont_old = (HFONT) SendDlgItemMessage(_gui_layout->hwnd, _gui_item->id, WM_GETFONT, 0, 0);
00130               hfont = CreateFontIndirect(&lf);
00131               SendDlgItemMessage(_gui_layout->hwnd, _gui_item->id, WM_SETFONT, (WPARAM) hfont, MAKELPARAM(TRUE, 0));
00132               if (hfont_old)
00133                  DeleteObject(hfont_old);
00134            }
00135      }
00136 }

void gui_set_font ( s_gui_tab_layout_item _gui_item,
char *  _name,
int  height,
BOOL  bolt,
BOOL  italic,
BOOL  underlined 
)

Definition at line 59 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References ASSERT, s_gui_tab_layout_item::hwnd, and TRUE.

00060 {
00061      HFONT hfont, hfont_old;
00062      LOGFONT lf;
00063 
00064      ASSERT(_gui_item);
00065 
00066      memset(&lf, 0, sizeof(LOGFONT));
00067      strcpy(lf.lfFaceName, _name);
00068      lf.lfHeight = height;
00069      if (bolt)
00070         lf.lfWeight = FW_BLACK;
00071      lf.lfItalic = italic;
00072      lf.lfUnderline = underlined;
00073 
00074      hfont_old = (HFONT) SendMessage(_gui_item->hwnd, WM_GETFONT, 0, 0);
00075      hfont = CreateFontIndirect(&lf);
00076      SendMessage(_gui_item->hwnd, WM_SETFONT, (WPARAM) hfont, MAKELPARAM(TRUE, 0));
00077      if (hfont_old)
00078          DeleteObject(hfont_old);
00079 }

void gui_visibility ( s_gui_tab_layout _gui_layout,
BOOL  visible 
)

Definition at line 342 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout::_gui_item, s_gui_tab_layout_item::actif, ASSERT, FALSE, s_gui_tab_layout_item::hwnd, s_gui_tab_layout::nb_elements, and TRUE.

00343 {
00344      int i;
00345      UINT uFlags;
00346      
00347      ASSERT(_gui_layout);
00348      
00349      uFlags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE;
00350      if (visible)
00351         uFlags |= SWP_SHOWWINDOW;
00352      else
00353         uFlags |= SWP_HIDEWINDOW;
00354 
00355      for(i=0; i<_gui_layout->nb_elements; i++)
00356      {
00357          if (visible)
00358             _gui_layout->_gui_item[i].actif = TRUE;
00359          else
00360             _gui_layout->_gui_item[i].actif = FALSE;
00361           SetWindowPos(_gui_layout->_gui_item[i].hwnd, NULL, 0, 0, 0, 0, uFlags);
00362      }
00363 }

void gui_visibility_item ( s_gui_tab_layout_item _gui_item,
BOOL  visible 
)

Definition at line 365 of file SERVICES/DSPLIB/UTILS/PROGRAMS/WINDOWS/DATA_PRINT/gui.c.

References s_gui_tab_layout_item::actif, ASSERT, FALSE, s_gui_tab_layout_item::hwnd, and TRUE.

00366 {
00367      UINT uFlags;
00368 
00369      ASSERT(_gui_item);
00370 
00371      uFlags = SWP_NOMOVE | SWP_NOZORDER | SWP_NOSIZE;
00372      if (visible)
00373         uFlags |= SWP_SHOWWINDOW;
00374      else
00375         uFlags |= SWP_HIDEWINDOW;
00376 
00377      if (visible)
00378         _gui_item->actif = TRUE;
00379      else
00380         _gui_item->actif = FALSE;
00381      SetWindowPos(_gui_item->hwnd, NULL, 0, 0, 0, 0, uFlags);     
00382 }


Generated on Fri Feb 19 02:23:20 2010 for AVR32 UC3 - EVK1104 DSPLib Demo Documentation by  doxygen 1.5.5