mirror of
https://github.com/JetSetIlly/Gopher2600.git
synced 2025-04-02 11:02:17 -04:00
this allows us to remove the global DisableSaving flag from the prefs package. it also allows us to remove the preferences.go file from the debugger package, simplifying things a little bit the ReqROMSelector request has been removed from the gui package and handling from the sdlimgui package. the decision on whether to open the ROM selector is done entirely inside the sdlimgui package now. this is good because there shouldn't be any need for the debugger package to worry about that kind of thing
70 lines
2.9 KiB
Go
70 lines
2.9 KiB
Go
// This file is part of Gopher2600.
|
|
//
|
|
// Gopher2600 is free software: you can redistribute it and/or modify
|
|
// it under the terms of the GNU General Public License as published by
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
// (at your option) any later version.
|
|
//
|
|
// Gopher2600 is distributed in the hope that it will be useful,
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
// GNU General Public License for more details.
|
|
//
|
|
// You should have received a copy of the GNU General Public License
|
|
// along with Gopher2600. If not, see <https://www.gnu.org/licenses/>.
|
|
|
|
package gui
|
|
|
|
// GUI defines the operations that can be performed on visual user interfaces.
|
|
type GUI interface {
|
|
// Send a request to set a GUI feature. Returns an error so that it can be
|
|
// shown in the appropriate context (terminal or the log depending on what
|
|
// was being requested)
|
|
SetFeature(request FeatureReq, args ...FeatureReqData) error
|
|
}
|
|
|
|
// FeatureReq is used to request the setting of a gui attribute eg. toggling the overlay.
|
|
type FeatureReq string
|
|
|
|
// FeatureReqData represents the information associated with a FeatureReq. See
|
|
// commentary for the defined FeatureReq values for the underlying type.
|
|
type FeatureReqData any
|
|
|
|
// List of valid feature requests. argument must be of the type specified or
|
|
// else the 'any' type conversion will fail and the application will probably
|
|
// crash.
|
|
//
|
|
// Note that, like the name suggests, these are requests, they may or may not
|
|
// be satisfied depending other conditions in the GUI.
|
|
const (
|
|
// notify gui of the underlying emulation mode.
|
|
ReqSetEmulationMode FeatureReq = "ReqSetEmulationMode" // govern.Mode
|
|
|
|
// program is ending. gui should do anything required before final exit.
|
|
ReqEnd FeatureReq = "ReqEnd" // nil
|
|
|
|
// put gui output into full-screen mode (ie. no window border and content
|
|
// the size of the monitor).
|
|
ReqFullScreen FeatureReq = "ReqFullScreen" // bool
|
|
|
|
// an event generated by the cartridge has occured. for example, network
|
|
// activity from a PlusROM cartridge.
|
|
ReqNotification FeatureReq = "ReqNotification" // notifications.Notify
|
|
|
|
// peripheral has been changed for one of the ports.
|
|
ReqPeripheralPlugged FeatureReq = "ReqPeripheralPlugging" // plugging.PortID, plugging.PeripheralID
|
|
|
|
// request for a comparison window to be opened.
|
|
ReqComparison FeatureReq = "ReqComparison" // chan *image.RGBA, chan *image.RGBA, chan string
|
|
|
|
// request for bot features to be enabled. a nil argument will cause the
|
|
// bot features to be removed.
|
|
ReqBotFeedback FeatureReq = "ReqBotFeedback" // *bots.Feedback
|
|
|
|
// request for the coprocess source window to open at the specified line
|
|
ReqCoProcSourceLine FeatureReq = "ReqCoProcSourceLine" // *developer.SourceLine
|
|
|
|
// request a screenshot to be taken
|
|
// optional argument is the filename for the screenshot
|
|
ReqScreenshot FeatureReq = "ReqScreenshot" // [optional] filename
|
|
)
|