18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef _PERF_GTK_H_
38c2ecf20Sopenharmony_ci#define _PERF_GTK_H_ 1
48c2ecf20Sopenharmony_ci
58c2ecf20Sopenharmony_ci#include <stdbool.h>
68c2ecf20Sopenharmony_ci
78c2ecf20Sopenharmony_ci#pragma GCC diagnostic ignored "-Wstrict-prototypes"
88c2ecf20Sopenharmony_ci#include <gtk/gtk.h>
98c2ecf20Sopenharmony_ci#pragma GCC diagnostic error "-Wstrict-prototypes"
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci
128c2ecf20Sopenharmony_cistruct perf_gtk_context {
138c2ecf20Sopenharmony_ci	GtkWidget *main_window;
148c2ecf20Sopenharmony_ci	GtkWidget *notebook;
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci#ifdef HAVE_GTK_INFO_BAR_SUPPORT
178c2ecf20Sopenharmony_ci	GtkWidget *info_bar;
188c2ecf20Sopenharmony_ci	GtkWidget *message_label;
198c2ecf20Sopenharmony_ci#endif
208c2ecf20Sopenharmony_ci	GtkWidget *statbar;
218c2ecf20Sopenharmony_ci	guint statbar_ctx_id;
228c2ecf20Sopenharmony_ci};
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ciint perf_gtk__init(void);
258c2ecf20Sopenharmony_civoid perf_gtk__exit(bool wait_for_ok);
268c2ecf20Sopenharmony_ci
278c2ecf20Sopenharmony_ciextern struct perf_gtk_context *pgctx;
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistatic inline bool perf_gtk__is_active_context(struct perf_gtk_context *ctx)
308c2ecf20Sopenharmony_ci{
318c2ecf20Sopenharmony_ci	return ctx && ctx->main_window;
328c2ecf20Sopenharmony_ci}
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_cistruct perf_gtk_context *perf_gtk__activate_context(GtkWidget *window);
358c2ecf20Sopenharmony_ciint perf_gtk__deactivate_context(struct perf_gtk_context **ctx);
368c2ecf20Sopenharmony_ci
378c2ecf20Sopenharmony_civoid perf_gtk__init_helpline(void);
388c2ecf20Sopenharmony_civoid gtk_ui_progress__init(void);
398c2ecf20Sopenharmony_civoid perf_gtk__init_hpp(void);
408c2ecf20Sopenharmony_ci
418c2ecf20Sopenharmony_civoid perf_gtk__signal(int sig);
428c2ecf20Sopenharmony_civoid perf_gtk__resize_window(GtkWidget *window);
438c2ecf20Sopenharmony_ciconst char *perf_gtk__get_percent_color(double percent);
448c2ecf20Sopenharmony_ciGtkWidget *perf_gtk__setup_statusbar(void);
458c2ecf20Sopenharmony_ci
468c2ecf20Sopenharmony_ci#ifdef HAVE_GTK_INFO_BAR_SUPPORT
478c2ecf20Sopenharmony_ciGtkWidget *perf_gtk__setup_info_bar(void);
488c2ecf20Sopenharmony_ci#else
498c2ecf20Sopenharmony_cistatic inline GtkWidget *perf_gtk__setup_info_bar(void)
508c2ecf20Sopenharmony_ci{
518c2ecf20Sopenharmony_ci	return NULL;
528c2ecf20Sopenharmony_ci}
538c2ecf20Sopenharmony_ci#endif
548c2ecf20Sopenharmony_ci
558c2ecf20Sopenharmony_cistruct evsel;
568c2ecf20Sopenharmony_cistruct evlist;
578c2ecf20Sopenharmony_cistruct hist_entry;
588c2ecf20Sopenharmony_cistruct hist_browser_timer;
598c2ecf20Sopenharmony_ci
608c2ecf20Sopenharmony_ciint perf_evlist__gtk_browse_hists(struct evlist *evlist, const char *help,
618c2ecf20Sopenharmony_ci				  struct hist_browser_timer *hbt,
628c2ecf20Sopenharmony_ci				  float min_pcnt);
638c2ecf20Sopenharmony_ciint hist_entry__gtk_annotate(struct hist_entry *he,
648c2ecf20Sopenharmony_ci			     struct evsel *evsel,
658c2ecf20Sopenharmony_ci			     struct hist_browser_timer *hbt);
668c2ecf20Sopenharmony_civoid perf_gtk__show_annotations(void);
678c2ecf20Sopenharmony_ci
688c2ecf20Sopenharmony_ci#endif /* _PERF_GTK_H_ */
69