OpenClonk
preview.h File Reference
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gtk/gtk.h>
#include "mape/forward.h"
Include dependency graph for preview.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  MapePreView_
 

Typedefs

typedef enum MapePreViewError_ MapePreViewError
 

Enumerations

enum  MapePreViewError_ { MAPE_PRE_VIEW_ERROR_MISSING_MAPS , MAPE_PRE_VIEW_ERROR_FAILED }
 

Functions

MapePreViewmape_pre_view_new (MapeMatTexView *mat_tex, GError **error)
 
void mape_pre_view_destroy (MapePreView *view)
 
void mape_pre_view_update (MapePreView *view, GdkPixbuf *pixbuf)
 
void mape_pre_view_apply_preferences (MapePreView *view, MapePreferences *preferences)
 

Class Documentation

◆ MapePreView_

struct MapePreView_

Definition at line 28 of file preview.h.

Collaboration diagram for MapePreView_:
[legend]
Class Members
GtkWidget * event_box
GtkWidget * frame
GtkWidget * image
MapeMatTexView * mat_tex

Typedef Documentation

◆ MapePreViewError

Enumeration Type Documentation

◆ MapePreViewError_

Enumerator
MAPE_PRE_VIEW_ERROR_MISSING_MAPS 
MAPE_PRE_VIEW_ERROR_FAILED 

Definition at line 23 of file preview.h.

23  {
enum MapePreViewError_ MapePreViewError
@ MAPE_PRE_VIEW_ERROR_MISSING_MAPS
Definition: preview.h:24
@ MAPE_PRE_VIEW_ERROR_FAILED
Definition: preview.h:25

Function Documentation

◆ mape_pre_view_apply_preferences()

void mape_pre_view_apply_preferences ( MapePreView view,
MapePreferences preferences 
)

Definition at line 64 of file preview.c.

66 {
67  gtk_widget_set_size_request(view->image, preferences->map_width, preferences->map_height);
68 }
unsigned int map_height
Definition: preferences.h:33
unsigned int map_width
Definition: preferences.h:32
GtkWidget * image
Definition: preview.h:31

References MapePreView_::image, MapePreferences_::map_height, and MapePreferences_::map_width.

◆ mape_pre_view_destroy()

void mape_pre_view_destroy ( MapePreView view)

Definition at line 47 of file preview.c.

48 {
49  free(view);
50 }

Referenced by mape_window_destroy().

Here is the caller graph for this function:

◆ mape_pre_view_new()

MapePreView* mape_pre_view_new ( MapeMatTexView mat_tex,
GError **  error 
)

Definition at line 21 of file preview.c.

23 {
24  MapePreView* view;
25  view = malloc(sizeof(MapePreView) );
26 
27  view->mat_tex = mat_tex;
28 
29  view->image = gtk_image_new();
30  gtk_widget_show(view->image);
31 
32  view->event_box = gtk_event_box_new();
33  gtk_container_add(GTK_CONTAINER(view->event_box), view->image);
34  gtk_widget_add_events(view->event_box, GDK_BUTTON_PRESS_MASK);
35  gtk_widget_show(view->event_box);
36 
37  view->frame = gtk_frame_new(NULL);/*"Landscape preview");*/
38  gtk_frame_set_shadow_type(GTK_FRAME(view->frame), GTK_SHADOW_IN);
39  gtk_container_add(GTK_CONTAINER(view->frame), view->event_box);
40  gtk_widget_show(view->frame);
41 
42  /*gtk_widget_set_size_request(view->image, preferences->map_width, preferences->map_height);*/
43 
44  return view;
45 }
GtkWidget * event_box
Definition: preview.h:30
GtkWidget * frame
Definition: preview.h:29
MapeMatTexView * mat_tex
Definition: preview.h:34

References MapePreView_::event_box, MapePreView_::frame, MapePreView_::image, and MapePreView_::mat_tex.

Referenced by mape_window_new().

Here is the caller graph for this function:

◆ mape_pre_view_update()

void mape_pre_view_update ( MapePreView view,
GdkPixbuf *  pixbuf 
)

Definition at line 52 of file preview.c.

54 {
55  /* TODO: Unref old pixbuf */
56  /* TODO: ref new pixbuf? */
57  gtk_image_set_from_pixbuf(GTK_IMAGE(view->image), pixbuf);
58 
59  /* Update size from image, in case Map.c specifies different map dimensions */
60  if(pixbuf != NULL)
61  gtk_widget_set_size_request(view->image, gdk_pixbuf_get_width(pixbuf), gdk_pixbuf_get_height(pixbuf));
62 }

References MapePreView_::image.