WindowInfo

Far Manager

WindowInfo

The WindowInfo structure contains information about one FAR Manager window. A plugin can retrieve this information using the ACTL_GETWINDOWINFO command.
struct WindowInfo{
  int  Pos;
  int  Type;
  int  Modified;
  int  Current;
  char TypeName[64];
  char Name[NM];
};

Elements

Pos
Zero-based number of the window to retrieve information for. Pos = -1 will return information for the current window.
Type
Window type. Can be one of the following (the WINDOWINFO_TYPE enumeration):
TypeDescription
WTYPE_PANELS File panels.
WTYPE_VIEWER Internal viewer window.
WTYPE_EDITOR Internal editor window.
WTYPE_DIALOG Dialog.
WTYPE_VMENU Menu.
WTYPE_HELP Help window.
Modified
Modification flag. Can be set only if Type = WTYPE_EDITOR.
Current
Nonzero if the window is active.
TypeName
The name of the window type (Panels,View,Edit,Help,VMenu), depends on the current language setting of Far.
Name
Window title. For WTYPE_VIEWER and WTYPE_EDITOR windows this is a file name. For panels, the name of the currently selected file object. For the help window - full path to the opened HLF file. For menu and dialogs - header.

Example

void GetFarWindowInfo()
{
  WindowInfo WInfo;
  int CountWindow;
  int I;
  FILE *Fp;

  if((Fp=fopen("window.log","a+t")) == NULL)
      return ;

  // request window count
  CountWindow=(int)Info.AdvControl(Info.ModuleNumber,ACTL_GETWINDOWCOUNT,NULL);
  fprintf(Fp,"WindowCount=%i\n",CountWindow);

  for ( I=0; I < CountWindow; I++ )
  {
    WInfo.Pos=I;

    // request window information
    Info.AdvControl(Info.ModuleNumber,ACTL_GETWINDOWINFO,(void*)&WInfo);

    // output it
    fprintf(Fp,"Window[%i], Type=%i (%s), File=[%s] Current=%i, Modified=%i\n",
               I,WInfo.Type,WInfo.TypeName,WInfo.Name,
               WInfo.Current,WInfo.Modified);
  }
  fclose(Fp);

  // set window number 1 (i.e. second)
  Info.AdvControl(Info.ModuleNumber,ACTL_SETCURRENTWINDOW,(void*)1);
}
See also: