Toolbar.h File Reference

#include <windows.h>
#include <CommCtrl.h>
#include "machine.h"
#include "stack-c.h"
#include "version.h"
#include "wgnuplib.h"
#include "resource.h"
#include "scigraphic.h"
#include "wgraph.h"
#include "Messages.h"
#include "Warnings.h"
#include "Errors.h"

Include dependency graph for Toolbar.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

void SetDefaultShowToolBar (BOOL valShowToolBar)
void HideGraphToolBar (struct BCG *ScilabGC)
void ShowGraphToolBar (struct BCG *ScilabGC)
void CreateGraphToolBar (struct BCG *ScilabGC)
void RefreshGraphToolBar (struct BCG *ScilabGC)
void ModifyEntityPickerToolbar (struct BCG *ScilabGC, BOOL Pressed)
void ShowToolBar (LPTW lptw)
void HideToolBar (LPTW lptw)
void ToolBarOnOff (LPTW lptw)
void CreateMyTooltip (HWND hwnd, char ToolTipString[30])
int HideToolBarWin32 (int WinNum)
int GetStateToolBarWin32 (int WinNum)
int ToolBarWin32 (int WinNum, char *onoff)
void EnableToolBar (LPTW lptw)
void DisableToolBar (LPTW lptw)
void CreateButtonToolBar (struct BCG *ScilabGC, char *Name, HMENU CallbackID, int ID_ICON, char *ToolTipString, DWORD Style)


Function Documentation

void CreateButtonToolBar ( struct BCG ScilabGC,
char *  Name,
HMENU  CallbackID,
int  ID_ICON,
char *  ToolTipString,
DWORD  Style 
)

Definition at line 370 of file Toolbar.c.

References ButtonToolBarWeight, CreateMyTooltip(), BCG::CWindow, graphwin, tagGW::hInstance, MSG_SCIMSG9, NULL, and ToolBarHeight.

Referenced by CreateGraphToolBar().

00371 {
00372         HICON IconButton;
00373         ScilabGC->lpmw.hButton[ScilabGC->lpmw.nButton]= CreateWindow("button",Name,Style,
00374                                                                                                                                                                                                                                                                 ButtonToolBarWeight*ScilabGC->lpmw.nButton, 0,
00375                                                                                                                                                                                                                                                                 ButtonToolBarWeight, ToolBarHeight,
00376                                                                                                                                                                                                                                                                 ScilabGC->CWindow,(HMENU) CallbackID,
00377                                                                                                                                                                                                                                                                 graphwin.hInstance, NULL);
00378 
00379   IconButton=(HICON)LoadImage( GetModuleHandle(MSG_SCIMSG9), (LPCSTR)ID_ICON,IMAGE_ICON,ButtonToolBarWeight,ToolBarHeight,LR_DEFAULTCOLOR);
00380         SendMessage(ScilabGC->lpmw.hButton[ScilabGC->lpmw.nButton],BM_SETIMAGE, IMAGE_ICON, (LPARAM)IconButton);
00381 
00382         CreateMyTooltip (ScilabGC->lpmw.hButton[ScilabGC->lpmw.nButton], ToolTipString); 
00383 
00384         ScilabGC->lpmw.nButton++;
00385 }

Here is the call graph for this function:

Here is the caller graph for this function:

void CreateGraphToolBar ( struct BCG ScilabGC  ) 

Definition at line 45 of file Toolbar.c.

References CreateButtonToolBar(), DefaultShowToolBar, FALSE, HideGraphToolBar(), IDI_3DROT, IDI_ARROW, IDI_CIRCLE, IDI_GED, IDI_LINE, IDI_PICKER, IDI_POLYLINE, IDI_RECTANGLE, IDI_TEXT, IDI_UNZOOM, IDI_ZOOM, MSG_SCIMSG106, MSG_SCIMSG107, MSG_SCIMSG108, MSG_SCIMSG110, MSG_SCIMSG111, MSG_SCIMSG112, MSG_SCIMSG113, MSG_SCIMSG120, MSG_SCIMSG14, MSG_SCIMSG15, MSG_SCIMSG16, TOOLBAR_ARROW, TOOLBAR_CIRCLE, TOOLBAR_GED, TOOLBAR_LINE, TOOLBAR_PICKER, TOOLBAR_POLYLINE, TOOLBAR_RECTANGLE, TOOLBAR_ROTATE3D, TOOLBAR_TEXT, TOOLBAR_UNZOOM, TOOLBAR_ZOOM, and TRUE.

00046 {
00047         ScilabGC->lpmw.nButton=0;
00048 
00049         CreateButtonToolBar(ScilabGC,MSG_SCIMSG14,(HMENU)TOOLBAR_ZOOM,IDI_ZOOM,MSG_SCIMSG14,WS_CHILD|WS_VISIBLE|BS_ICON);
00050         CreateButtonToolBar(ScilabGC,MSG_SCIMSG15,(HMENU)TOOLBAR_UNZOOM,IDI_UNZOOM,MSG_SCIMSG15,WS_CHILD|WS_VISIBLE|BS_ICON);
00051         CreateButtonToolBar(ScilabGC,MSG_SCIMSG16,(HMENU)TOOLBAR_ROTATE3D,IDI_3DROT,MSG_SCIMSG16,WS_CHILD|WS_VISIBLE|BS_ICON);
00052         CreateButtonToolBar(ScilabGC,MSG_SCIMSG106,(HMENU)TOOLBAR_GED,IDI_GED,MSG_SCIMSG106,WS_CHILD|WS_VISIBLE|BS_ICON);
00053         CreateButtonToolBar(ScilabGC,MSG_SCIMSG113,(HMENU)TOOLBAR_PICKER,IDI_PICKER,MSG_SCIMSG113,WS_CHILD|WS_VISIBLE|BS_ICON|BS_AUTOCHECKBOX|BS_PUSHLIKE);
00054         CreateButtonToolBar(ScilabGC,MSG_SCIMSG107,(HMENU)TOOLBAR_LINE,IDI_LINE,MSG_SCIMSG107,WS_CHILD|WS_VISIBLE|BS_ICON);
00055         CreateButtonToolBar(ScilabGC,MSG_SCIMSG120,(HMENU)TOOLBAR_POLYLINE,IDI_POLYLINE,MSG_SCIMSG120,WS_CHILD|WS_VISIBLE|BS_ICON);
00056         CreateButtonToolBar(ScilabGC,MSG_SCIMSG108,(HMENU)TOOLBAR_ARROW,IDI_ARROW,MSG_SCIMSG108,WS_CHILD|WS_VISIBLE|BS_ICON);
00057         /*CreateButtonToolBar(ScilabGC,MSG_SCIMSG109,(HMENU)TOOLBAR_DOUBLEARROW,IDI_DOUBLEARROW,MSG_SCIMSG109,WS_CHILD|WS_VISIBLE|BS_ICON);*/
00058         CreateButtonToolBar(ScilabGC,MSG_SCIMSG110,(HMENU)TOOLBAR_TEXT,IDI_TEXT,MSG_SCIMSG110,WS_CHILD|WS_VISIBLE|BS_ICON);
00059         CreateButtonToolBar(ScilabGC,MSG_SCIMSG111,(HMENU)TOOLBAR_RECTANGLE,IDI_RECTANGLE,MSG_SCIMSG111,WS_CHILD|WS_VISIBLE|BS_ICON);
00060         CreateButtonToolBar(ScilabGC,MSG_SCIMSG112,(HMENU)TOOLBAR_CIRCLE,IDI_CIRCLE,MSG_SCIMSG112,WS_CHILD|WS_VISIBLE|BS_ICON);
00061 
00062         ScilabGC->lpmw.LockToolBar=FALSE;
00063 
00064         if (DefaultShowToolBar == FALSE) HideGraphToolBar(ScilabGC);
00065         else
00066         {
00067                 ScilabGC->lpmw.ShowToolBar=TRUE;
00068         }
00069 
00070 }

Here is the call graph for this function:

void CreateMyTooltip ( HWND  hwnd,
char  ToolTipString[30] 
)

Definition at line 144 of file Toolbar.c.

00145 {
00146         INITCOMMONCONTROLSEX iccex; 
00147         HWND hwndTT;                 // handle to the ToolTip control
00148 
00149         TOOLINFO ti; // struct specifying info about tool in ToolTip control
00150         unsigned int uid = 0;       // for ti initialization
00151 
00152         LPTSTR lptstr = ToolTipString;
00153         RECT rect;                  // for client area coordinates
00154 
00155         /* INITIALIZE COMMON CONTROLS */
00156         iccex.dwICC = ICC_WIN95_CLASSES;
00157         iccex.dwSize = sizeof(INITCOMMONCONTROLSEX);
00158         InitCommonControlsEx(&iccex);
00159 
00160         /* CREATE A TOOLTIP WINDOW */
00161         hwndTT = CreateWindowEx(WS_EX_TOPMOST,
00162                 TOOLTIPS_CLASS,
00163                 NULL,
00164                 WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,                
00165                 CW_USEDEFAULT,
00166                 CW_USEDEFAULT,
00167                 CW_USEDEFAULT,
00168                 CW_USEDEFAULT,
00169                 hwnd,
00170                 NULL,
00171                 NULL,
00172                 NULL
00173                 );
00174 
00175         SetWindowPos(hwndTT,
00176                 HWND_TOPMOST,
00177                 0,
00178                 0,
00179                 0,
00180                 0,
00181                 SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE);
00182 
00183         /* GET COORDINATES OF THE MAIN CLIENT AREA */
00184         GetClientRect (hwnd, &rect);
00185 
00186         /* INITIALIZE MEMBERS OF THE TOOLINFO STRUCTURE */
00187         ti.cbSize = sizeof(TOOLINFO);
00188         ti.uFlags = TTF_SUBCLASS;
00189         ti.hwnd = hwnd;
00190         ti.hinst = NULL;
00191         ti.uId = uid;
00192         ti.lpszText = lptstr;
00193         // ToolTip control will cover the whole window
00194         ti.rect.left = rect.left;    
00195         ti.rect.top = rect.top;
00196         ti.rect.right = rect.right;
00197         ti.rect.bottom = rect.bottom;
00198 
00199         /* SEND AN ADDTOOL MESSAGE TO THE TOOLTIP CONTROL WINDOW */
00200         SendMessage(hwndTT, TTM_ADDTOOL, 0, (LPARAM) (LPTOOLINFO) &ti); 
00201 
00202 } 

void DisableToolBar ( LPTW  lptw  ) 

Definition at line 343 of file Toolbar.c.

00344 {
00345         int i=0;
00346         if (lptw->lpmw->ShowToolBar)
00347         {
00348                 for (i = 0; i < lptw->lpmw->nButton; i++)
00349                 {
00350                         ShowWindow( lptw->lpmw->hButton[i] , SW_HIDE );
00351                 }
00352         }
00353 }

void EnableToolBar ( LPTW  lptw  ) 

Definition at line 331 of file Toolbar.c.

00332 {
00333         int i=0;
00334         if (lptw->lpmw->ShowToolBar)
00335         {
00336                 for (i = 0; i < lptw->lpmw->nButton; i++)
00337                 {
00338                         ShowWindow( lptw->lpmw->hButton[i] , SW_SHOWNORMAL );
00339                 }
00340         }
00341 }

int GetStateToolBarWin32 ( int  WinNum  ) 

Definition at line 300 of file Toolbar.c.

References FALSE, GetTextWinScilab(), getWindowXgcNumber(), IsWindowInterface(), tagTW::lpmw, MSG_WARNING29, NULL, sciprint(), and tagMW::ShowToolBar.

Referenced by C2F().

00301 {
00302         int bAns;
00303         if (WinNum == -1)
00304         {
00305                 if (IsWindowInterface())
00306                 {
00307                         LPTW lptw=GetTextWinScilab();
00308 
00309                         bAns=lptw->lpmw->ShowToolBar;
00310                 }
00311                 else
00312                 {
00313                         sciprint(MSG_WARNING29);
00314                         bAns=FALSE;
00315                 }
00316         }
00317         else
00318         {
00319                 struct BCG *ScilabGC=NULL;
00320                 ScilabGC = getWindowXgcNumber (WinNum);
00321                 if (ScilabGC != (struct BCG *) 0)
00322                 {
00323                         bAns=(ScilabGC->lpmw.ShowToolBar);
00324                 }
00325                 else bAns=FALSE;
00326         }
00327 
00328         return bAns;
00329 }

Here is the call graph for this function:

Here is the caller graph for this function:

void HideGraphToolBar ( struct BCG ScilabGC  ) 

Definition at line 23 of file Toolbar.c.

00024 {
00025         int i=0;
00026         ScilabGC->lpmw.ShowToolBar=FALSE;
00027 
00028         for (i=0;i<ScilabGC->lpmw.nButton;i++)
00029         {
00030                 ShowWindow(ScilabGC->lpmw.hButton[i],SW_HIDE);
00031         }
00032 }

void HideToolBar ( LPTW  lptw  ) 

Definition at line 111 of file Toolbar.c.

00112 {
00113         int i=0;                        
00114         LPMW lpmw;                      
00115         RECT rect;
00116         lpmw = lptw->lpmw;
00117 
00118         GetClientRect (lptw->hWndParent, &rect);
00119         SetWindowPos (lptw->hWndText, (HWND) NULL,0,0,
00120                 rect.right, rect.bottom,SWP_NOZORDER | SWP_NOACTIVATE);
00121         for (i = 0; i < lpmw->nButton; i++)
00122         {
00123                 ShowWindow( lpmw->hButton[i] , SW_HIDE );
00124         }
00125         InvalidateRect(lptw->hWndParent, (LPRECT) NULL, TRUE);
00126         InvalidateRect(lptw->hWndText, (LPRECT) NULL, TRUE);
00127         UpdateWindow (lptw->hWndText);
00128 
00129 }

int HideToolBarWin32 ( int  WinNum  ) 

Definition at line 204 of file Toolbar.c.

00205 {
00206         if (WinNum == -1)
00207         {
00208                 if (IsWindowInterface())
00209                 {
00210                         LPTW lptw=GetTextWinScilab();
00211 
00212                         HideToolBar(lptw);
00213                         lptw->lpmw->ShowToolBar=FALSE;
00214                         lptw->lpmw->LockToolBar=TRUE;
00215                 }
00216                 else
00217                 {
00218                         sciprint(MSG_WARNING29 );
00219                 }
00220         }
00221         else
00222         {
00223                 struct BCG *ScilabGC=NULL;
00224                 ScilabGC = getWindowXgcNumber (WinNum);
00225                 if (ScilabGC != (struct BCG *) 0)
00226                 {
00227                         HideGraphToolBar(ScilabGC);
00228                         ScilabGC->lpmw.LockToolBar=TRUE;
00229                 }
00230         }
00231 
00232         return 0;
00233 }

void ModifyEntityPickerToolbar ( struct BCG ScilabGC,
BOOL  Pressed 
)

Definition at line 355 of file Toolbar.c.

00356 {
00357         HWND hwndPicker=NULL;
00358         hwndPicker=GetDlgItem(ScilabGC->CWindow,TOOLBAR_PICKER);
00359 
00360         if (Pressed)
00361         {
00362                 SendMessage(hwndPicker,(UINT) BM_SETCHECK,BST_CHECKED,0);
00363         }
00364         else
00365         {
00366                 SendMessage(hwndPicker,(UINT) BM_SETCHECK,BST_UNCHECKED,0);  
00367         }
00368 }

void RefreshGraphToolBar ( struct BCG ScilabGC  ) 

Definition at line 72 of file Toolbar.c.

References i, NULL, SW_SHOWNORMAL, and TRUE.

00073 {
00074   int i=0;
00075 
00076 
00077   if (ScilabGC->lpmw.ShowToolBar)
00078   {
00079     for (i=3;i<ScilabGC->lpmw.nButton;i++)
00080     {
00081       ShowWindow(ScilabGC->lpmw.hButton[i],SW_SHOWNORMAL);
00082     }
00083   }
00084   for (i=0;i<ScilabGC->lpmw.nButton;i++)
00085   {
00086     InvalidateRect(ScilabGC->lpmw.hButton[i],NULL,TRUE);
00087   }
00088 }

void SetDefaultShowToolBar ( BOOL  valShowToolBar  ) 

Definition at line 18 of file Toolbar.c.

References DefaultShowToolBar.

00019 {
00020         DefaultShowToolBar=valShowToolBar;
00021 }

void ShowGraphToolBar ( struct BCG ScilabGC  ) 

Definition at line 34 of file Toolbar.c.

00035 {
00036         int i=0;
00037 
00038         ScilabGC->lpmw.ShowToolBar=TRUE;
00039         for (i=0;i<ScilabGC->lpmw.nButton;i++)
00040         {
00041                 ShowWindow(ScilabGC->lpmw.hButton[i],SW_SHOWNORMAL);
00042         }
00043 }

void ShowToolBar ( LPTW  lptw  ) 

Definition at line 90 of file Toolbar.c.

00091 {
00092         int i=0;                        
00093         LPMW lpmw;                      
00094         RECT rect;
00095 
00096         lpmw = lptw->lpmw;
00097 
00098         GetClientRect (lptw->hWndParent, &rect);
00099         SetWindowPos (lptw->hWndText, (HWND) NULL, 0, lptw->ButtonHeight,
00100                 rect.right, rect.bottom - lptw->ButtonHeight,SWP_NOZORDER | SWP_NOACTIVATE);    
00101         for (i = 0; i < lpmw->nButton; i++)
00102         {
00103                 ShowWindow( lpmw->hButton[i] , SW_SHOWNORMAL );
00104         }
00105 
00106         InvalidateRect(lptw->hWndParent, (LPRECT) NULL, TRUE);
00107         InvalidateRect(lptw->hWndText, (LPRECT) NULL, TRUE);
00108         UpdateWindow (lptw->hWndText);
00109 }

void ToolBarOnOff ( LPTW  lptw  ) 

Definition at line 131 of file Toolbar.c.

00132 {
00133         BOOL ON=lptw->lpmw->ShowToolBar;
00134         if  (ON)
00135         {
00136                 ShowToolBar(lptw);
00137         }
00138         else
00139         {
00140                 HideToolBar(lptw);
00141         }
00142 }

int ToolBarWin32 ( int  WinNum,
char *  onoff 
)

Definition at line 235 of file Toolbar.c.

References FALSE, GetTextWinScilab(), getWindowXgcNumber(), HideGraphToolBar(), IsWindowInterface(), tagMW::LockToolBar, tagTW::lpmw, MSG_WARNING29, NULL, sciprint(), ShowGraphToolBar(), tagMW::ShowToolBar, ToolBarOnOff(), and TRUE.

Referenced by C2F().

00236 {
00237         int bON;
00238         if (WinNum == -1)
00239         {
00240                 if (IsWindowInterface())
00241                 {
00242                         LPTW lptw=GetTextWinScilab();
00243 
00244                         if (strcmp(onoff,"off")==0)
00245                         {
00246                                 if (!lptw->lpmw->LockToolBar)
00247                                 {
00248                                         lptw->lpmw->ShowToolBar=FALSE;
00249                                         ToolBarOnOff(lptw);
00250                                 }
00251                         }
00252 
00253                         if (strcmp(onoff,"on")==0)
00254                         {
00255                                 if (!lptw->lpmw->LockToolBar)
00256                                 {
00257                                         lptw->lpmw->ShowToolBar=TRUE;
00258                                         ToolBarOnOff(lptw);
00259                                 }
00260                         }
00261 
00262                         bON=lptw->lpmw->ShowToolBar;
00263                 }
00264                 else
00265                 {
00266                         sciprint(MSG_WARNING29);
00267                         bON=FALSE;
00268                 }
00269         }
00270         else
00271         {
00272                 struct BCG *ScilabGC=NULL;
00273                 ScilabGC = getWindowXgcNumber (WinNum);
00274                 if (ScilabGC != (struct BCG *) 0)
00275                 {
00276                         if (strcmp(onoff,"off")==0)
00277                         {
00278                                 if (!ScilabGC->lpmw.LockToolBar)
00279                                 {
00280                                         HideGraphToolBar(ScilabGC);
00281                                 }
00282 
00283                         }
00284 
00285                         if (strcmp(onoff,"on")==0)
00286                         {
00287                                 if (!ScilabGC->lpmw.LockToolBar)
00288                                 {
00289                                         ShowGraphToolBar(ScilabGC);
00290                                 }
00291                         }
00292 
00293                         bON=(ScilabGC->lpmw.ShowToolBar);
00294                 }
00295                 else bON=FALSE;
00296         }
00297         return bON;
00298 }

Here is the call graph for this function:

Here is the caller graph for this function:


Generated on Sun Mar 4 15:58:12 2007 for Scilab [trunk] by  doxygen 1.5.1