⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 terminal_interface-curses.adb

📁 ncurses-5.4
💻 ADB
📖 第 1 页 / 共 5 页
字号:
   procedure Change_Attributes     (Win    : in Window := Standard_Window;      Line   : in Line_Position := Line_Position'First;      Column : in Column_Position := Column_Position'First;      Count  : in Integer := -1;      Attr   : in Character_Attribute_Set := Normal_Video;      Color  : in Color_Pair := Color_Pair'First)   is   begin      Move_Cursor (Win, Line, Column);      Change_Attributes (Win, Count, Attr, Color);   end Change_Attributes;------------------------------------------------------------------------------   procedure Beep   is      function Beeper return C_Int;      pragma Import (C, Beeper, "beep");   begin      if Beeper = Curses_Err then         raise Curses_Exception;      end if;   end Beep;   procedure Flash_Screen   is      function Flash return C_Int;      pragma Import (C, Flash, "flash");   begin      if Flash = Curses_Err then         raise Curses_Exception;      end if;   end Flash_Screen;------------------------------------------------------------------------------   procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True)   is      function Cbreak return C_Int;      pragma Import (C, Cbreak, "cbreak");      function NoCbreak return C_Int;      pragma Import (C, NoCbreak, "nocbreak");      Err : C_Int;   begin      if SwitchOn then         Err := Cbreak;      else         Err := NoCbreak;      end if;      if Err = Curses_Err then         raise Curses_Exception;      end if;   end Set_Cbreak_Mode;   procedure Set_Raw_Mode (SwitchOn : in Boolean := True)   is      function Raw return C_Int;      pragma Import (C, Raw, "raw");      function NoRaw return C_Int;      pragma Import (C, NoRaw, "noraw");      Err : C_Int;   begin      if SwitchOn then         Err := Raw;      else         Err := NoRaw;      end if;      if Err = Curses_Err then         raise Curses_Exception;      end if;   end Set_Raw_Mode;   procedure Set_Echo_Mode (SwitchOn : in Boolean := True)   is      function Echo return C_Int;      pragma Import (C, Echo, "echo");      function NoEcho return C_Int;      pragma Import (C, NoEcho, "noecho");      Err : C_Int;   begin      if SwitchOn then         Err := Echo;      else         Err := NoEcho;      end if;      if Err = Curses_Err then         raise Curses_Exception;      end if;   end Set_Echo_Mode;   procedure Set_Meta_Mode (Win      : in Window := Standard_Window;                            SwitchOn : in Boolean := True)   is      function Meta (W : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Meta, "meta");   begin      if Meta (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then         raise Curses_Exception;      end if;   end Set_Meta_Mode;   procedure Set_KeyPad_Mode (Win      : in Window := Standard_Window;                              SwitchOn : in Boolean := True)   is      function Keypad (W : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Keypad, "keypad");   begin      if Keypad (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then         raise Curses_Exception;      end if;   end Set_KeyPad_Mode;   function Get_KeyPad_Mode (Win : in Window := Standard_Window)                             return Boolean   is   begin      return Get_Flag (Win, Offset_use_keypad);   end Get_KeyPad_Mode;   procedure Half_Delay (Amount : in Half_Delay_Amount)   is      function Halfdelay (Amount : C_Int) return C_Int;      pragma Import (C, Halfdelay, "halfdelay");   begin      if Halfdelay (C_Int (Amount)) = Curses_Err then         raise Curses_Exception;      end if;   end Half_Delay;   procedure Set_Flush_On_Interrupt_Mode     (Win  : in Window := Standard_Window;      Mode : in Boolean := True)   is      function Intrflush (Win : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Intrflush, "intrflush");   begin      if Intrflush (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then         raise Curses_Exception;      end if;   end Set_Flush_On_Interrupt_Mode;   procedure Set_Queue_Interrupt_Mode     (Win   : in Window := Standard_Window;      Flush : in Boolean := True)   is      procedure Qiflush;      pragma Import (C, Qiflush, "qiflush");      procedure No_Qiflush;      pragma Import (C, No_Qiflush, "noqiflush");   begin      if Flush then         Qiflush;      else         No_Qiflush;      end if;   end Set_Queue_Interrupt_Mode;   procedure Set_NoDelay_Mode     (Win  : in Window := Standard_Window;      Mode : in Boolean := False)   is      function Nodelay (Win : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Nodelay, "nodelay");   begin      if Nodelay (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then         raise Curses_Exception;      end if;   end Set_NoDelay_Mode;   procedure Set_Timeout_Mode (Win    : in Window := Standard_Window;                               Mode   : in Timeout_Mode;                               Amount : in Natural)   is      function Wtimeout (Win : Window; Amount : C_Int) return C_Int;      pragma Import (C, Wtimeout, "wtimeout");      Time : C_Int;   begin      case Mode is         when Blocking     => Time := -1;         when Non_Blocking => Time := 0;         when Delayed      =>            if Amount = 0 then               raise Constraint_Error;            end if;            Time := C_Int (Amount);      end case;      if Wtimeout (Win, Time) = Curses_Err then         raise Curses_Exception;      end if;   end Set_Timeout_Mode;   procedure Set_Escape_Timer_Mode     (Win       : in Window := Standard_Window;      Timer_Off : in Boolean := False)   is      function Notimeout (Win : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Notimeout, "notimeout");   begin      if Notimeout (Win, Curses_Bool (Boolean'Pos (Timer_Off)))        = Curses_Err then         raise Curses_Exception;      end if;   end Set_Escape_Timer_Mode;------------------------------------------------------------------------------   procedure Set_NL_Mode (SwitchOn : in Boolean := True)   is      function NL return C_Int;      pragma Import (C, NL, "nl");      function NoNL return C_Int;      pragma Import (C, NoNL, "nonl");      Err : C_Int;   begin      if SwitchOn then         Err := NL;      else         Err := NoNL;      end if;      if Err = Curses_Err then         raise Curses_Exception;      end if;   end Set_NL_Mode;   procedure Clear_On_Next_Update     (Win      : in Window := Standard_Window;      Do_Clear : in Boolean := True)   is      function Clear_Ok (W : Window; Flag : Curses_Bool) return C_Int;      pragma Import (C, Clear_Ok, "clearok");   begin      if Clear_Ok (Win, Curses_Bool (Boolean'Pos (Do_Clear))) = Curses_Err then         raise Curses_Exception;      end if;   end Clear_On_Next_Update;   procedure Use_Insert_Delete_Line     (Win    : in Window := Standard_Window;      Do_Idl : in Boolean := True)   is      function IDL_Ok (W : Window; Flag : Curses_Bool) return C_Int;      pragma Import (C, IDL_Ok, "idlok");   begin      if IDL_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idl))) = Curses_Err then         raise Curses_Exception;      end if;   end Use_Insert_Delete_Line;   procedure Use_Insert_Delete_Character     (Win    : in Window := Standard_Window;      Do_Idc : in Boolean := True)   is      function IDC_Ok (W : Window; Flag : Curses_Bool) return C_Int;      pragma Import (C, IDC_Ok, "idcok");   begin      if IDC_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idc))) = Curses_Err then         raise Curses_Exception;      end if;   end Use_Insert_Delete_Character;   procedure Leave_Cursor_After_Update     (Win      : in Window := Standard_Window;      Do_Leave : in Boolean := True)   is      function Leave_Ok (W : Window; Flag : Curses_Bool) return C_Int;      pragma Import (C, Leave_Ok, "leaveok");   begin      if Leave_Ok (Win, Curses_Bool (Boolean'Pos (Do_Leave))) = Curses_Err then         raise Curses_Exception;      end if;   end Leave_Cursor_After_Update;   procedure Immediate_Update_Mode     (Win  : in Window := Standard_Window;      Mode : in Boolean := False)   is      function Immedok (Win : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Immedok, "immedok");   begin      if Immedok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then         raise Curses_Exception;      end if;   end Immediate_Update_Mode;   procedure Allow_Scrolling     (Win  : in Window  := Standard_Window;      Mode : in Boolean := False)   is      function Scrollok (Win : Window; Mode : Curses_Bool) return C_Int;      pragma Import (C, Scrollok, "scrollok");   begin      if Scrollok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then         raise Curses_Exception;      end if;   end Allow_Scrolling;   function Scrolling_Allowed (Win : Window := Standard_Window)                               return Boolean   is   begin      return Get_Flag (Win, Offset_scroll);   end Scrolling_Allowed;   procedure Set_Scroll_Region     (Win         : in Window := Standard_Window;      Top_Line    : in Line_Position;      Bottom_Line : in Line_Position)   is      function Wsetscrreg (Win : Window;                           Lin : C_Int;                           Col : C_Int) return C_Int;      pragma Import (C, Wsetscrreg, "wsetscrreg");   begin      if Wsetscrreg (Win, C_Int (Top_Line), C_Int (Bottom_Line))        = Curses_Err then         raise Curses_Exception;      end if;   end Set_Scroll_Region;------------------------------------------------------------------------------   procedure Update_Screen   is      function Do_Update return C_Int;      pragma Import (C, Do_Update, "doupdate");   begin      if Do_Update = Curses_Err then         raise Curses_Exception;      end if;   end Update_Screen;   procedure Refresh (Win : in Window := Standard_Window)   is      function Wrefresh (W : Window) return C_Int;      pragma Import (C, Wrefresh, "wrefresh");   begin      if Wrefresh (Win) = Curses_Err then         raise Curses_Exception;      end if;   end Refresh;   procedure Refresh_Without_Update     (Win : in Window := Standard_Window)   is      function Wnoutrefresh (W : Window) return C_Int;      pragma Import (C, Wnoutrefresh, "wnoutrefresh");   begin      if Wnoutrefresh (Win) = Curses_Err then         raise Curses_Exception;      end if;   end Refresh_Without_Update;   procedure Redraw (Win : in Window := Standard_Window)   is      function Redrawwin (Win : Window) return C_Int;      pragma Import (C, Redrawwin, "redrawwin");   begin      if Redrawwin (Win) = Curses_Err then         raise Curses_Exception;      end if;   end Redraw;   procedure Redraw     (Win        : in Window := Standard_Window;      Begin_Line : in Line_Position;      Line_Count : in Positive)   is      function Wredrawln (Win : Window; First : C_Int; Cnt : C_Int)                          return C_Int;      pragma Import (C, Wredrawln, "wredrawln");   begin      if Wredrawln (Win,                    C_Int (Begin_Line),                    C_Int (Line_Count)) = Curses_Err then         raise Curses_Exception;      end if;   end Redraw;------------------------------------------------------------------------------   procedure Erase (Win : in Window := Standard_Window)   is      function Werase (W : Window) return C_Int;      pragma Import (C, Werase, "werase");   begin      if Werase (Win) = Curses_Err then         raise Curses_Exception;      end if;   end Erase;   procedure Clear (Win : in Window := Standard_Window)   is      function Wclear (W : Window) return C_Int;      pragma Import (C, Wclear, "wclear");

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -